Skip to content

Commit

Permalink
Expose disable_target_static_assertions feature flag (#257)
Browse files Browse the repository at this point in the history
* [api-client] explicitly disable target static assertions in ap-client

* make disable_target_static_assertions and optional feature

* [test-no-std] say how it needs to be used.
  • Loading branch information
clangenb authored Jul 5, 2022
1 parent 7b56455 commit b406701
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ sp-std = { version = "4.0.0-dev", default-features = false, git = "https://githu
# need to add this for the app_crypto macro
sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master", features = ["full_crypto"] }

sp-runtime-interface = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }

# local deps
ac-compose-macros = { path = "compose-macros", default-features = false }
ac-node-api = { path = "node-api", optional = true }
Expand All @@ -54,6 +56,10 @@ wabt = "0.10.0"

[features]
default = ["std", "ws-client"]
# To support `no_std` builds in non-32 bit environments.
disable_target_static_assertions = [
"sp-runtime-interface/disable_target_static_assertions"
]
std = [
"sp-application-crypto/std",
"sp-core/std",
Expand All @@ -72,6 +78,7 @@ std = [
"primitive-types",
"thiserror",
"sp-rpc",
"sp-runtime-interface/std",
"transaction-payment/std",
# local deps
"ac-compose-macros/std",
Expand Down
6 changes: 5 additions & 1 deletion node-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@ sp-runtime = { version = "6.0.0", default-features = false, git = "https://githu

# need to add this for `no_std`
sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master", features = ["full_crypto"] }
sp-runtime-interface = { version = "6.0.0", default-features = false, features = ["disable_target_static_assertions"], git = "https://github.com/paritytech/substrate.git", branch = "master" }
sp-runtime-interface = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "master" }

[features]
default = ["std"]
# To support `no_std` builds in non-32 bit environments.
disable_target_static_assertions = [
"sp-runtime-interface/disable_target_static_assertions"
]
std = [
"codec/std",
"frame-metadata/std",
Expand Down
4 changes: 2 additions & 2 deletions test-no-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ edition = "2021"
libc = { version = "0.2.119", default-features = false }

# local dependencies
ac-node-api = { path = "../node-api", default-features = false, optional = true }
substrate-api-client = { path = "..", default-features = false, optional = true }
ac-node-api = { path = "../node-api", default-features = false, optional = true, features = ["disable_target_static_assertions"] }
substrate-api-client = { path = "..", default-features = false, optional = true, features = ["disable_target_static_assertions"] }

# substrate dependencies
sp-io = { version = "6.0.0", default-features = false, features = ["disable_oom", "disable_panic_handler"], git = "https://github.com/paritytech/substrate.git", branch = "master" }
Expand Down
3 changes: 3 additions & 0 deletions test-no-std/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#![no_std]
#![no_main]

#[cfg(not(any(feature = "api-client", feature = "node-api")))]
compile_error!("either feature \"api-client\" or feature \"node-api\" must be enabled");

// DUTs

#[cfg(feature = "api-client")]
Expand Down

0 comments on commit b406701

Please sign in to comment.