@@ -6,6 +6,8 @@ using RegistryTools, Registrator
6
6
import LibGit2
7
7
import PkgLicenses
8
8
9
+ const DEFAULT_JULIA_VERSION_SPEC = " 1.0"
10
+
9
11
const BUILD_HELP = (
10
12
"""
11
13
Usage: build_tarballs.jl [target1,target2,...] [--help]
@@ -85,6 +87,10 @@ see what it can do, you can call it with `--help` in the `ARGS` or see the
85
87
The `kwargs` are passed on to [`autobuild`](@ref), see there for a list of
86
88
supported ones. A few additional keyword arguments are accept:
87
89
90
+ * `julia_compat` can be set to a version string which is used to set the
91
+ supported Julia version in the `[compat]` section of the `Project.toml` of
92
+ the generated JLL package. The default value is `"1.0"`.
93
+
88
94
* `lazy_artifacts` sets whether the artifacts should be lazy.
89
95
90
96
* `init_block` may be set to a string containing Julia code; if present, this
@@ -224,7 +230,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
224
230
# Dependencies that must be downloaded
225
231
dependencies,
226
232
)
227
- extra_kwargs = extract_kwargs (kwargs, (:lazy_artifacts , :init_block ))
233
+ extra_kwargs = extract_kwargs (kwargs, (:julia_compat , : lazy_artifacts , :init_block ))
228
234
229
235
if meta_json_stream != = nothing
230
236
# If they've asked for the JSON metadata, by all means, give it to them!
@@ -272,7 +278,7 @@ function build_tarballs(ARGS, src_name, src_version, sources, script,
272
278
@info (" Registering new wrapper code version $(build_version) ..." )
273
279
end
274
280
275
- register_jll (src_name, build_version, dependencies;
281
+ register_jll (src_name, build_version, dependencies, julia_compat ;
276
282
deploy_repo= deploy_jll_repo, code_dir= code_dir)
277
283
end
278
284
end
@@ -427,7 +433,7 @@ function _package_is_registered(registry_url::AbstractString,
427
433
return package in registered_packages
428
434
end
429
435
430
- function register_jll (name, build_version, dependencies;
436
+ function register_jll (name, build_version, dependencies, julia_compat ;
431
437
deploy_repo= " JuliaBinaryWrappers/$(name) _jll.jl" ,
432
438
code_dir= joinpath (Pkg. devdir (), " $(name) _jll" ),
433
439
gh_auth= Wizard. github_auth (;allow_anonymous= false ),
@@ -443,7 +449,7 @@ function register_jll(name, build_version, dependencies;
443
449
cache = RegistryTools. RegistryCache (joinpath (Pkg. depots1 (), " registries_binarybuilder" ))
444
450
registry_url = " https://$(gh_username) :$(gh_auth. token) @github.com/JuliaRegistries/General"
445
451
cache. registries[registry_url] = Base. UUID (" 23338594-aafe-5451-b93e-139f81909106" )
446
- project = Pkg. Types. Project (build_project_dict (name, build_version, dependencies))
452
+ project = Pkg. Types. Project (build_project_dict (name, build_version, dependencies, julia_compat ))
447
453
errors = setdiff (RegistryTools. registrator_errors, [:version_less_than_all_existing ])
448
454
reg_branch = RegistryTools. register (
449
455
" https://github.com/$(deploy_repo) .git" ,
@@ -490,6 +496,7 @@ function get_meta_json(
490
496
platforms:: Vector ,
491
497
products:: Vector{<:Product} ,
492
498
dependencies:: Vector{<:AbstractDependency} ;
499
+ julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC,
493
500
lazy_artifacts:: Bool = false ,
494
501
init_block:: String = " " )
495
502
@@ -500,6 +507,7 @@ function get_meta_json(
500
507
" script" => script,
501
508
" products" => products,
502
509
" dependencies" => dependencies,
510
+ " julia_compat" => julia_compat,
503
511
" lazy_artifacts" => lazy_artifacts,
504
512
" init_block" => init_block,
505
513
)
@@ -926,6 +934,7 @@ function rebuild_jll_package(obj::Dict;
926
934
upload_prefix;
927
935
verbose= verbose,
928
936
lazy_artifacts = lazy_artifacts,
937
+ julia_compat = get (obj, " julia_compat" , DEFAULT_JULIA_VERSION_SPEC),
929
938
init_block = get (obj, " init_block" , " " ),
930
939
from_scratch = from_scratch,
931
940
)
@@ -935,8 +944,8 @@ function rebuild_jll_package(name::String, build_version::VersionNumber, sources
935
944
platforms:: Vector , products:: Vector , dependencies:: Vector ,
936
945
download_dir:: String , upload_prefix:: String ;
937
946
code_dir:: String = joinpath (Pkg. devdir (), " $(name) _jll" ),
938
- verbose:: Bool = false , lazy_artifacts :: Bool = false ,
939
- init_block :: String = " " , from_scratch :: Bool = true )
947
+ verbose:: Bool = false , from_scratch :: Bool = true ,
948
+ kwargs ... )
940
949
# We're going to recreate "build_output_meta"
941
950
build_output_meta = Dict ()
942
951
@@ -999,7 +1008,7 @@ function rebuild_jll_package(name::String, build_version::VersionNumber, sources
999
1008
# Finally, generate the full JLL package
1000
1009
build_jll_package (name, build_version, sources, code_dir, build_output_meta,
1001
1010
dependencies, upload_prefix; verbose= verbose,
1002
- lazy_artifacts = lazy_artifacts, init_block = init_block )
1011
+ kwargs ... )
1003
1012
end
1004
1013
end
1005
1014
@@ -1011,6 +1020,7 @@ function build_jll_package(src_name::String,
1011
1020
dependencies:: Vector ,
1012
1021
bin_path:: String ;
1013
1022
verbose:: Bool = false ,
1023
+ julia_compat:: String = DEFAULT_JULIA_VERSION_SPEC,
1014
1024
lazy_artifacts:: Bool = false ,
1015
1025
init_block = " " )
1016
1026
if ! Base. isidentifier (src_name)
@@ -1444,7 +1454,7 @@ function build_jll_package(src_name::String,
1444
1454
rm (joinpath (code_dir, " LICENSE.md" ); force= true )
1445
1455
1446
1456
# Add a Project.toml
1447
- project = build_project_dict (src_name, build_version, dependencies)
1457
+ project = build_project_dict (src_name, build_version, dependencies, julia_compat )
1448
1458
open (joinpath (code_dir, " Project.toml" ), " w" ) do io
1449
1459
Pkg. TOML. print (io, project)
1450
1460
end
@@ -1486,7 +1496,7 @@ const uuid_package = UUID("cfb74b52-ec16-5bb7-a574-95d9e393895e")
1486
1496
# For even more interesting historical reasons, we append an extra
1487
1497
# "_jll" to the name of the new package before computing its UUID.
1488
1498
jll_uuid (name) = bb_specific_uuid5 (uuid_package, " $(name) _jll" )
1489
- function build_project_dict (name, version, dependencies:: Array{Dependency} )
1499
+ function build_project_dict (name, version, dependencies:: Array{Dependency} , julia_compat :: String = DEFAULT_JULIA_VERSION_SPEC )
1490
1500
function has_compat_info (d:: Dependency )
1491
1501
r = Pkg. Types. VersionRange ()
1492
1502
return isa (d. pkg. version, VersionNumber) ||
@@ -1504,14 +1514,15 @@ function build_project_dict(name, version, dependencies::Array{Dependency})
1504
1514
return string (v)
1505
1515
end
1506
1516
exactly_this_version (v) = v
1517
+ Pkg. Types. semver_spec (julia_compat) # verify julia_compat is valid
1507
1518
project = Dict (
1508
1519
" name" => " $(name) _jll" ,
1509
1520
" uuid" => string (jll_uuid (" $(name) _jll" )),
1510
1521
" version" => string (version),
1511
1522
" deps" => Dict {String,Any} (),
1512
1523
# We require at least Julia 1.3+, for Pkg.Artifacts support, but we only claim
1513
- # Julia 1.0+ so that empty JLLs can be installed on older versions.
1514
- " compat" => Dict {String,Any} (" julia" => " 1.0 " )
1524
+ # Julia 1.0+ by default so that empty JLLs can be installed on older versions.
1525
+ " compat" => Dict {String,Any} (" julia" => " $(julia_compat) " )
1515
1526
)
1516
1527
for dep in dependencies
1517
1528
depname = getname (dep)
0 commit comments