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

Commit fe65adb

Browse files
construct_runtime: support for expanding the macro code (#14379)
* construct_runtime: support for expanding the macro code * Update frame/support/procedural/src/construct_runtime/mod.rs Co-authored-by: Bastian Köcher <[email protected]> * Update frame/support/procedural/Cargo.toml Co-authored-by: Bastian Köcher <[email protected]> * fmt added * fmt removed --------- Co-authored-by: Bastian Köcher <[email protected]>
1 parent 5c04e81 commit fe65adb

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frame/support/procedural/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ syn = { version = "2.0.16", features = ["full"] }
2525
frame-support-procedural-tools = { version = "4.0.0-dev", path = "./tools" }
2626
proc-macro-warning = { version = "0.4.1", default-features = false }
2727
macro_magic = { version = "0.3.5", features = ["proc_support"] }
28+
expander = "2.0.0"
2829

2930
[features]
3031
default = ["std"]

frame/support/procedural/src/construct_runtime/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,15 @@ pub fn construct_runtime(input: TokenStream) -> TokenStream {
178178
.and_then(|_| construct_runtime_final_expansion(explicit_decl)),
179179
};
180180

181-
res.unwrap_or_else(|e| e.to_compile_error()).into()
181+
let res = res.unwrap_or_else(|e| e.to_compile_error());
182+
183+
let res = expander::Expander::new("construct_runtime")
184+
.dry(std::env::var("FRAME_EXPAND").is_err())
185+
.verbose(true)
186+
.write_to_out_dir(res)
187+
.expect("Does not fail because of IO in OUT_DIR; qed");
188+
189+
res.into()
182190
}
183191

184192
/// When some pallet have implicit parts definition then the macro will expand into a macro call to

0 commit comments

Comments
 (0)