1- export build_tarballs, autobuild, print_artifacts_toml, build, get_meta_json
1+ export build_tarballs, autobuild, build, get_meta_json
22import GitHub: gh_get_json, DEFAULT_API
33import SHA: sha256, sha1
44using TOML, Dates, UUIDs
@@ -43,6 +43,11 @@ function Base.show(io::IO, t::BuildTimer)
4343 end
4444end
4545
46+ const devdir = Ref (Pkg. devdir ())
47+
48+ namejll (name:: AbstractString ) = name * " _jll"
49+ codedir (name:: AbstractString ) = joinpath (devdir[], namejll (name))
50+
4651exclude_logs (_, f) = f != " logs"
4752only_logs (_, f) = f == " logs"
4853
@@ -233,9 +238,9 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
233238 meta_json, meta_json_file = extract_flag! (ARGS , " --meta-json" )
234239
235240 # This sets whether we are going to deploy our binaries/wrapper code to GitHub releases
236- deploy, deploy_repo = extract_flag! (ARGS , " --deploy" , " JuliaBinaryWrappers/$(src_name) _jll .jl" )
237- deploy_bin, deploy_bin_repo = extract_flag! (ARGS , " --deploy-bin" , " JuliaBinaryWrappers/$(src_name) _jll .jl" )
238- deploy_jll, deploy_jll_repo = extract_flag! (ARGS , " --deploy-jll" , " JuliaBinaryWrappers/$(src_name) _jll .jl" )
241+ deploy, deploy_repo = extract_flag! (ARGS , " --deploy" , " JuliaBinaryWrappers/$(namejll ( src_name)) .jl" )
242+ deploy_bin, deploy_bin_repo = extract_flag! (ARGS , " --deploy-bin" , " JuliaBinaryWrappers/$(namejll ( src_name)) .jl" )
243+ deploy_jll, deploy_jll_repo = extract_flag! (ARGS , " --deploy-jll" , " JuliaBinaryWrappers/$(namejll ( src_name)) .jl" )
239244
240245 # Resolve deploy settings
241246 if deploy
@@ -266,7 +271,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
266271 skip_build = check_flag! (ARGS , " --skip-build" )
267272
268273 if deploy_bin || deploy_jll
269- code_dir = joinpath (Pkg . devdir (), " $( src_name) _jll " )
274+ code_dir = codedir ( src_name)
270275
271276 # Shove them into `kwargs` so that we are conditionally passing them along
272277 kwargs = (; kwargs... , code_dir = code_dir)
@@ -378,16 +383,22 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
378383 )
379384 end
380385
386+ products_dir = joinpath (pwd (), " products" )
381387 if deploy_jll
382388 if verbose
383- @info (" Committing and pushing $(src_name) _jll .jl wrapper code version $(build_version) ..." )
389+ @info (" Committing and pushing $(namejll ( src_name)) .jl wrapper code version $(build_version) ..." )
384390 end
385391
386392 # For deploy keep only runtime dependencies.
387393 dependencies = [dep for dep in dependencies if is_runtime_dependency (dep)]
388394
395+
389396 # The location the binaries will be available from
390- bin_path = " https://github.com/$(deploy_jll_repo) /releases/download/$(tag) "
397+ bin_path = if deploy_jll_repo == " local"
398+ " file://$(products_dir) "
399+ else
400+ " https://github.com/$(deploy_jll_repo) /releases/download/$(tag) "
401+ end
391402
392403 if ! skip_build
393404 # Build JLL package based on output of autobuild
@@ -396,7 +407,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
396407 else
397408 # Rebuild output meta data from the information we have here
398409 rebuild_jll_package (src_name, build_version, sources, platforms, products, dependencies,
399- joinpath ( pwd (), " products " ) , bin_path;
410+ products_dir , bin_path;
400411 code_dir, verbose, from_scratch= false ,
401412 julia_compat, extra_kwargs... )
402413 end
@@ -418,7 +429,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
418429 if verbose
419430 @info (" Deploying binaries to release $(tag) on $(deploy_bin_repo) via `ghr`..." )
420431 end
421- upload_to_github_releases (deploy_bin_repo, tag, joinpath ( pwd (), " products " ) ; verbose= verbose)
432+ upload_to_github_releases (deploy_bin_repo, tag, products_dir ; verbose= verbose)
422433 end
423434
424435 return build_output_meta
@@ -518,12 +529,11 @@ function get_next_wrapper_version(src_name::AbstractString, src_version::Version
518529 # Force-update the registry here, since we may have pushed a new version recently
519530 update_registry (devnull )
520531
521- jll_name = " $(src_name) _jll"
522- uuid = jll_uuid (jll_name)
532+ uuid = jll_uuid (namejll (src_name))
523533
524534 # If it does, we need to bump the build number up to the next value
525535 build_number = UInt64 (0 )
526- if uuid in Pkg. Types. registered_uuids (ctx. registries, jll_name )
536+ if uuid in Pkg. Types. registered_uuids (ctx. registries, namejll (src_name) )
527537 # Collect all version numbers of the package across all registries.
528538 versions = VersionNumber[]
529539 for reg in ctx. registries
@@ -577,8 +587,8 @@ is_yggdrasil() = get(ENV, "YGGDRASIL", "false") == "true"
577587yggdrasil_head () = get (ENV , " BUILDKITE_COMMIT" , " " )
578588
579589function register_jll (name, build_version, dependencies, julia_compat;
580- deploy_repo= " JuliaBinaryWrappers/$(name) _jll .jl" ,
581- code_dir= joinpath (Pkg . devdir (), " $( name) _jll " ),
590+ deploy_repo= " JuliaBinaryWrappers/$(namejll ( name)) .jl" ,
591+ code_dir= codedir ( name),
582592 gh_auth= Wizard. github_auth (;allow_anonymous= false ),
583593 gh_username= gh_get_json (DEFAULT_API, " /user" ; auth= gh_auth)[" login" ],
584594 augment_platform_block:: String = " " ,
@@ -615,12 +625,7 @@ function register_jll(name, build_version, dependencies, julia_compat;
615625 @error (reg_branch. metadata[" error" ])
616626 else
617627 upstream_registry_url = " https://github.com/JuliaRegistries/General"
618- name_jll = " $(name) _jll"
619- if _package_is_registered (upstream_registry_url, name_jll)
620- pr_title = " New version: $(name_jll) v$(build_version) "
621- else
622- pr_title = " New package: $(name_jll) v$(build_version) "
623- end
628+ pr_title = " New $(_package_is_registered (upstream_registry_url, namejll (name)) ? " version" : " package" ) : $(namejll (name)) v$(build_version) "
624629 # Open pull request against JuliaRegistries/General
625630 body = """
626631 Autogenerated JLL package registration
@@ -1132,7 +1137,7 @@ function rebuild_jll_package(obj::Dict;
11321137 end
11331138 if download_dir === nothing
11341139 download_dir = mktempdir ()
1135- repo = " $(gh_org) /$(obj[" name" ]) _jll .jl"
1140+ repo = " $(gh_org) /$(namejll ( obj[" name" ])) .jl"
11361141 tag = " $(obj[" name" ]) -v$(build_version) "
11371142 download_github_release (download_dir, repo, tag; verbose= verbose)
11381143 upload_prefix = " https://github.com/$(repo) /releases/download/$(tag) "
@@ -1188,7 +1193,7 @@ end
11881193function rebuild_jll_package (name:: String , build_version:: VersionNumber , sources:: Vector ,
11891194 platforms:: Vector , products:: Vector , dependencies:: Vector ,
11901195 download_dir:: String , upload_prefix:: String ;
1191- code_dir:: String = joinpath (Pkg . devdir (), " $( name) _jll " ),
1196+ code_dir:: String = codedir ( name),
11921197 verbose:: Bool = false , from_scratch:: Bool = true ,
11931198 kwargs... )
11941199 # We're going to recreate "build_output_meta"
@@ -1321,7 +1326,7 @@ function build_jll_package(src_name::String,
13211326
13221327 # Generate the platform-specific wrapper code
13231328 open (joinpath (code_dir, " src" , " wrappers" , " $(triplet (platform)) .jl" ), " w" ) do io
1324- println (io, " # Autogenerated wrapper script for $(src_name) _jll for $(triplet (platform)) " )
1329+ println (io, " # Autogenerated wrapper script for $(namejll ( src_name)) for $(triplet (platform)) " )
13251330 if ! isempty (products_info)
13261331 println (io, """
13271332 export $(join (sort (variable_name .(first .(collect (products_info)))), " , " ))
@@ -1564,10 +1569,10 @@ function build_jll_package(src_name::String,
15641569 end
15651570
15661571 # Generate target-demuxing main source file.
1567- open (joinpath (code_dir, " src" , " $(src_name) _jll .jl" ), " w" ) do io
1572+ open (joinpath (code_dir, " src" , " $(namejll ( src_name)) .jl" ), " w" ) do io
15681573 print (io, """
15691574 # Use baremodule to shave off a few KB from the serialized `.ji` file
1570- baremodule $(src_name) _jll
1575+ baremodule $(namejll ( src_name))
15711576 using Base
15721577 using Base: UUID
15731578 """ )
@@ -1591,8 +1596,8 @@ function build_jll_package(src_name::String,
15911596 import JLLWrappers
15921597
15931598 JLLWrappers.@generate_main_file_header($(repr (src_name)) )
1594- JLLWrappers.@generate_main_file($(repr (src_name)) , $(repr (jll_uuid (" $ (src_name)_jll " ))) )
1595- end # module $(src_name) _jll
1599+ JLLWrappers.@generate_main_file($(repr (src_name)) , $(repr (jll_uuid (namejll (src_name)))) )
1600+ end # module $(namejll ( src_name))
15961601 """ )
15971602 end
15981603
@@ -1621,10 +1626,10 @@ function build_jll_package(src_name::String,
16211626 open (joinpath (code_dir, " README.md" ), " w" ) do io
16221627 println (io,
16231628 """
1624- # `$(src_name) _jll .jl` (v$(build_version) )
1629+ # `$(namejll ( src_name)) .jl` (v$(build_version) )
16251630 """ )
16261631 if is_yggdrasil ()
1627- println (io, " [ _jll /deps.svg)](https://juliahub.com/ui/Packages/General/$(src_name) _jll /)\n " )
1632+ println (io, " [) /deps.svg)](https://juliahub.com/ui/Packages/General/$(namejll ( src_name)) /)\n " )
16281633 end
16291634 println (io, """
16301635 This is an autogenerated package constructed using [`BinaryBuilder.jl`](https://github.com/JuliaPackaging/BinaryBuilder.jl).
@@ -1648,15 +1653,15 @@ function build_jll_package(src_name::String,
16481653 println (io, """
16491654 ## Sources
16501655
1651- The tarballs for `$(src_name) _jll .jl` have been built from these sources:""" )
1656+ The tarballs for `$(namejll ( src_name)) .jl` have been built from these sources:""" )
16521657 println (io)
16531658 print_source .(Ref (io), sources)
16541659 println (io)
16551660 end
16561661 println (io, """
16571662 ## Platforms
16581663
1659- `$(src_name) _jll .jl` is available for the following platforms:
1664+ `$(namejll ( src_name)) .jl` is available for the following platforms:
16601665 """ )
16611666 for p in sort (collect (platforms), by = triplet)
16621667 println (io, " * `" , p, " ` (`" , triplet (p), " `)" )
@@ -1668,7 +1673,7 @@ function build_jll_package(src_name::String,
16681673 println (io, """
16691674 ## Dependencies
16701675
1671- The following JLL packages are required by `$(src_name) _jll .jl`:""" )
1676+ The following JLL packages are required by `$(namejll ( src_name)) .jl`:""" )
16721677 println (io)
16731678 print_jll .(Ref (io), sort (dependencies, by = getname))
16741679 end
@@ -1728,13 +1733,13 @@ function build_jll_package(src_name::String,
17281733end
17291734
17301735function push_jll_package (name, build_version;
1731- code_dir = joinpath (Pkg . devdir (), " $( name) _jll " ),
1732- deploy_repo = " JuliaBinaryWrappers/$(name) _jll .jl" ,
1736+ code_dir = codedir ( name),
1737+ deploy_repo = " JuliaBinaryWrappers/$(namejll ( name)) .jl" ,
17331738 gh_auth = Wizard. github_auth (;allow_anonymous= false ))
17341739 # Next, push up the wrapper code repository
17351740 wrapper_repo = LibGit2. GitRepo (code_dir)
17361741 LibGit2. add! (wrapper_repo, " ." )
1737- commit = LibGit2. commit (wrapper_repo, " $(name) _jll build $(build_version) " )
1742+ commit = LibGit2. commit (wrapper_repo, " $(namejll ( name)) build $(build_version) " )
17381743 Wizard. with_gitcreds (" x-access-token" , gh_auth. token) do creds
17391744 refspecs = [" refs/heads/main" ]
17401745 # Fetch the remote repository, to have the relevant refspecs up to date.
@@ -1764,7 +1769,7 @@ end
17641769const uuid_package = UUID (" cfb74b52-ec16-5bb7-a574-95d9e393895e" )
17651770# For even more interesting historical reasons, we append an extra
17661771# "_jll" to the name of the new package before computing its UUID.
1767- jll_uuid (name) = bb_specific_uuid5 (uuid_package, " $ (name)_jll " )
1772+ jll_uuid (name) = bb_specific_uuid5 (uuid_package, namejll (name))
17681773
17691774function find_uuid (ctx, pkg)
17701775 if Pkg. Types. has_uuid (pkg)
@@ -1799,8 +1804,8 @@ function build_project_dict(name, version, dependencies::Array{<:AbstractDepende
17991804
18001805 Pkg. Types. semver_spec (julia_compat) # verify julia_compat is valid
18011806 project = Dict (
1802- " name" => " $ (name)_jll " ,
1803- " uuid" => string (jll_uuid (" $ (name)_jll " )),
1807+ " name" => namejll (name),
1808+ " uuid" => string (jll_uuid (namejll (name))),
18041809 " version" => string (version),
18051810 " deps" => Dict {String,Any} (),
18061811 # We require at least Julia 1.3+, for Pkg.Artifacts support, but we only claim
0 commit comments