Release snapshots are extracted with fresh mtimes (tar -m) so cargo always recompiles workspace crates
Browse files at this commit755029a1dcca394c31828d1d708eaeb953b49ad9Parent: 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
1 changed file +8 -7
crates/client/src/release.rsmodified+8 -7
| @@ -47,7 +47,7 @@ const ARCHIVE: &str = "dist/source.tgz"; | ||
| 47 | 47 | const VM: &str = "yumush-win"; |
| 48 | 48 | const TARGET: &str = "yumush@127.0.0.1"; |
| 49 | 49 | 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"; | |
| 51 | 51 | |
| 52 | 52 | pub fn is_source(path: &Path) -> bool { |
| 53 | 53 | path.join("crates/client/Cargo.toml").is_file() && path.join(".git").exists() |
| @@ -232,7 +232,7 @@ fn snapshot(source: &Path) -> Result<(), String> { | ||
| 232 | 232 | )?; |
| 233 | 233 | check( |
| 234 | 234 | Command::new("tar") |
| 235 | - .arg("xzf") | |
| 235 | + .arg("-xmzf") | |
| 236 | 236 | .arg(&tgz) |
| 237 | 237 | .arg("-C") |
| 238 | 238 | .arg(&tree), |
| @@ -256,13 +256,13 @@ fn build_linux(job: Job, level: Level, source: &Path, cx: &Cx) -> Result<(), Str | ||
| 256 | 256 | .env("CARGO_TERM_PROGRESS_WIDTH", "200") |
| 257 | 257 | .env("CARGO_TERM_COLOR", "never") |
| 258 | 258 | .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 | + } | |
| 259 | 263 | stream(&mut cmd, job, cx)?; |
| 260 | 264 | 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())?; | |
| 266 | 266 | cx.send(Event::Built(job, dest)); |
| 267 | 267 | cx.send(Event::Finished(job)); |
| 268 | 268 | Ok(()) |
| @@ -289,6 +289,7 @@ $env:Path += ";$env:USERPROFILE\.cargo\bin" | ||
| 289 | 289 | $env:CARGO_TERM_PROGRESS_WHEN = 'always'; $env:CARGO_TERM_PROGRESS_WIDTH = '200'; $env:CARGO_TERM_COLOR = 'never' |
| 290 | 290 | @' |
| 291 | 291 | {toml}'@ | Set-Content -Encoding ascii level.toml |
| 292 | +Remove-Item -Force ..\target-release-{name}\release\client.exe -ErrorAction SilentlyContinue | |
| 292 | 293 | cargo build --release -p client --target-dir ..\target-release-{name} --config level.toml |
| 293 | 294 | exit $LASTEXITCODE |
| 294 | 295 | "#, |