Skip to content

Commit 1596b7a

Browse files
authored
Add JuliaFormatter (#73)
1 parent 8d57402 commit 1596b7a

23 files changed

+2762
-764
lines changed

.JuliaFormatter.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Configuration file for JuliaFormatter.jl
2+
# For more information, see: https://domluna.github.io/JuliaFormatter.jl/stable/config/
3+
4+
always_for_in = true
5+
always_use_return = true
6+
margin = 80
7+
remove_extra_newlines = true
8+
short_to_long_function_def = true

.github/workflows/format_check.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: format-check
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- release-*
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: julia-actions/setup-julia@latest
14+
with:
15+
version: '1'
16+
- uses: actions/checkout@v1
17+
- name: Format check
18+
shell: julia --color=yes {0}
19+
run: |
20+
using Pkg
21+
Pkg.add(PackageSpec(name="JuliaFormatter", version="0.22.4"))
22+
using JuliaFormatter
23+
format(".", verbose=true)
24+
out = String(read(Cmd(`git diff`)))
25+
if isempty(out)
26+
exit(0)
27+
end
28+
@error "Some files have not been formatted !!!"
29+
write(stdout, out)
30+
exit(1)

deps/build.jl

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ module Anon2 end
44
module Anon3 end
55

66
@static if VERSION < v"1.3.0"
7+
using BinaryProvider # requires BinaryProvider 0.3.0 or later
78

8-
using BinaryProvider # requires BinaryProvider 0.3.0 or later
9+
# Parse some basic command-line arguments
10+
const verbose = "--verbose" in ARGS
11+
const prefix = Prefix(
12+
get(
13+
[a for a in ARGS if a != "--verbose"],
14+
1,
15+
joinpath(@__DIR__, "usr"),
16+
),
17+
)
918

10-
# Parse some basic command-line arguments
11-
const verbose = "--verbose" in ARGS
12-
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
19+
products = [LibraryProduct(prefix, ["libcsdp"], :libcsdp)]
1320

14-
products = [
15-
LibraryProduct(prefix, ["libcsdp"], :libcsdp)
16-
]
17-
18-
Anon1.include("build_CompilerSupportLibraries.v0.3.3.jl")
19-
Anon2.include("build_OpenBLAS32.v0.3.9.jl")
20-
Anon3.include("build_CSDP.v6.2.0.jl")
21-
22-
# Finally, write out a deps.jl file
23-
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose=true)
21+
Anon1.include("build_CompilerSupportLibraries.v0.3.3.jl")
22+
Anon2.include("build_OpenBLAS32.v0.3.9.jl")
23+
Anon3.include("build_CSDP.v6.2.0.jl")
2424

25+
# Finally, write out a deps.jl file
26+
write_deps_file(joinpath(@__DIR__, "deps.jl"), products, verbose = true)
2527
end # VERSION

deps/build_CSDP.v6.2.0.jl

Lines changed: 69 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,94 @@ using BinaryProvider # requires BinaryProvider 0.3.0 or later
77

