Skip to content

Commit 24a227b

Browse files
authored
Prevent stdlib compat entries from breaking old Julia versions (#1324)
* Prevent stdlib compat entries from breaking old Julia versions * Update AutoBuild.jl * Fix tests * Fix tests * Fix tests
1 parent 89ac877 commit 24a227b

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

src/AutoBuild.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,8 +1663,10 @@ function build_project_dict(name, version, dependencies::Array{<:AbstractDepende
16631663
"JLLWrappers" => "$(jllwrappers_compat)",
16641664
"julia" => "$(julia_compat)",
16651665
# Stdlibs always used, we need to have compat bounds also for them.
1666-
"Libdl" => "1",
1667-
"Artifacts" => "1",
1666+
# The "< 0.0.1" trick is needed to prevent `Pkg.test` from breaking
1667+
# on older Julia versions.
1668+
"Libdl" => "< 0.0.1, 1",
1669+
"Artifacts" => "< 0.0.1, 1",
16681670
)
16691671
)
16701672

@@ -1689,15 +1691,15 @@ function build_project_dict(name, version, dependencies::Array{<:AbstractDepende
16891691
if minimum_compat(julia_compat) < v"1.6"
16901692
# `Pkg` is used in JLLWrappers only when we require Julia v1.5-.
16911693
project["deps"]["Pkg"] = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
1692-
project["compat"]["Pkg"] = "1"
1694+
project["compat"]["Pkg"] = "< 0.0.1, 1"
16931695
end
16941696
if lazy_artifacts
16951697
project["deps"]["LazyArtifacts"] = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
1696-
project["compat"]["LazyArtifacts"] = "1"
1698+
project["compat"]["LazyArtifacts"] = "< 0.0.1, 1"
16971699
end
16981700
if !isempty(augment_platform_block)
16991701
project["deps"]["TOML"] = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
1700-
project["compat"]["TOML"] = "1"
1702+
project["compat"]["TOML"] = "< 0.0.1, 1"
17011703
end
17021704

17031705
return project

test/basic.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ end
199199
@test dict["name"] == "$(name)_jll"
200200
@test dict["version"] == "1.0.0"
201201
@test dict["uuid"] == "8fcd9439-76b0-55f4-a525-bad0597c05d8"
202-
@test dict["compat"] == Dict{String,Any}("julia" => "1.0", "JLLWrappers" => "1.2.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
202+
@test dict["compat"] == Dict{String,Any}("julia" => "1.0", "JLLWrappers" => "1.2.0", "Pkg" => "< 0.0.1, 1", "Libdl" => "< 0.0.1, 1", "Artifacts" => "< 0.0.1, 1")
203203
@test all(in.(
204204
(
205205
"Pkg" => "44cfe95a-1eb2-52ea-b672-e2afdf69b78f",
@@ -224,16 +224,16 @@ end
224224

225225
# Ensure passing a Julia dependency bound works
226226
dict = build_project_dict(name, version, dependencies, "1.4")
227-
@test dict["compat"] == Dict{String,Any}("julia" => "1.4", "JLLWrappers" => "1.2.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
227+
@test dict["compat"] == Dict{String,Any}("julia" => "1.4", "JLLWrappers" => "1.2.0", "Pkg" => "< 0.0.1, 1", "Libdl" => "< 0.0.1, 1", "Artifacts" => "< 0.0.1, 1")
228228

229229
dict = build_project_dict(name, version, dependencies, "~1.4")
230-
@test dict["compat"] == Dict{String,Any}("julia" => "~1.4", "JLLWrappers" => "1.2.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
230+
@test dict["compat"] == Dict{String,Any}("julia" => "~1.4", "JLLWrappers" => "1.2.0", "Pkg" => "< 0.0.1, 1", "Libdl" => "< 0.0.1, 1", "Artifacts" => "< 0.0.1, 1")
231231

232232
@test_throws ErrorException build_project_dict(name, version, dependencies, "nonsense")
233233

234234
# Ensure passing a JLLWrappers dependency bound works
235235
dict = build_project_dict(name, version, dependencies; jllwrappers_compat="1.4.0")
236-
@test dict["compat"] == Dict{String,Any}("julia" => "1.0", "JLLWrappers" => "1.4.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
236+
@test dict["compat"] == Dict{String,Any}("julia" => "1.0", "JLLWrappers" => "1.4.0", "Pkg" => "< 0.0.1, 1", "Libdl" => "< 0.0.1, 1", "Artifacts" => "< 0.0.1, 1")
237237

238238
# Ensure passing compat bounds works
239239
dependencies = [

test/jll.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ module TestJLL end
2929
"julia" => "1.0",
3030
"XZ_jll" => "=2.4.6",
3131
"JLLWrappers" => "1.2.0",
32-
"Libdl" => "1",
33-
"Artifacts" => "1",
34-
"Pkg" => "1",
32+
"Libdl" => "< 0.0.1, 1",
33+
"Artifacts" => "< 0.0.1, 1",
34+
"Pkg" => "< 0.0.1, 1",
3535
)
3636
@test project["version"] == "1.3.5"
3737
# Make sure BuildDependency's don't find their way to the project

0 commit comments

Comments
 (0)