Skip to content

Commit 77baf54

Browse files
authored
Use LazyArtifacts package when the artifact is lazy (#982)
1 parent dc61a45 commit 77baf54

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/AutoBuild.jl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
298298
end
299299

300300
register_jll(src_name, build_version, dependencies, julia_compat;
301-
deploy_repo=deploy_jll_repo, code_dir=code_dir)
301+
deploy_repo=deploy_jll_repo, code_dir=code_dir, extra_kwargs...)
302302
end
303303
end
304304

@@ -451,7 +451,9 @@ function register_jll(name, build_version, dependencies, julia_compat;
451451
deploy_repo="JuliaBinaryWrappers/$(name)_jll.jl",
452452
code_dir=joinpath(Pkg.devdir(), "$(name)_jll"),
453453
gh_auth=Wizard.github_auth(;allow_anonymous=false),
454-
gh_username=gh_get_json(DEFAULT_API, "/user"; auth=gh_auth)["login"])
454+
gh_username=gh_get_json(DEFAULT_API, "/user"; auth=gh_auth)["login"],
455+
lazy_artifacts::Bool=false,
456+
kwargs...)
455457
if !Base.isidentifier(name)
456458
error("Package name \"$(name)\" is not a valid identifier")
457459
end
@@ -463,7 +465,7 @@ function register_jll(name, build_version, dependencies, julia_compat;
463465
cache = RegistryTools.RegistryCache(joinpath(Pkg.depots1(), "registries_binarybuilder"))
464466
registry_url = "https://$(gh_username):$(gh_auth.token)@github.com/JuliaRegistries/General"
465467
cache.registries[registry_url] = Base.UUID("23338594-aafe-5451-b93e-139f81909106")
466-
project = Pkg.Types.Project(build_project_dict(name, build_version, dependencies, julia_compat))
468+
project = Pkg.Types.Project(build_project_dict(name, build_version, dependencies, julia_compat; lazy_artifact=lazy_artifact))
467469
errors = setdiff(RegistryTools.registrator_errors, [:version_less_than_all_existing])
468470
reg_branch = RegistryTools.register(
469471
"https://github.com/$(deploy_repo).git",
@@ -1180,6 +1182,11 @@ function build_jll_package(src_name::String,
11801182
baremodule $(src_name)_jll
11811183
using Base
11821184
using Base: UUID
1185+
""")
1186+
if lazy_artifacts
1187+
println(io, "using LazyArtifacts")
1188+
end
1189+
print(io, """
11831190
import JLLWrappers
11841191
11851192
JLLWrappers.@generate_main_file_header($(repr(src_name)))
@@ -1295,7 +1302,7 @@ function build_jll_package(src_name::String,
12951302
rm(joinpath(code_dir, "LICENSE.md"); force=true)
12961303

12971304
# Add a Project.toml
1298-
project = build_project_dict(src_name, build_version, dependencies, julia_compat)
1305+
project = build_project_dict(src_name, build_version, dependencies, julia_compat; lazy_artifacts=lazy_artifacts)
12991306
open(joinpath(code_dir, "Project.toml"), "w") do io
13001307
Pkg.TOML.print(io, project)
13011308
end
@@ -1345,7 +1352,7 @@ const uuid_package = UUID("cfb74b52-ec16-5bb7-a574-95d9e393895e")
13451352
# For even more interesting historical reasons, we append an extra
13461353
# "_jll" to the name of the new package before computing its UUID.
13471354
jll_uuid(name) = bb_specific_uuid5(uuid_package, "$(name)_jll")
1348-
function build_project_dict(name, version, dependencies::Array{Dependency}, julia_compat::String=DEFAULT_JULIA_VERSION_SPEC)
1355+
function build_project_dict(name, version, dependencies::Array{Dependency}, julia_compat::String=DEFAULT_JULIA_VERSION_SPEC; lazy_artifacts::Bool=false, kwargs...)
13491356
function has_compat_info(d::Dependency)
13501357
r = Pkg.Types.VersionRange()
13511358
return isa(d.pkg.version, VersionNumber) ||
@@ -1389,6 +1396,9 @@ function build_project_dict(name, version, dependencies::Array{Dependency}, juli
13891396
project["deps"]["Pkg"] = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
13901397
project["deps"]["Artifacts"] = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
13911398
project["deps"]["JLLWrappers"] = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
1399+
if lazy_artifacts
1400+
project["deps"]["LazyArtifacts"] = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
1401+
end
13921402

13931403
return project
13941404
end

0 commit comments

Comments
 (0)