Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@
# What custom diff tool to use for displaying compiletest tests.
#compiletest-diff-tool = <none>

# Indicates whether ccache is used when building certain artifacts (e.g. LLVM).
# Set to `true` to use the first `ccache` in PATH, or set an absolute path to use
# a specific version.
#ccache = false

# =============================================================================
# General install configuration options
# =============================================================================
Expand Down
12 changes: 8 additions & 4 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ def v(*args):
o("verbose-tests", "rust.verbose-tests", "enable verbose output when running tests")
o(
"ccache",
"llvm.ccache",
"invoke gcc/clang via ccache to reuse object files between builds",
"build.ccache",
"invoke gcc/clang/rustc via ccache to reuse object files between builds",
)
o(
"sccache",
None,
"invoke gcc/clang/rustc via sccache to reuse object files between builds",
)
o("sccache", None, "invoke gcc/clang via sccache to reuse object files between builds")
o("local-rust", None, "use an installed rustc rather than downloading a snapshot")
v("local-rust-root", None, "set prefix for local rust binary")
o(
Expand Down Expand Up @@ -510,7 +514,7 @@ def apply_args(known_args, option_checking, config):
build_triple = build(known_args)

if option.name == "sccache":
set("llvm.ccache", "sccache", config)
set("build.ccache", "sccache", config)
elif option.name == "local-rust":
for path in os.environ["PATH"].split(os.pathsep):
if os.path.exists(path + "/rustc"):
Expand Down
20 changes: 12 additions & 8 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ define_config! {
optimized_compiler_builtins: Option<bool> = "optimized-compiler-builtins",
jobs: Option<u32> = "jobs",
compiletest_diff_tool: Option<String> = "compiletest-diff-tool",
ccache: Option<StringOrBool> = "ccache",
}
}

Expand Down Expand Up @@ -1622,6 +1623,7 @@ impl Config {
optimized_compiler_builtins,
jobs,
compiletest_diff_tool,
mut ccache,
} = toml.build.unwrap_or_default();

config.jobs = Some(threads_from_config(flags.jobs.unwrap_or(jobs.unwrap_or(0))));
Expand Down Expand Up @@ -2006,7 +2008,7 @@ impl Config {
tests,
enzyme,
plugins,
ccache,
ccache: llvm_ccache,
static_libstdcpp,
libzstd,
ninja,
Expand All @@ -2029,13 +2031,7 @@ impl Config {
download_ci_llvm,
build_config,
} = llvm;
match ccache {
Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()),
Some(StringOrBool::Bool(true)) => {
config.ccache = Some("ccache".to_string());
}
Some(StringOrBool::Bool(false)) | None => {}
}
ccache = ccache.or(llvm_ccache);
set(&mut config.ninja_in_file, ninja);
llvm_tests = tests;
llvm_enzyme = enzyme;
Expand Down Expand Up @@ -2189,6 +2185,14 @@ impl Config {
}
}

match ccache {
Some(StringOrBool::String(ref s)) => config.ccache = Some(s.to_string()),
Some(StringOrBool::Bool(true)) => {
config.ccache = Some("ccache".to_string());
}
Some(StringOrBool::Bool(false)) | None => {}
}

if config.llvm_from_ci {
let triple = &config.build.triple;
let ci_llvm_bin = config.ci_llvm_root().join("bin");
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/src/utils/change_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,4 +345,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
severity: ChangeSeverity::Info,
summary: "Rustdoc now respects the value of rust.lto.",
},
ChangeInfo {
change_id: 136941,
severity: ChangeSeverity::Info,
summary: "The llvm.ccache option has moved to build.ccache. llvm.ccache is now deprecated.",
},
];
Loading