diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-03-20 13:52:36 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2024-03-20 15:16:52 +0100 |
| commit | 51d27a63b8039765790c469ebb169802da4a307e (patch) | |
| tree | 08040736bebd26e23b27eb1f5385f3f27c0b935f | |
| parent | 17abfa7041d143e30f74039e76245ec5acc56a56 (diff) | |
| download | rust-51d27a63b8039765790c469ebb169802da4a307e.tar.gz rust-51d27a63b8039765790c469ebb169802da4a307e.zip | |
Move cleanup of sysroot build into its own function
| -rw-r--r-- | build_system/src/build.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/build_system/src/build.rs b/build_system/src/build.rs index c81b02e2183..2d66fd89fb9 100644 --- a/build_system/src/build.rs +++ b/build_system/src/build.rs @@ -55,8 +55,7 @@ impl BuildArg { } } -pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Result<(), String> { - let start_dir = Path::new("build_sysroot"); +fn cleanup_sysroot_previous_build(start_dir: &Path) { // Cleanup for previous run // Clean target dir except for build scripts and incremental cache let _ = walk_dir( @@ -100,6 +99,11 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu let _ = fs::remove_file(start_dir.join("Cargo.lock")); let _ = fs::remove_file(start_dir.join("test_target/Cargo.lock")); let _ = fs::remove_dir_all(start_dir.join("sysroot")); +} + +pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Result<(), String> { + let start_dir = Path::new("build_sysroot"); + cleanup_sysroot_previous_build(&start_dir); // Builds libs let mut rustflags = env.get("RUSTFLAGS").cloned().unwrap_or_default(); |
