Skip to content

deprecate if-available value of download-ci-llvm #117813

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

Merged
merged 1 commit into from
Nov 19, 2023
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
15 changes: 6 additions & 9 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,15 @@ change-id = 116881
# Unless you're developing for a target where Rust CI doesn't build a compiler
# toolchain or changing LLVM locally, you probably want to leave this enabled.
#
# Set this to `"if-available"` if you are not sure whether you're on a tier 1
# target. All tier 1 targets are currently supported;
#
# We also currently only support this when building LLVM for the build triple.
#
# Set this to `"if-unchanged"` to only download if the llvm-project have not
# been modified. (If there are no changes or if built from tarball source,
# the logic is the same as "if-available")
# Set this to `"if-unchanged"` to download only if the llvm-project has not
# been modified. You can also use this if you are unsure whether you're on a
# tier 1 target. All tier 1 targets are currently supported.

# Currently, we only support this when building LLVM for the build triple.
#
# Note that many of the LLVM options are not currently supported for
# downloading. Currently only the "assertions" option can be toggled.
#download-ci-llvm = if rust.channel == "dev" { "if-available" } else { false }
#download-ci-llvm = if rust.channel == "dev" { "if-unchanged" } else { false }

# Indicates whether the LLVM build is a Release or Debug build
#optimize = true
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/defaults/config.compiler.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ lto = "off"

[llvm]
# Will download LLVM from CI if available on your platform.
download-ci-llvm = "if-available"
download-ci-llvm = "if-unchanged"
2 changes: 1 addition & 1 deletion src/bootstrap/defaults/config.library.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ lto = "off"

[llvm]
# Will download LLVM from CI if available on your platform.
download-ci-llvm = "if-available"
download-ci-llvm = "if-unchanged"
2 changes: 1 addition & 1 deletion src/bootstrap/defaults/config.tools.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ compiler-docs = true

[llvm]
# Will download LLVM from CI if available on your platform.
download-ci-llvm = "if-available"
download-ci-llvm = "if-unchanged"
2 changes: 2 additions & 0 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,8 @@ impl Config {
match download_ci_llvm {
None => self.channel == "dev" && llvm::is_ci_llvm_available(&self, asserts),
Some(StringOrBool::Bool(b)) => b,
// FIXME: "if-available" is deprecated. Remove this block later (around mid 2024)
// to not break builds between the recent-to-old checkouts.
Some(StringOrBool::String(s)) if s == "if-available" => {
Copy link
Member

Choose a reason for hiding this comment

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

This needs a transition period, otherwise switching between branches before this and after this will be painful (since config.toml can't be compatible with both).

Copy link
Member

Choose a reason for hiding this comment

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

if you just set it to if-unchanged, it should work just fine

llvm::is_ci_llvm_available(&self, asserts)
}
Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/src/tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ fn download_ci_llvm() {
}

let parse_llvm = |s| parse(s).llvm_from_ci;
let if_available = parse_llvm("llvm.download-ci-llvm = \"if-available\"");
let if_unchanged = parse_llvm("llvm.download-ci-llvm = \"if-unchanged\"");

assert!(parse_llvm("llvm.download-ci-llvm = true"));
assert!(!parse_llvm("llvm.download-ci-llvm = false"));
assert_eq!(parse_llvm(""), if_available);
assert_eq!(parse_llvm("rust.channel = \"dev\""), if_available);
assert_eq!(parse_llvm(""), if_unchanged);
assert_eq!(parse_llvm("rust.channel = \"dev\""), if_unchanged);
assert!(!parse_llvm("rust.channel = \"stable\""));
assert!(parse_llvm("build.build = \"x86_64-unknown-linux-gnu\""));
assert!(parse_llvm(
"llvm.assertions = true \r\n build.build = \"x86_64-unknown-linux-gnu\" \r\n llvm.download-ci-llvm = \"if-available\""
"llvm.assertions = true \r\n build.build = \"x86_64-unknown-linux-gnu\" \r\n llvm.download-ci-llvm = \"if-unchanged\""
));
assert!(!parse_llvm(
"llvm.assertions = true \r\n build.build = \"aarch64-apple-darwin\" \r\n llvm.download-ci-llvm = \"if-available\""
"llvm.assertions = true \r\n build.build = \"aarch64-apple-darwin\" \r\n llvm.download-ci-llvm = \"if-unchanged\""
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ else
# LLVM continuously on at least some builders to ensure it works, though.
# (And PGO is its own can of worms).
if [ "$NO_DOWNLOAD_CI_LLVM" = "" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.download-ci-llvm=if-available"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --set llvm.download-ci-llvm=if-unchanged"
else
# When building for CI we want to use the static C++ Standard library
# included with LLVM, since a dynamic libstdcpp may not be available.
Expand Down
2 changes: 1 addition & 1 deletion src/ci/scripts/install-clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then
"${RUST_CONFIGURE_ARGS} --set llvm.clang-cl=$(pwd)/clang-rust/bin/clang-cl.exe"

# Disable downloading CI LLVM on this builder;
# setting up clang-cl just above conflicts with the default if-available option.
# setting up clang-cl just above conflicts with the default if-unchanged option.
ciCommandSetEnv NO_DOWNLOAD_CI_LLVM 1
fi

Expand Down