Skip to content

Commit

Permalink
introduce expander for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
drahnr committed Apr 9, 2024
1 parent a5638f1 commit e6eb484
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions progenitor-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ serde_json = "1.0"
serde_yaml = "0.9"
serde_tokenstream = "0.2.0"
syn = { version = "2.0", features = ["full", "extra-traits"] }
expander = "2"
4 changes: 4 additions & 0 deletions progenitor-macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,9 @@ fn do_generate_api(item: TokenStream) -> Result<TokenStream, syn::Error> {
const _: &str = include_str!(#path_str);
};

let output = expander::Expander::new(format!("{}", std::path::PathBuf::from(spec.value()).file_name().unwrap().to_string_lossy()))
.fmt(expander::Edition::_2021)
.verbose(true)
.write_to_out_dir(output).expect("Writing file works. qed");
Ok(output.into())
}
1 change: 1 addition & 0 deletions progenitor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"
clap = { version = "4.1.14", features = ["derive"] }
expander = "2.1.0"

[build-dependencies]
built = { version = "0.6", features = ["git2"] }
Expand Down

0 comments on commit e6eb484

Please sign in to comment.