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

Fix shards regression #487

Merged
merged 3 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Clang"
uuid = "40e3b903-d033-50b4-a0cc-940c62c95e31"
version = "0.18.2"
version = "0.18.3"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
2 changes: 1 addition & 1 deletion src/platform/env.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const JLL_ENV_TRIPLES = String[
"x86_64-apple-darwin14",
"x86_64-linux-gnu",
"x86_64-linux-musl",
"x86_64-unknown-freebsd",
"x86_64-unknown-freebsd13.2",
"x86_64-w64-mingw32",
]

Expand Down
14 changes: 8 additions & 6 deletions src/platform/target.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@ const JLL_ENV_CLANG_TARGETS_MAPPING = Dict(
"x86_64-apple-darwin14"=>"x86_64-apple-darwin14",
"x86_64-linux-gnu"=>"x86_64-unknown-linux-gnu",
"x86_64-linux-musl"=>"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd"=>"x86_64-unknown-freebsd13.2",
"x86_64-unknown-freebsd13.2"=>"x86_64-unknown-freebsd13.2",
"x86_64-w64-mingw32"=>"x86_64-w64-windows-gnu",
)

triple2target(triple::String) = get(JLL_ENV_CLANG_TARGETS_MAPPING, triple, "unknown")

function __triplet(p::Platform)
for k in keys(p.tags)
if k != "arch" && k != "os" && k != "libc"
if k != "arch" && k != "os" && k != "libc" && k != "call_abi" && k != "os_version"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call_abi is needed for armv7l, os_version is needed for freebsd and sometimes darwin

delete!(p.tags, k)
end
end
t = triplet(p)
if os(p) == "macos" && arch(p) == "x86_64"
t *= "14"
elseif os(p) == "macos" && arch(p) == "aarch64"
t *= "20"
if os_version(p) === nothing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why the user wouldn't specify the version, but here I am just maintaining backward compatibility if they didn't.

if os(p) == "macos" && arch(p) == "x86_64"
t *= "14"
elseif os(p) == "macos" && arch(p) == "aarch64"
t *= "20"
end
end
return t
end
Expand Down
9 changes: 9 additions & 0 deletions test/jllenvs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@testset "get_default_args for all triples" begin
# just testing this does not crash on any default triple
Clang.get_default_args.(Clang.JLLEnvs.JLL_ENV_TRIPLES)
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test downloads artifacts for all platforms. running it every time is a bit overkill.

is there a way to somehow cache it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe we can control it by env variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i didn't realize it did that, i've simplified the test


@testset "darwin __triplet backwards compatibility" begin
@test Clang.JLLEnvs.__triplet(parse(Clang.JLLEnvs.Platform, "aarch64-apple-darwin")) == "aarch64-apple-darwin20"
@test Clang.JLLEnvs.__triplet(parse(Clang.JLLEnvs.Platform, "aarch64-apple-darwin20")) == "aarch64-apple-darwin20"
end
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using Test
# https://github.com/JuliaLang/julia/issues/52986
using REPL

include("jllenvs.jl")
include("file.jl")
include("generators.jl")

Expand Down
Loading