diff options
| author | onur-ozkan <work@onurozkan.dev> | 2025-01-12 08:20:42 +0300 |
|---|---|---|
| committer | onur-ozkan <work@onurozkan.dev> | 2025-01-12 08:43:48 +0300 |
| commit | dcc001adbbfd9378d08593ab2f4b3ce780308ad8 (patch) | |
| tree | 4bd34c1e5d91c67fb8c511a793c500cb01f1d494 | |
| parent | 99322a5158e274decf1552b3abc041b3abbacbd2 (diff) | |
| download | rust-dcc001adbbfd9378d08593ab2f4b3ce780308ad8.tar.gz rust-dcc001adbbfd9378d08593ab2f4b3ce780308ad8.zip | |
refactor `with_stamp` as `add_stamp` for incrementality
Signed-off-by: onur-ozkan <work@onurozkan.dev>
| -rw-r--r-- | src/bootstrap/src/core/build_steps/format.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/gcc.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/llvm.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/src/core/download.rs | 8 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/build_stamp.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/build_stamp/tests.rs | 4 |
6 files changed, 13 insertions, 14 deletions
diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs index 253a33183bf..5556e5e631b 100644 --- a/src/bootstrap/src/core/build_steps/format.rs +++ b/src/bootstrap/src/core/build_steps/format.rs @@ -74,7 +74,7 @@ fn verify_rustfmt_version(build: &Builder<'_>) -> bool { let Some((version, stamp_file)) = get_rustfmt_version(build) else { return false; }; - stamp_file.with_stamp(version).is_up_to_date() + stamp_file.add_stamp(version).is_up_to_date() } /// Updates the last rustfmt version used. diff --git a/src/bootstrap/src/core/build_steps/gcc.rs b/src/bootstrap/src/core/build_steps/gcc.rs index f55a17aab04..d090644c5b7 100644 --- a/src/bootstrap/src/core/build_steps/gcc.rs +++ b/src/bootstrap/src/core/build_steps/gcc.rs @@ -55,7 +55,7 @@ pub fn prebuilt_gcc_config(builder: &Builder<'_>, target: TargetSelection) -> Gc ) }); - let stamp = BuildStamp::new(&out_dir).with_prefix("gcc").with_stamp(smart_stamp_hash); + let stamp = BuildStamp::new(&out_dir).with_prefix("gcc").add_stamp(smart_stamp_hash); if stamp.is_up_to_date() { if stamp.stamp.is_empty() { diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 51df2eba6e9..a70dc85aab4 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -135,7 +135,7 @@ pub fn prebuilt_llvm_config( ) }); - let stamp = BuildStamp::new(&out_dir).with_prefix("llvm").with_stamp(smart_stamp_hash); + let stamp = BuildStamp::new(&out_dir).with_prefix("llvm").add_stamp(smart_stamp_hash); if stamp.is_up_to_date() { if stamp.stamp.is_empty() { @@ -921,7 +921,7 @@ impl Step for Enzyme { }); let out_dir = builder.enzyme_out(target); - let stamp = BuildStamp::new(&out_dir).with_prefix("enzyme").with_stamp(smart_stamp_hash); + let stamp = BuildStamp::new(&out_dir).with_prefix("enzyme").add_stamp(smart_stamp_hash); if stamp.is_up_to_date() { if stamp.stamp.is_empty() { @@ -1137,8 +1137,7 @@ impl Step for Sanitizers { ) }); - let stamp = - BuildStamp::new(&out_dir).with_prefix("sanitizers").with_stamp(smart_stamp_hash); + let stamp = BuildStamp::new(&out_dir).with_prefix("sanitizers").add_stamp(smart_stamp_hash); if stamp.is_up_to_date() { if stamp.stamp.is_empty() { diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index 78bb5747ffd..c477bdb829a 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -428,7 +428,7 @@ impl Config { let host = self.build; let clippy_stamp = - BuildStamp::new(&self.initial_sysroot).with_prefix("clippy").with_stamp(date); + BuildStamp::new(&self.initial_sysroot).with_prefix("clippy").add_stamp(date); let cargo_clippy = self.initial_sysroot.join("bin").join(exe("cargo-clippy", host)); if cargo_clippy.exists() && clippy_stamp.is_up_to_date() { return cargo_clippy; @@ -462,7 +462,7 @@ impl Config { let host = self.build; let bin_root = self.out.join(host).join("rustfmt"); let rustfmt_path = bin_root.join("bin").join(exe("rustfmt", host)); - let rustfmt_stamp = BuildStamp::new(&bin_root).with_prefix("rustfmt").with_stamp(channel); + let rustfmt_stamp = BuildStamp::new(&bin_root).with_prefix("rustfmt").add_stamp(channel); if rustfmt_path.exists() && rustfmt_stamp.is_up_to_date() { return Some(rustfmt_path); } @@ -569,7 +569,7 @@ impl Config { ) { let host = self.build.triple; let bin_root = self.out.join(host).join(sysroot); - let rustc_stamp = BuildStamp::new(&bin_root).with_prefix("rustc").with_stamp(stamp_key); + let rustc_stamp = BuildStamp::new(&bin_root).with_prefix("rustc").add_stamp(stamp_key); if !bin_root.join("bin").join(exe("rustc", self.build)).exists() || !rustc_stamp.is_up_to_date() @@ -732,7 +732,7 @@ download-rustc = false let llvm_root = self.ci_llvm_root(); let llvm_sha = detect_llvm_sha(self, self.rust_info.is_managed_git_subrepository()); let stamp_key = format!("{}{}", llvm_sha, self.llvm_assertions); - let llvm_stamp = BuildStamp::new(&llvm_root).with_prefix("llvm").with_stamp(stamp_key); + let llvm_stamp = BuildStamp::new(&llvm_root).with_prefix("llvm").add_stamp(stamp_key); if !llvm_stamp.is_up_to_date() && !self.dry_run() { self.download_ci_llvm(&llvm_sha); diff --git a/src/bootstrap/src/utils/build_stamp.rs b/src/bootstrap/src/utils/build_stamp.rs index ae35b4c8d61..831385c762a 100644 --- a/src/bootstrap/src/utils/build_stamp.rs +++ b/src/bootstrap/src/utils/build_stamp.rs @@ -41,8 +41,8 @@ impl BuildStamp { } /// Sets stamp content to the specified value. - pub fn with_stamp<S: ToString>(mut self, stamp: S) -> Self { - self.stamp = stamp.to_string(); + pub fn add_stamp<S: ToString>(mut self, stamp: S) -> Self { + self.stamp.push_str(&stamp.to_string()); self } diff --git a/src/bootstrap/src/utils/build_stamp/tests.rs b/src/bootstrap/src/utils/build_stamp/tests.rs index 0637897507a..2d7d1f71246 100644 --- a/src/bootstrap/src/utils/build_stamp/tests.rs +++ b/src/bootstrap/src/utils/build_stamp/tests.rs @@ -26,7 +26,7 @@ fn test_with_invalid_prefix2() { fn test_is_up_to_date() { let dir = temp_dir(); - let mut build_stamp = BuildStamp::new(&dir).with_stamp("v1.0.0"); + let mut build_stamp = BuildStamp::new(&dir).add_stamp("v1.0.0"); build_stamp.write().unwrap(); assert!( @@ -47,7 +47,7 @@ fn test_is_up_to_date() { fn test_with_prefix() { let dir = temp_dir(); - let stamp = BuildStamp::new(&dir).with_stamp("v1.0.0"); + let stamp = BuildStamp::new(&dir).add_stamp("v1.0.0"); assert_eq!(stamp.path.file_name().unwrap(), ".stamp"); let stamp = stamp.with_prefix("test"); |