88
# Parse some basic command-line arguments
99
const verbose = "--verbose" in ARGS
10-
const prefix = Prefix(get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")))
11-
products = [
12-
LibraryProduct(prefix, ["libcsdp"], :libcsdp)
13-
]
10+
const prefix = Prefix(
11+
get([a for a in ARGS if a != "--verbose"], 1, joinpath(@__DIR__, "usr")),
12+
)
13+
products = [LibraryProduct(prefix, ["libcsdp"], :libcsdp)]
1414

1515
# Download binaries from hosted location
1616
bin_prefix = "https://github.com/JuliaBinaryWrappers/CSDP_jll.jl/releases/download/CSDP-v6.2.0+4"
1717

1818
# Listing of files generated by BinaryBuilder:
1919
download_info = Dict(
20-
Linux(:aarch64, libc=:glibc) => ("$bin_prefix/CSDP.v6.2.0.aarch64-linux-gnu.tar.gz", "446a2d5c60a9270a345d2aab12093c76accab967c175ff96de7f684e48c2f482"),
21-
Linux(:aarch64, libc=:musl) => ("$bin_prefix/CSDP.v6.2.0.aarch64-linux-musl.tar.gz", "1e0c1e5c89e6b70538ff9b4e705bda3d267721ae4d58ee600152bc5f6101bf46"),
22-
Linux(:armv7l, libc=:glibc, call_abi=:eabihf) => ("$bin_prefix/CSDP.v6.2.0.armv7l-linux-gnueabihf.tar.gz", "88532fc19eb7a33b72bad0b7e01d61b1bd29b6069b4a883d468d6e12f00cf711"),
23-
Linux(:armv7l, libc=:musl, call_abi=:eabihf) => ("$bin_prefix/CSDP.v6.2.0.armv7l-linux-musleabihf.tar.gz", "f1dd8bba6a91b4c94394ad421487b99249c8abd592dfbb2256d0dee704ea2a82"),
24-
Linux(:i686, libc=:glibc) => ("$bin_prefix/CSDP.v6.2.0.i686-linux-gnu.tar.gz", "80e2a2b2263ca378efb23cd565814bd66f5e120cdb955e9bdf548ab32b43b75d"),
25-
Linux(:i686, libc=:musl) => ("$bin_prefix/CSDP.v6.2.0.i686-linux-musl.tar.gz", "df0608d84f7b4c511ef002271f0f6a9481a81da3e3c751d36392d6fc89540cf2"),
26-
Windows(:i686) => ("$bin_prefix/CSDP.v6.2.0.i686-w64-mingw32.tar.gz", "33f83f94bcec13087f9fa9276345ec296722b14b6a28c3790bb494e419bf41ea"),
27-
Linux(:powerpc64le, libc=:glibc) => ("$bin_prefix/CSDP.v6.2.0.powerpc64le-linux-gnu.tar.gz", "461214a00369395ccd544ec40e7c89d787fcc2a869aeb73a832f79ff06c16b97"),
28-
MacOS(:x86_64) => ("$bin_prefix/CSDP.v6.2.0.x86_64-apple-darwin14.tar.gz", "af4cbf6d324b32f26e3700d50ed2950eebbd3bdc6cc13eae8c1d15ba25c70de6"),
29-
Linux(:x86_64, libc=:glibc) => ("$bin_prefix/CSDP.v6.2.0.x86_64-linux-gnu.tar.gz", "7ddaafbe0079f6852b60c3479bbed050b367931da3c231ba26ef20c2b71c698f"),
30-
Linux(:x86_64, libc=:musl) => ("$bin_prefix/CSDP.v6.2.0.x86_64-linux-musl.tar.gz", "337e68f51132e080d8bb5cdf79197326df9637ede69ed9258c67626a99edc7b5"),
31-
FreeBSD(:x86_64) => ("$bin_prefix/CSDP.v6.2.0.x86_64-unknown-freebsd11.1.tar.gz", "d7affbc5d639bff71fce4848d77d368dbca49dd8125cf849a416c4c059668201"),
32-
Windows(:x86_64) => ("$bin_prefix/CSDP.v6.2.0.x86_64-w64-mingw32.tar.gz", "181520ca04efb32323a369ecee7d067937d9a59d5f45ed4b78d3669f8a52769d"),
20+
Linux(:aarch64, libc = :glibc) => (
21+
"$bin_prefix/CSDP.v6.2.0.aarch64-linux-gnu.tar.gz",
22+
"446a2d5c60a9270a345d2aab12093c76accab967c175ff96de7f684e48c2f482",
23+
),
24+
Linux(:aarch64, libc = :musl) => (
25+
"$bin_prefix/CSDP.v6.2.0.aarch64-linux-musl.tar.gz",
26+
"1e0c1e5c89e6b70538ff9b4e705bda3d267721ae4d58ee600152bc5f6101bf46",
27+
),
28+
Linux(:armv7l, libc = :glibc, call_abi = :eabihf) => (
29+
"$bin_prefix/CSDP.v6.2.0.armv7l-linux-gnueabihf.tar.gz",
30+
"88532fc19eb7a33b72bad0b7e01d61b1bd29b6069b4a883d468d6e12f00cf711",
31+
),
32+
Linux(:armv7l, libc = :musl, call_abi = :eabihf) => (
33+
"$bin_prefix/CSDP.v6.2.0.armv7l-linux-musleabihf.tar.gz",
34+
"f1dd8bba6a91b4c94394ad421487b99249c8abd592dfbb2256d0dee704ea2a82",
35+
),
36+
Linux(:i686, libc = :glibc) => (
37+
"$bin_prefix/CSDP.v6.2.0.i686-linux-gnu.tar.gz",
38+
"80e2a2b2263ca378efb23cd565814bd66f5e120cdb955e9bdf548ab32b43b75d",
39+
),
40+
Linux(:i686, libc = :musl) => (
41+
"$bin_prefix/CSDP.v6.2.0.i686-linux-musl.tar.gz",
42+
"df0608d84f7b4c511ef002271f0f6a9481a81da3e3c751d36392d6fc89540cf2",
43+
),
44+
Windows(:i686) => (
45+
"$bin_prefix/CSDP.v6.2.0.i686-w64-mingw32.tar.gz",
46+
"33f83f94bcec13087f9fa9276345ec296722b14b6a28c3790bb494e419bf41ea",
47+
),
48+
Linux(:powerpc64le, libc = :glibc) => (
49+
"$bin_prefix/CSDP.v6.2.0.powerpc64le-linux-gnu.tar.gz",
50+
"461214a00369395ccd544ec40e7c89d787fcc2a869aeb73a832f79ff06c16b97",
51+
),
52+
MacOS(:x86_64) => (
53+
"$bin_prefix/CSDP.v6.2.0.x86_64-apple-darwin14.tar.gz",
54+
"af4cbf6d324b32f26e3700d50ed2950eebbd3bdc6cc13eae8c1d15ba25c70de6",
55+
),
56+
Linux(:x86_64, libc = :glibc) => (
57+
"$bin_prefix/CSDP.v6.2.0.x86_64-linux-gnu.tar.gz",
58+
"7ddaafbe0079f6852b60c3479bbed050b367931da3c231ba26ef20c2b71c698f",
59+
),
60+
Linux(:x86_64, libc = :musl) => (
61+
"$bin_prefix/CSDP.v6.2.0.x86_64-linux-musl.tar.gz",
62+
"337e68f51132e080d8bb5cdf79197326df9637ede69ed9258c67626a99edc7b5",
63+
),
64+
FreeBSD(:x86_64) => (
65+
"$bin_prefix/CSDP.v6.2.0.x86_64-unknown-freebsd11.1.tar.gz",
66+
"d7affbc5d639bff71fce4848d77d368dbca49dd8125cf849a416c4c059668201",
67+
),
68+
Windows(:x86_64) => (
69+
"$bin_prefix/CSDP.v6.2.0.x86_64-w64-mingw32.tar.gz",
70+
"181520ca04efb32323a369ecee7d067937d9a59d5f45ed4b78d3669f8a52769d",
71+
),
3372
)
3473

3574
# Install unsatisfied or updated dependencies:
3675
# We added `, isolate=true` as otherwise, it would segfault when closing `OpenBLAS32`,
3776
# probably because it is conflicting with Julia openblas.
38-
unsatisfied = any(!satisfied(p; verbose=verbose, isolate=true) for p in products)
77+
unsatisfied =
78+
any(!satisfied(p; verbose = verbose, isolate = true) for p in products)
3979
dl_info = choose_download(download_info, platform_key_abi())
4080
if dl_info === nothing && unsatisfied
4181
# If we don't have a compatible .tar.gz to download, complain.
4282
# Alternatively, you could attempt to install from a separate provider,
4383
# build from source or something even more ambitious here.
44-
error("Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!")
84+
error(
85+
"Your platform (\"$(Sys.MACHINE)\", parsed as \"$(triplet(platform_key_abi()))\") is not supported by this package!",
86+
)
4587
end
4688

4789
# If we have a download, and we are unsatisfied (or the version we're
4890
# trying to install is not itself installed) then load it up!
49-
if unsatisfied || !isinstalled(dl_info...; prefix=prefix)
91+
if unsatisfied || !isinstalled(dl_info...; prefix = prefix)
5092
# Download and install binaries
51-
install(dl_info...; prefix=prefix, force=true, verbose=verbose, ignore_platform=true)
93+
install(
94+
dl_info...;
95+
prefix = prefix,
96+
force = true,
97+
verbose = verbose,
98+
ignore_platform = true,
99+
)
52100
end

0 commit comments

Comments
 (0)