forge
Explore
Log in

Don't you dare go Hollow

Release snapshots are extracted with fresh mtimes (tar -m) so cargo always recompiles workspace crates

Browse files at this commit

755029a1dcca394c31828d1d708eaeb953b49ad9Ahmet Kaan GümüşParent: a01a53f
  • fix
    • release snapshots are extracted with fresh mtimes (tar -m) so cargo always recompiles workspace crates
    • archive mtimes older than the last build made the Windows build reuse a stale exe. The previous output binary is deleted before each build so a no-op build can never ship an old file
Show full message
🐛 fix: release snapshots are extracted with fresh mtimes (tar -m) so cargo always recompiles workspace crates; archive mtimes older than the last build made the Windows build reuse a stale exe. The previous output binary is deleted before each build so a no-op build can never ship an old file
crates/client/src/release.rsmodified+8 -7
@@ -47,7 +47,7 @@ const ARCHIVE: &str = "dist/source.tgz";
4747 const VM: &str = "yumush-win";
4848 const TARGET: &str = "yumush@127.0.0.1";
4949 const PORT: &str = "2222";
50-const EXTRACT: &str = "Remove-Item -Recurse -Force release -ErrorAction SilentlyContinue; New-Item -ItemType Directory release | Out-Null; tar xzf release.tgz -C release";
50+const EXTRACT: &str = "Remove-Item -Recurse -Force release -ErrorAction SilentlyContinue; New-Item -ItemType Directory release | Out-Null; tar -xmzf release.tgz -C release";
5151
5252 pub fn is_source(path: &Path) -> bool {
5353 path.join("crates/client/Cargo.toml").is_file() && path.join(".git").exists()
@@ -232,7 +232,7 @@ fn snapshot(source: &Path) -> Result<(), String> {
232232 )?;
233233 check(
234234 Command::new("tar")
235- .arg("xzf")
235+ .arg("-xmzf")
236236 .arg(&tgz)
237237 .arg("-C")
238238 .arg(&tree),
@@ -256,13 +256,13 @@ fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), Str
256256 .env("CARGO_TERM_PROGRESS_WIDTH", "200")
257257 .env("CARGO_TERM_COLOR", "never")
258258 .stdout(Stdio::null());
259+ let built = source.join(format!("target/release-{name}/release/client"));
260+ if built.exists() {
261+ fs::remove_file(&built).map_err(|e| e.to_string())?;
262+ }
259263 stream(&mut cmd, job, cx)?;
260264 let dest = source.join("dist").join(format!("x86_64_{name}-linux"));
261- fs::copy(
262- source.join(format!("target/release-{name}/release/client")),
263- &dest,
264- )
265- .map_err(|e| e.to_string())?;
265+ fs::copy(&built, &dest).map_err(|e| e.to_string())?;
266266 cx.send(Event::Built(job, dest));
267267 cx.send(Event::Finished(job));
268268 Ok(())
@@ -289,6 +289,7 @@ $env:Path += ";$env:USERPROFILE\.cargo\bin"
289289 $env:CARGO_TERM_PROGRESS_WHEN = 'always'; $env:CARGO_TERM_PROGRESS_WIDTH = '200'; $env:CARGO_TERM_COLOR = 'never'
290290 @'
291291 {toml}'@ | Set-Content -Encoding ascii level.toml
292+Remove-Item -Force ..\target-release-{name}\release\client.exe -ErrorAction SilentlyContinue
292293 cargo build --release -p client --target-dir ..\target-release-{name} --config level.toml
293294 exit $LASTEXITCODE
294295 "#,