1
- export build_tarballs, autobuild, print_artifacts_toml, build, get_meta_json
1
+ export build_tarballs, autobuild, build, get_meta_json
2
2
import GitHub: gh_get_json, DEFAULT_API
3
3
import SHA: sha256, sha1
4
4
using TOML, Dates, UUIDs
@@ -43,6 +43,11 @@ function Base.show(io::IO, t::BuildTimer)
43
43
end
44
44
end
45
45
46
+ const devdir = Ref (Pkg. devdir ())
47
+
48
+ namejll (name:: AbstractString ) = name * " _jll"
49
+ codedir (name:: AbstractString ) = joinpath (devdir[], namejll (name))
50
+
46
51
exclude_logs (_, f) = f != " logs"
47
52
only_logs (_, f) = f == " logs"
48
53
@@ -233,9 +238,9 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
233
238
meta_json, meta_json_file = extract_flag! (ARGS , " --meta-json" )
234
239
235
240
# 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" )
239
244
240
245
# Resolve deploy settings
241
246
if deploy
@@ -266,7 +271,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
266
271
skip_build = check_flag! (ARGS , " --skip-build" )
267
272
268
273
if deploy_bin || deploy_jll
269
- code_dir = joinpath (Pkg . devdir (), " $( src_name) _jll " )
274
+ code_dir = codedir ( src_name)
270
275
271
276
# Shove them into `kwargs` so that we are conditionally passing them along
272
277
kwargs = (; kwargs... , code_dir = code_dir)
@@ -378,16 +383,22 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
378
383
)
379
384
end
380
385
386
+ products_dir = joinpath (pwd (), " products" )
381
387
if deploy_jll
382
388
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) ..." )
384
390
end
385
391
386
392
# For deploy keep only runtime dependencies.
387
393
dependencies = [dep for dep in dependencies if is_runtime_dependency (dep)]
388
394
395
+
389
396
# 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
391
402
392
403
if ! skip_build
393
404
# Build JLL package based on output of autobuild
@@ -396,7 +407,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
396
407
else
397
408
# Rebuild output meta data from the information we have here
398
409
rebuild_jll_package (src_name, build_version, sources, platforms, products, dependencies,
399
- joinpath ( pwd (), " products " ) , bin_path;
410
+ products_dir , bin_path;
400
411
code_dir, verbose, from_scratch= false ,
401
412
julia_compat, extra_kwargs... )
402
413
end
@@ -418,7 +429,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
418
429
if verbose
419
430
@info (" Deploying binaries to release $(tag) on $(deploy_bin_repo) via `ghr`..." )
420
431
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)
422
433
end
423
434
424
435
return build_output_meta
@@ -518,12 +529,11 @@ function get_next_wrapper_version(src_name::AbstractString, src_version::Version
518
529
# Force-update the registry here, since we may have pushed a new version recently
519
530
update_registry (devnull )
520
531
521
- jll_name = " $(src_name) _jll"
522
- uuid = jll_uuid (jll_name)
532
+ uuid = jll_uuid (namejll (src_name))
523
533
524
534
# If it does, we need to bump the build number up to the next value
525
535
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) )
527
537
# Collect all version numbers of the package across all registries.
528
538
versions = VersionNumber[]
529
539
for reg in ctx. registries
@@ -577,8 +587,8 @@ is_yggdrasil() = get(ENV, "YGGDRASIL", "false") == "true"
577
587
yggdrasil_head () = get (ENV , " BUILDKITE_COMMIT" , " " )
578
588
579
589
function 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),
582
592
gh_auth= Wizard. github_auth (;allow_anonymous= false ),
583
593
gh_username= gh_get_json (DEFAULT_API, " /user" ; auth= gh_auth)[" login" ],
584
594
augment_platform_block:: String = " " ,
@@ -615,12 +625,7 @@ function register_jll(name, build_version, dependencies, julia_compat;
615
625
@error (reg_branch. metadata[" error" ])
616
626
else
617
627
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) "
624
629
# Open pull request against JuliaRegistries/General
625
630
body = """
626
631
Autogenerated JLL package registration
@@ -1132,7 +1137,7 @@ function rebuild_jll_package(obj::Dict;
1132
1137
end
1133
1138
if download_dir === nothing
1134
1139
download_dir = mktempdir ()
1135
- repo = " $(gh_org) /$(obj[" name" ]) _jll .jl"
1140
+ repo = " $(gh_org) /$(namejll ( obj[" name" ])) .jl"
1136
1141
tag = " $(obj[" name" ]) -v$(build_version) "
1137
1142
download_github_release (download_dir, repo, tag; verbose= verbose)
1138
1143
upload_prefix = " https://github.com/$(repo) /releases/download/$(tag) "
@@ -1188,7 +1193,7 @@ end
1188
1193
function rebuild_jll_package (name:: String , build_version:: VersionNumber , sources:: Vector ,
1189
1194
platforms:: Vector , products:: Vector , dependencies:: Vector ,
1190
1195
download_dir:: String , upload_prefix:: String ;
1191
- code_dir:: String = joinpath (Pkg . devdir (), " $( name) _jll " ),
1196
+ code_dir:: String = codedir ( name),
1192
1197
verbose:: Bool = false , from_scratch:: Bool = true ,
1193
1198
kwargs... )
1194
1199
# We're going to recreate "build_output_meta"
@@ -1321,7 +1326,7 @@ function build_jll_package(src_name::String,
1321
1326
1322
1327
# Generate the platform-specific wrapper code
1323
1328
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)) " )
1325
1330
if ! isempty (products_info)
1326
1331
println (io, """
1327
1332
export $(join (sort (variable_name .(first .(collect (products_info)))), " , " ))
@@ -1564,10 +1569,10 @@ function build_jll_package(src_name::String,
1564
1569
end
1565
1570
1566
1571
# 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
1568
1573
print (io, """
1569
1574
# Use baremodule to shave off a few KB from the serialized `.ji` file
1570
- baremodule $(src_name) _jll
1575
+ baremodule $(namejll ( src_name))
1571
1576
using Base
1572
1577
using Base: UUID
1573
1578
""" )
@@ -1591,8 +1596,8 @@ function build_jll_package(src_name::String,
1591
1596
import JLLWrappers
1592
1597
1593
1598
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))
1596
1601
""" )
1597
1602
end
1598
1603
@@ -1621,10 +1626,10 @@ function build_jll_package(src_name::String,
1621
1626
open (joinpath (code_dir, " README.md" ), " w" ) do io
1622
1627
println (io,
1623
1628
"""
1624
- # `$(src_name) _jll .jl` (v$(build_version) )
1629
+ # `$(namejll ( src_name)) .jl` (v$(build_version) )
1625
1630
""" )
1626
1631
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 " )
1628
1633
end
1629
1634
println (io, """
1630
1635
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,
1648
1653
println (io, """
1649
1654
## Sources
1650
1655
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:""" )
1652
1657
println (io)
1653
1658
print_source .(Ref (io), sources)
1654
1659
println (io)
1655
1660
end
1656
1661
println (io, """
1657
1662
## Platforms
1658
1663
1659
- `$(src_name) _jll .jl` is available for the following platforms:
1664
+ `$(namejll ( src_name)) .jl` is available for the following platforms:
1660
1665
""" )
1661
1666
for p in sort (collect (platforms), by = triplet)
1662
1667
println (io, " * `" , p, " ` (`" , triplet (p), " `)" )
@@ -1668,7 +1673,7 @@ function build_jll_package(src_name::String,
1668
1673
println (io, """
1669
1674
## Dependencies
1670
1675
1671
- The following JLL packages are required by `$(src_name) _jll .jl`:""" )
1676
+ The following JLL packages are required by `$(namejll ( src_name)) .jl`:""" )
1672
1677
println (io)
1673
1678
print_jll .(Ref (io), sort (dependencies, by = getname))
1674
1679
end
@@ -1728,13 +1733,13 @@ function build_jll_package(src_name::String,
1728
1733
end
1729
1734
1730
1735
function 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" ,
1733
1738
gh_auth = Wizard. github_auth (;allow_anonymous= false ))
1734
1739
# Next, push up the wrapper code repository
1735
1740
wrapper_repo = LibGit2. GitRepo (code_dir)
1736
1741
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) " )
1738
1743
Wizard. with_gitcreds (" x-access-token" , gh_auth. token) do creds
1739
1744
refspecs = [" refs/heads/main" ]
1740
1745
# Fetch the remote repository, to have the relevant refspecs up to date.
@@ -1764,7 +1769,7 @@ end
1764
1769
const uuid_package = UUID (" cfb74b52-ec16-5bb7-a574-95d9e393895e" )
1765
1770
# For even more interesting historical reasons, we append an extra
1766
1771
# "_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))
1768
1773
1769
1774
function find_uuid (ctx, pkg)
1770
1775
if Pkg. Types. has_uuid (pkg)
@@ -1799,8 +1804,8 @@ function build_project_dict(name, version, dependencies::Array{<:AbstractDepende
1799
1804
1800
1805
Pkg. Types. semver_spec (julia_compat) # verify julia_compat is valid
1801
1806
project = Dict (
1802
- " name" => " $ (name)_jll " ,
1803
- " uuid" => string (jll_uuid (" $ (name)_jll " )),
1807
+ " name" => namejll (name),
1808
+ " uuid" => string (jll_uuid (namejll (name))),
1804
1809
" version" => string (version),
1805
1810
" deps" => Dict {String,Any} (),
1806
1811
# We require at least Julia 1.3+, for Pkg.Artifacts support, but we only claim
0 commit comments