overseer: simplify debugging some more (#4053)

* overseer: simplify debugging some more

* chore: undo gitignore change
This commit is contained in:
Bernhard Schuster
2021-10-11 18:59:45 +02:00
committed by GitHub
parent e017422166
commit 6ea55caa85
2 changed files with 14 additions and 6 deletions
@@ -0,0 +1,2 @@
/// A dummy build script, so `OUT_DIR` is set.
fn main() {}
@@ -98,12 +98,12 @@ pub(crate) fn impl_overseer_gen(
additive.extend(impl_message_wrapper_enum(&info)?); additive.extend(impl_message_wrapper_enum(&info)?);
additive.extend(impl_dispatch(&info)); additive.extend(impl_dispatch(&info));
#[cfg(feature = "expansion")] if cfg!(feature = "expansion") {
{
use std::io::Write; use std::io::Write;
let cwd = std::env::current_dir().unwrap(); let out = env!("OUT_DIR");
let path: std::path::PathBuf = cwd.join("overlord-expansion.rs"); let out = std::path::PathBuf::from(out);
let path = out.join("overlord-expansion.rs");
let mut f = std::fs::OpenOptions::new() let mut f = std::fs::OpenOptions::new()
.write(true) .write(true)
.create(true) .create(true)
@@ -117,9 +117,15 @@ pub(crate) fn impl_overseer_gen(
std::process::Command::new("rustfmt") std::process::Command::new("rustfmt")
.arg("--edition=2018") .arg("--edition=2018")
.arg(&path) .arg(&path)
.current_dir(cwd) .current_dir(out)
.spawn() .spawn()
.expect("Running rustfmt works. qed"); .expect("Running rustfmt works. qed");
}
let path = path.display().to_string();
Ok(quote! {
include!( #path );
})
} else {
Ok(additive) Ok(additive)
}
} }