Skip to content

Commit 9829b76

Browse files
committed
implement --prepare-only flag on rust-installer generator
Signed-off-by: onur-ozkan <[email protected]>
1 parent f536185 commit 9829b76

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/tools/rust-installer/src/generator.rs

+16-11
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ actor! {
6161
/// The formats used to compress the tarball
6262
#[arg(value_name = "FORMAT", default_value_t)]
6363
compression_formats: CompressionFormats,
64+
65+
/// Indicate whether to leave the prepared directories without generating tarballs
66+
prepare_only: bool,
6467
}
6568
}
6669

@@ -105,17 +108,19 @@ impl Generator {
105108
.output_script(path_to_str(&output_script)?.into());
106109
scripter.run()?;
107110

108-
// Make the tarballs
109-
create_dir_all(&self.output_dir)?;
110-
let output = Path::new(&self.output_dir).join(&self.package_name);
111-
let mut tarballer = Tarballer::default();
112-
tarballer
113-
.work_dir(self.work_dir)
114-
.input(self.package_name)
115-
.output(path_to_str(&output)?.into())
116-
.compression_profile(self.compression_profile)
117-
.compression_formats(self.compression_formats);
118-
tarballer.run()?;
111+
if !self.prepare_only {
112+
// Make the tarballs
113+
create_dir_all(&self.output_dir)?;
114+
let output = Path::new(&self.output_dir).join(&self.package_name);
115+
let mut tarballer = Tarballer::default();
116+
tarballer
117+
.work_dir(self.work_dir)
118+
.input(self.package_name)
119+
.output(path_to_str(&output)?.into())
120+
.compression_profile(self.compression_profile)
121+
.compression_formats(self.compression_formats);
122+
tarballer.run()?;
123+
}
119124

120125
Ok(())
121126
}

0 commit comments

Comments
 (0)