Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
overseer: simplify debugging some more (#4053)
Browse files Browse the repository at this point in the history
* overseer: simplify debugging some more

* chore: undo gitignore change
  • Loading branch information
drahnr authored Oct 11, 2021
1 parent 70ccebc commit 7c63ac8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions node/overseer/overseer-gen/proc-macro/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// A dummy build script, so `OUT_DIR` is set.
fn main() {}
18 changes: 12 additions & 6 deletions node/overseer/overseer-gen/proc-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ pub(crate) fn impl_overseer_gen(
additive.extend(impl_message_wrapper_enum(&info)?);
additive.extend(impl_dispatch(&info));

#[cfg(feature = "expansion")]
{
if cfg!(feature = "expansion") {
use std::io::Write;

let cwd = std::env::current_dir().unwrap();
let path: std::path::PathBuf = cwd.join("overlord-expansion.rs");
let out = env!("OUT_DIR");
let out = std::path::PathBuf::from(out);
let path = out.join("overlord-expansion.rs");
let mut f = std::fs::OpenOptions::new()
.write(true)
.create(true)
Expand All @@ -117,9 +117,15 @@ pub(crate) fn impl_overseer_gen(
std::process::Command::new("rustfmt")
.arg("--edition=2018")
.arg(&path)
.current_dir(cwd)
.current_dir(out)
.spawn()
.expect("Running rustfmt works. qed");

let path = path.display().to_string();
Ok(quote! {
include!( #path );
})
} else {
Ok(additive)
}
Ok(additive)
}

0 comments on commit 7c63ac8

Please sign in to comment.