Closed phroi closed 11 months ago
https://rust-lang.github.io/rfcs/3013-conditional-compilation-checking.html correct version:
#[cfg(feature = "myfeature")]
or
if cfg!(feature = "myfeature")] {
//...
}
@XuJiandong that's actually works, thanks a lot!!
I may be wrong, but in my opinion the behavior changed since I started developing iCKB :thinking:
With Capsule 0.9.0 it was still generating the correct contract with the syntax cfg!(myfeature)]
, I know this as I tested all iCKB functionalities on a devnet. Now on Capsule 0.10.1 the same setup would generate a contract for mainnet (which is the default when no feature is specified), so it cannot possibly work on a devnet.
Configuration flags are not forwarded to rust compiler. To test this I created this repo: phroi/capsule-feature-error. The following test script:
Compiled with the following command:
Or with:
Results in the same kind error:
Keep up the great work :muscle: Phroi
PS: of course the use of
panic
is not the issue here. This can be proven by inverting the two linesOk(())
andpanic!("myfeature not found in command line args");
and noticing that it compiles just fine.