Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent stdlib compat entries from breaking old Julia versions #1324

Merged
merged 6 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/AutoBuild.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1663,8 +1663,10 @@ function build_project_dict(name, version, dependencies::Array{<:AbstractDepende
"JLLWrappers" => "$(jllwrappers_compat)",
"julia" => "$(julia_compat)",
# Stdlibs always used, we need to have compat bounds also for them.
"Libdl" => "1",
"Artifacts" => "1",
# The "< 0.0.1" trick is needed to prevent `Pkg.test` from breaking
# on older Julia versions.
"Libdl" => "< 0.0.1, 1",
"Artifacts" => "< 0.0.1, 1",
)
)

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

return project
Expand Down
8 changes: 4 additions & 4 deletions test/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ end
@test dict["name"] == "$(name)_jll"
@test dict["version"] == "1.0.0"
@test dict["uuid"] == "8fcd9439-76b0-55f4-a525-bad0597c05d8"
@test dict["compat"] == Dict{String,Any}("julia" => "1.0", "JLLWrappers" => "1.2.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
@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")
@test all(in.(
(
"Pkg" => "44cfe95a-1eb2-52ea-b672-e2afdf69b78f",
Expand All @@ -224,16 +224,16 @@ end

# Ensure passing a Julia dependency bound works
dict = build_project_dict(name, version, dependencies, "1.4")
@test dict["compat"] == Dict{String,Any}("julia" => "1.4", "JLLWrappers" => "1.2.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
@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")

dict = build_project_dict(name, version, dependencies, "~1.4")
@test dict["compat"] == Dict{String,Any}("julia" => "~1.4", "JLLWrappers" => "1.2.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
@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")

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

# Ensure passing a JLLWrappers dependency bound works
dict = build_project_dict(name, version, dependencies; jllwrappers_compat="1.4.0")
@test dict["compat"] == Dict{String,Any}("julia" => "1.0", "JLLWrappers" => "1.4.0", "Pkg" => "1", "Libdl" => "1", "Artifacts" => "1")
@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")

# Ensure passing compat bounds works
dependencies = [
Expand Down
6 changes: 3 additions & 3 deletions test/jll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ module TestJLL end
"julia" => "1.0",
"XZ_jll" => "=2.4.6",
"JLLWrappers" => "1.2.0",
"Libdl" => "1",
"Artifacts" => "1",
"Pkg" => "1",
"Libdl" => "< 0.0.1, 1",
"Artifacts" => "< 0.0.1, 1",
"Pkg" => "< 0.0.1, 1",
)
@test project["version"] == "1.3.5"
# Make sure BuildDependency's don't find their way to the project
Expand Down
Loading