1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
--- a/build.rs
+++ b/build.rs
@@ -19,6 +19,8 @@
},
};
+const OUT_DIR: &str = "debian/build_artifacts";
+
fn write_completions_file<G: Generator + Copy, P: AsRef<OsStr>>(
generator: G,
out_dir: P,
@@ -31,7 +33,7 @@
/// write the shell completion scripts which will be added to
/// the release archive
fn build_completion_scripts() {
- let out_dir = env::var_os("OUT_DIR").expect("out dir not set");
+ let out_dir = OUT_DIR;
write_completions_file(Shell::Bash, &out_dir);
write_completions_file(Shell::Elvish, &out_dir);
write_completions_file(Shell::Fish, &out_dir);
@@ -41,7 +43,7 @@
/// generate the man page from the Clap configuration
fn build_man_page() -> std::io::Result<()> {
- let out_dir = env::var_os("OUT_DIR").expect("out dir not set");
+ let out_dir = OUT_DIR;
let out_dir = PathBuf::from(out_dir);
let cmd = Args::command();
let man = clap_mangen::Man::new(cmd);
@@ -103,6 +105,7 @@
fn main() -> std::io::Result<()> {
check_version_consistency();
+ fs::create_dir_all(OUT_DIR).expect("could not create OUT_DIR");
build_completion_scripts();
build_man_page()?;
Ok(())
|