--- a/.maintain/scripts/generate_sol.sh +++ b/.maintain/scripts/generate_sol.sh @@ -4,7 +4,7 @@ PRETTIER_CONFIG="$(pwd)""/.prettierrc" tmp=$(mktemp) -cargo test --package $PACKAGE -- $NAME --exact --nocapture --ignored | tee $tmp +cargo test --package=$PACKAGE --features=stubgen -- $NAME --exact --nocapture --ignored | tee $tmp raw=$(mktemp --suffix .sol) sed -n '/=== SNIP START ===/, /=== SNIP END ===/{ /=== SNIP START ===/! { /=== SNIP END ===/! p } }' $tmp > $raw --- a/crates/evm-coder/Cargo.toml +++ b/crates/evm-coder/Cargo.toml @@ -37,3 +37,5 @@ "evm-core/std", "frame-support/std", ] +# Stub/interface generation +stubgen = [] --- a/crates/evm-coder/procedural/src/solidity_interface.rs +++ b/crates/evm-coder/procedural/src/solidity_interface.rs @@ -951,6 +951,7 @@ u32::to_be_bytes(interface_id) } /// Generate solidity definitions for methods described in this interface + #[cfg(feature = "stubgen")] pub fn generate_solidity_interface(tc: &evm_coder::solidity::TypeCollector, is_impl: bool) { use evm_coder::solidity::*; use core::fmt::Write; --- a/crates/evm-coder/procedural/src/to_log.rs +++ b/crates/evm-coder/procedural/src/to_log.rs @@ -195,6 +195,7 @@ #consts )* + #[cfg(feature = "stubgen")] pub fn generate_solidity_interface(tc: &evm_coder::solidity::TypeCollector, is_impl: bool) { use evm_coder::solidity::*; use core::fmt::Write; --- a/crates/evm-coder/src/lib.rs +++ b/crates/evm-coder/src/lib.rs @@ -108,6 +108,7 @@ #[doc(hidden)] pub mod events; #[doc(hidden)] +#[cfg(feature = "stubgen")] pub mod solidity; /// Solidity type definitions (aliases from solidity name to rust type) @@ -354,6 +355,7 @@ #[macro_export] macro_rules! generate_stubgen { ($name:ident, $decl:ty, $is_impl:literal) => { + #[cfg(feature = "stubgen")] #[test] #[ignore] fn $name() { --- a/pallets/common/Cargo.toml +++ b/pallets/common/Cargo.toml @@ -45,3 +45,4 @@ "up-data-structs/runtime-benchmarks", ] try-runtime = ["frame-support/try-runtime"] +stubgen = ["evm-coder/stubgen"] --- a/pallets/evm-contract-helpers/Cargo.toml +++ b/pallets/evm-contract-helpers/Cargo.toml @@ -52,3 +52,4 @@ "up-sponsorship/std", ] try-runtime = ["frame-support/try-runtime"] +stubgen = ["evm-coder/stubgen"] --- a/pallets/fungible/Cargo.toml +++ b/pallets/fungible/Cargo.toml @@ -46,3 +46,4 @@ ] runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks'] try-runtime = ["frame-support/try-runtime"] +stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"] --- a/pallets/nonfungible/Cargo.toml +++ b/pallets/nonfungible/Cargo.toml @@ -52,3 +52,4 @@ 'up-data-structs/runtime-benchmarks', ] try-runtime = ["frame-support/try-runtime"] +stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"] --- a/pallets/refungible/Cargo.toml +++ b/pallets/refungible/Cargo.toml @@ -54,3 +54,4 @@ 'up-data-structs/runtime-benchmarks', ] try-runtime = ["frame-support/try-runtime"] +stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"] --- a/runtime/unique/Cargo.toml +++ b/runtime/unique/Cargo.toml @@ -169,6 +169,7 @@ ] limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing'] unique-runtime = [] +stubgen = ["evm-coder/stubgen"] refungible = [] scheduler = []