Skip to content

Commit 51d27a6

Browse files
Move cleanup of sysroot build into its own function
1 parent 17abfa7 commit 51d27a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

build_system/src/build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ impl BuildArg {
5555
}
5656
}
5757

58-
pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Result<(), String> {
59-
let start_dir = Path::new("build_sysroot");
58+
fn cleanup_sysroot_previous_build(start_dir: &Path) {
6059
// Cleanup for previous run
6160
// Clean target dir except for build scripts and incremental cache
6261
let _ = walk_dir(
@@ -100,6 +99,11 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
10099
let _ = fs::remove_file(start_dir.join("Cargo.lock"));
101100
let _ = fs::remove_file(start_dir.join("test_target/Cargo.lock"));
102101
let _ = fs::remove_dir_all(start_dir.join("sysroot"));
102+
}
103+
104+
pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Result<(), String> {
105+
let start_dir = Path::new("build_sysroot");
106+
cleanup_sysroot_previous_build(&start_dir);
103107

104108
// Builds libs
105109
let mut rustflags = env.get("RUSTFLAGS").cloned().unwrap_or_default();

0 commit comments

Comments
 (0)