Skip to content

Commit 728cae4

Browse files
vchuravygiordano
andauthored
Load top-level dependencies in the main source file (#1231)
Co-authored-by: Mosè Giordano <giordano@users.noreply.github.com>
1 parent c1a0d6a commit 728cae4

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

Manifest.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.8.1"
3+
julia_version = "1.8.0"
44
manifest_format = "2.0"
5-
project_hash = "f35810f1518b3c855e1d8ed4f1522241fc6dcb7a"
5+
project_hash = "1e87134dc5853b26c2f65af5a46eb0a2d987da86"
66

77
[[deps.ArgParse]]
88
deps = ["Logging", "TextWrap"]
@@ -33,11 +33,11 @@ uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
3333

3434
[[deps.BinaryBuilderBase]]
3535
deps = ["CodecZlib", "Downloads", "InteractiveUtils", "JSON", "LibGit2", "LibGit2_jll", "Libdl", "Logging", "OrderedCollections", "OutputCollectors", "Pkg", "ProgressMeter", "Random", "SHA", "Scratch", "SimpleBufferStream", "TOML", "Tar", "UUIDs", "p7zip_jll", "pigz_jll"]
36-
git-tree-sha1 = "9b1c2e9866fdf353f925693d69aa440dec5b4c60"
36+
git-tree-sha1 = "29d27e44a3eb75a8487e08e7e26cf3873f1759db"
3737
repo-rev = "master"
3838
repo-url = "https://github.com/JuliaPackaging/BinaryBuilderBase.jl.git"
3939
uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e"
40-
version = "1.15.0"
40+
version = "1.17.0"
4141

4242
[[deps.CodecZlib]]
4343
deps = ["TranscodingStreams", "Zlib_jll"]

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ ghr_jll = "07c12ed4-43bc-5495-8a2a-d5838ef8d533"
3333

3434
[compat]
3535
ArgParse = "1.1"
36-
BinaryBuilderBase = "1.15"
36+
BinaryBuilderBase = "1.17"
3737
GitHub = "5.1"
3838
HTTP = "0.8, 0.9, 1"
3939
JLD2 = "0.1.6, 0.2, 0.3, 0.4"

src/AutoBuild.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,9 @@ function build_jll_package(src_name::String,
12651265
""")
12661266
end
12671267
for dep in filter_platforms(dependencies, platform)
1268-
println(io, "using $(getname(dep))")
1268+
if !is_top_level_dependency(dep)
1269+
println(io, "using $(getname(dep))")
1270+
end
12691271
end
12701272

12711273
# Generate header definitions like `find_artifact_dir()`
@@ -1388,6 +1390,12 @@ function build_jll_package(src_name::String,
13881390
println(io, "using LazyArtifacts")
13891391
end
13901392

1393+
for dep in dependencies
1394+
if is_top_level_dependency(dep)
1395+
println(io, "using $(getname(dep))")
1396+
end
1397+
end
1398+
13911399
if !isempty(augment_platform_block)
13921400
print(io, """
13931401
Base.include(@__MODULE__, joinpath("..", ".pkg", "platform_augmentation.jl"))

test/jll.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ end
4848
freebsd = Platform("x86_64", "freebsd")
4949
platforms = [platform, freebsd]
5050
# We depend on Zlib_jll only on the host platform, but not on FreeBSD
51-
dependencies = [Dependency("Zlib_jll"; platforms=[platform])]
51+
dependencies = [
52+
Dependency("Zlib_jll"; platforms=[platform]),
53+
Dependency("Preferences"; top_level=true)
54+
]
5255
# Augment platform
5356
augment_platform_block = """
5457
using Base.BinaryPlatforms
@@ -176,8 +179,12 @@ end
176179
# platform and not the FreeBSD one.
177180
platform_wrapper = joinpath(code_dir, "src", "wrappers", triplet(platform) * ".jl")
178181
freebsd_wrapper = joinpath(code_dir, "src", "wrappers", triplet(freebsd) * ".jl")
182+
main_src = joinpath(code_dir, "src", name * "_jll.jl")
179183
@test contains(readchomp(platform_wrapper), "using Zlib_jll")
180184
@test !contains(readchomp(freebsd_wrapper), "using Zlib_jll")
185+
@test !contains(readchomp(platform_wrapper), "using Preferences")
186+
@test !contains(readchomp(freebsd_wrapper), "using Preferences")
187+
@test contains(readchomp(main_src), "using Preferences")
181188
# Load JLL package and run some actual code from it.
182189
@eval TestJLL using libfoo_jll
183190
@test 6.08 @eval TestJLL ccall((:foo, libfoo), Cdouble, (Cdouble, Cdouble), 2.3, 4.5)

0 commit comments

Comments
 (0)