Skip to content

Commit

Permalink
Use zepter to format Cargo.toml files (#2161)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou authored Mar 15, 2024
1 parent 9fd6126 commit 1d21a77
Show file tree
Hide file tree
Showing 17 changed files with 140 additions and 86 deletions.
40 changes: 40 additions & 0 deletions .config/zepter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version:
format: 1
# Minimum version of the binary that is expected to work. This is just for printing a nice error
# message when someone tries to use an older version.
binary: 0.13.2

# The examples in this file assume crate `A` to have a dependency on crate `B`.
workflows:
check:
- [
'lint',
# Check that `A` activates the features of `B`.
'propagate-feature',
# These are the features to check:
'--features=std',
# Do not try to add a new section into `[features]` of `A` only because `B` expose that feature. There are edge-cases where this is still needed, but we can add them manually.
'--left-side-feature-missing=ignore',
# Ignore the case that `A` it outside of the workspace. Otherwise it will report errors in external dependencies that we have no influence on.
'--left-side-outside-workspace=ignore',
# Some features imply that they activate a specific dependency as non-optional. Otherwise the default behaviour with a `?` is used.
'--feature-enables-dep=try-runtime:frame-try-runtime,runtime-benchmarks:frame-benchmarking',
# Auxiliary flags:
'--offline',
'--locked',
'--show-path',
'--quiet',
]
# Same as `check`, but with the `--fix` flag.
default:
- [ $check.0, '--fix' ]

# Will be displayed when any workflow fails:
help:
text: |
Ink! uses the Zepter CLI to detect abnormalities in the feature configuration.
It looks like one more more checks failed; please check the console output. You can try to automatically address them by running `zepter`.
Otherwise please ask directly in the Merge Request, GitHub Discussions or on Matrix Chat, thank you.
links:
- "/~https://github.com/paritytech/polkadot-sdk/issues/1831"
- "/~https://github.com/ggwpez/zepter"
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ jobs:

- name: Check Formatting
run: |
zepter run check
cargo +nightly fmt --all -- --check
# For the UI tests we need to disable the license check
cargo +nightly fmt --all -- --check ./crates/ink/tests/ui/contract/{pass,fail}/*.rs
Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Verify the following locally, otherwise the CI will fail:
- `cargo +nightly fmt --all`
1. Is `clippy` happy with it?
- `cargo clippy --all-targets --all-features` -- -D warnings;
1. Are Cargo.toml files formatted properly?
* `cargo install zepter`
* `zepter run`
1. Does the code still compile?
- `cargo check --all-features`
1. Do all the integration tests/examples still compile?
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/allocator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ quickcheck = { workspace = true }
quickcheck_macros = { workspace = true }

[features]
default = ["std"]
default = [ "std" ]
std = []
ink-fuzz-tests = ["std"]
ink-fuzz-tests = [ "std" ]
no-allocator = []
17 changes: 10 additions & 7 deletions crates/e2e/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ sp-weights = { workspace = true }
scale-info = { workspace = true, features = ["derive"] }

[features]
default = ["std"]
default = [ "std" ]
std = [
"impl-serde/std",
"ink_e2e_macro/std",
"pallet-contracts/std",
"scale/std",
"scale-info/std",
"scale/std",
"serde/std",
"sp-core/std",
"sp-runtime/std",
"sp-weights/std",
"ink_e2e_macro/std"
"drink?/std",
"frame-support/std",
"pallet-contracts-mock-network?/std"
]
drink = [
"dep:drink",
"subxt-metadata",
"pallet-contracts-mock-network",
"ink_e2e_macro/drink",
"dep:drink",
"ink_e2e_macro/drink",
"pallet-contracts-mock-network",
"subxt-metadata",
]
7 changes: 2 additions & 5 deletions crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ blake2 = { workspace = true }
secp256k1 = { workspace = true, features = ["recovery", "global-context"], optional = true }

[features]
default = ["std"]
std = [
"scale/std",
"secp256k1"
]
default = [ "std" ]
std = [ "ink_primitives/std", "scale/std", "secp256k1" ]
38 changes: 20 additions & 18 deletions crates/env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,30 @@ scale-info = { workspace = true, features = ["derive"], optional = true }
ink = { path = "../ink" }

[features]
default = ["std"]
default = [ "std" ]
std = [
"ink_allocator/std",
"ink_prelude/std",
"ink_primitives/std",
"ink_storage_traits/std",
"ink_engine/std",
"scale/std",
"scale-decode",
"scale-encode",
"scale-info/std",
"secp256k1",
"schnorrkel",
"num-traits/std",
# Enables hashing crates for off-chain environment.
"sha2",
"sha3",
"blake2",
"blake2",
"ink_allocator/std",
"ink_engine/std",
"ink_prelude/std",
"ink_primitives/std",
"ink_storage_traits/std",
"num-traits/std",
"scale-decode",
"scale-encode",
"scale-info/std",
"scale/std",
"schnorrkel",
"secp256k1",
# Enables hashing crates for off-chain environment.
"sha2",
"sha3",
"scale-decode?/std",
"scale-encode?/std"
]

# Enable contract debug messages via `debug_print!` and `debug_println!`.
ink-debug = []

# Disable the ink! provided global memory allocator.
no-allocator = ["ink_allocator/no-allocator"]
no-allocator = [ "ink_allocator/no-allocator" ]
24 changes: 11 additions & 13 deletions crates/ink/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,21 @@ trybuild = { workspace = true, features = ["diff"] }


[features]
default = ["std"]
default = [ "std" ]
std = [
"ink_metadata/std",
"ink_prelude/std",
"ink_primitives/std",
"ink_env/std",
"ink_storage/std",
"ink_macro/std",
"scale/std",
"scale-info/std",
"ink_env/std",
"ink_macro/std",
"ink_metadata/std",
"ink_prelude/std",
"ink_primitives/std",
"ink_storage/std",
"scale-info/std",
"scale/std",
]
# Enable contract debug messages via `debug_print!` and `debug_println!`.
ink-debug = [
"ink_env/ink-debug",
]
ink-debug = [ "ink_env/ink-debug" ]

show-codegen-docs = []

# Disable the ink! provided global memory allocator.
no-allocator = ["ink_env/no-allocator"]
no-allocator = [ "ink_env/no-allocator" ]
11 changes: 7 additions & 4 deletions crates/ink/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

[features]
default = ["std"]
default = [ "std" ]
std = [
"itertools/use_std",
"either/use_std",
"ir/std"
"either/use_std",
"ink_primitives/std",
"ir/std",
"itertools/use_std",
"scale/std",
"serde/std"
]
8 changes: 5 additions & 3 deletions crates/ink/ir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ impl-serde = { workspace = true }
ink_prelude = { workspace = true }

[features]
default = ["std"]
default = [ "std" ]
std = [
"itertools/use_std",
"either/use_std",
"either/use_std",
"ink_prelude/std",
"itertools/use_std",
"impl-serde/std"
]
10 changes: 6 additions & 4 deletions crates/ink/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ name = "ink_macro"
proc-macro = true

[features]
default = ["std"]
default = [ "std" ]
std = [
"scale/std",
"ink_ir/std",
"ink_primitives/std",
"ink_codegen/std",
"ink_ir/std",
"ink_primitives/std",
"scale/std",
"scale-info/std"
]
14 changes: 6 additions & 8 deletions crates/metadata/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ pretty_assertions = "1"
serde_json = "1"

[features]
default = [
"std",
"derive",
]
default = [ "derive", "std" ]
std = [
"ink_prelude/std",
"ink_primitives/std",
"serde/std",
"scale-info/std",
"ink_prelude/std",
"ink_primitives/std",
"scale-info/std",
"serde/std",
"scale/std"
]
derive = []
2 changes: 1 addition & 1 deletion crates/prelude/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ include = ["/Cargo.toml", "src/**/*.rs", "/README.md", "/LICENSE"]
cfg-if = { workspace = true }

[features]
default = ["std"]
default = [ "std" ]
std = []
14 changes: 8 additions & 6 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ scale-info = { workspace = true, features = ["derive"], optional = true }
xxhash-rust = { workspace = true, features = ["const_xxh32"] }

[features]
default = ["std"]
default = [ "std" ]
std = [
"ink_prelude/std",
"scale/std",
"scale-decode",
"scale-encode",
"scale-info/std",
"ink_prelude/std",
"scale-decode",
"scale-encode",
"scale-info/std",
"scale/std",
"scale-decode?/std",
"scale-encode?/std"
]
18 changes: 9 additions & 9 deletions crates/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ itertools = { workspace = true, default-features = true }
ink = { path = "../ink"}

[features]
default = ["std"]
default = [ "std" ]
std = [
"ink_metadata/std",
"ink_env/std",
"ink_prelude/std",
"ink_primitives/std",
"ink_storage_traits/std",
"scale/std",
"scale-info/std",
"ink_env/std",
"ink_metadata/std",
"ink_prelude/std",
"ink_primitives/std",
"ink_storage_traits/std",
"scale-info/std",
"scale/std",
]
ink-fuzz-tests = ["std"]
ink-fuzz-tests = [ "std" ]
12 changes: 6 additions & 6 deletions crates/storage/traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ scale-info = { workspace = true, features = ["derive"], optional = true }
paste = { workspace = true }

[features]
default = ["std"]
default = [ "std" ]
std = [
"ink_metadata/std",
"ink_primitives/std",
"ink_prelude/std",
"scale/std",
"scale-info/std",
"ink_metadata/std",
"ink_prelude/std",
"ink_primitives/std",
"scale-info/std",
"scale/std",
]

0 comments on commit 1d21a77

Please sign in to comment.