Skip to content

Commit 2208ed5

Browse files
authored
Add Makefile and format TOML files (#336)
* feat: ✨ add a Makefile * style: 🎨 format TOML files * refactor: 🔥 remove noisy echoes * revert: ⏪ remove audit target
1 parent 74ff35c commit 2208ed5

File tree

7 files changed

+147
-82
lines changed

7 files changed

+147
-82
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- uses: actions/checkout@v2
21+
- name: Install taplo
22+
run: cargo install taplo-cli
2123
- name: Rustfmt
2224
run: cargo fmt --all -- --check
25+
- name: TOML fmt
26+
run: taplo fmt --check
2327
- name: Clippy
2428
run: cargo clippy --all
2529
build:

Cargo.toml

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ edition = "2018"
1212
auto_impl = "1.0"
1313
ethereum = { version = ">= 0.16, < 0.19", default-features = false }
1414
log = { version = "0.4", default-features = false }
15-
primitive-types = { version = "0.13", default-features = false, features = ["rlp"] }
15+
primitive-types = { version = "0.13", default-features = false, features = [
16+
"rlp",
17+
] }
1618
rlp = { version = "0.6", default-features = false }
1719
sha3 = { version = "0.10", default-features = false }
1820

1921
# Optional dependencies
2022
environmental = { version = "1.1.2", default-features = false, optional = true }
21-
scale-codec = { package = "parity-scale-codec", version = "3.7.5", default-features = false, features = ["derive"], optional = true }
22-
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
23-
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
23+
scale-codec = { package = "parity-scale-codec", version = "3.7.5", default-features = false, features = [
24+
"derive",
25+
], optional = true }
26+
scale-info = { version = "2.3", default-features = false, features = [
27+
"derive",
28+
], optional = true }
29+
serde = { version = "1.0", default-features = false, features = [
30+
"derive",
31+
], optional = true }
2432

2533
evm-core = { version = "0.43", path = "core", default-features = false }
2634
evm-gasometer = { version = "0.43", path = "gasometer", default-features = false }
@@ -37,48 +45,36 @@ harness = false
3745
[features]
3846
default = ["std"]
3947
std = [
40-
"ethereum/std",
41-
"log/std",
42-
"primitive-types/std",
43-
"rlp/std",
44-
"sha3/std",
45-
"environmental/std",
46-
"scale-codec/std",
47-
"scale-info/std",
48-
"serde/std",
49-
"evm-core/std",
50-
"evm-gasometer/std",
51-
"evm-runtime/std",
48+
"ethereum/std",
49+
"log/std",
50+
"primitive-types/std",
51+
"rlp/std",
52+
"sha3/std",
53+
"environmental/std",
54+
"scale-codec/std",
55+
"scale-info/std",
56+
"serde/std",
57+
"evm-core/std",
58+
"evm-gasometer/std",
59+
"evm-runtime/std",
5260
]
5361
allow_explicit_address = []
5462
with-codec = [
55-
"scale-codec",
56-
"scale-info",
57-
"primitive-types/codec",
58-
"primitive-types/scale-info",
59-
"ethereum/with-scale",
60-
"evm-core/with-codec",
63+
"scale-codec",
64+
"scale-info",
65+
"primitive-types/codec",
66+
"primitive-types/scale-info",
67+
"ethereum/with-scale",
68+
"evm-core/with-codec",
6169
]
6270
with-serde = [
63-
"serde",
64-
"primitive-types/impl-serde",
65-
"evm-core/with-serde",
66-
"ethereum/with-serde",
67-
]
68-
tracing = [
69-
"environmental",
70-
"evm-gasometer/tracing",
71-
"evm-runtime/tracing",
72-
]
73-
force-debug = [
74-
"evm-core/force-debug",
75-
"evm-gasometer/force-debug",
71+
"serde",
72+
"primitive-types/impl-serde",
73+
"evm-core/with-serde",
74+
"ethereum/with-serde",
7675
]
76+
tracing = ["environmental", "evm-gasometer/tracing", "evm-runtime/tracing"]
77+
force-debug = ["evm-core/force-debug", "evm-gasometer/force-debug"]
7778

7879
[workspace]
79-
members = [
80-
"core",
81-
"gasometer",
82-
"runtime",
83-
"fuzzer",
84-
]
80+
members = ["core", "gasometer", "runtime", "fuzzer"]

Makefile

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
.PHONY: all build check test fmt fmt-toml fmt-check clippy clean doc bench audit dev-deps ci help
2+
3+
# Run fmt, fmt-toml, clippy, and test
4+
all: fmt fmt-toml clippy test
5+
6+
# Build with various feature configurations
7+
build:
8+
cargo build --verbose
9+
cargo build --features tracing --verbose
10+
cargo build --all-features --verbose
11+
cargo build --no-default-features --verbose
12+
13+
# Type check without building
14+
check:
15+
cargo check --all
16+
cargo check --all --all-features
17+
cargo check --all --no-default-features
18+
19+
# Run tests with various feature configurations
20+
test:
21+
cargo test --verbose
22+
cargo test --all-features --verbose
23+
cargo test --no-default-features --verbose
24+
25+
# Format Rust code
26+
fmt:
27+
cargo fmt --all
28+
29+
# Format TOML files
30+
fmt-toml:
31+
taplo fmt
32+
33+
# Check code formatting (CI mode)
34+
fmt-check:
35+
cargo fmt --all -- --check
36+
taplo fmt --check
37+
38+
# Run clippy linter
39+
clippy:
40+
cargo clippy --all -- -D warnings
41+
cargo clippy --all --all-features -- -D warnings
42+
cargo clippy --all --no-default-features -- -D warnings
43+
44+
# Clean build artifacts
45+
clean:
46+
cargo clean
47+
48+
# Generate and open documentation
49+
doc:
50+
cargo doc --all-features --open
51+
52+
# Run benchmarks
53+
bench:
54+
cargo bench
55+
56+
# Install development dependencies
57+
dev-deps:
58+
@echo "Installing development dependencies..."
59+
rustup component add rustfmt
60+
rustup component add clippy
61+
cargo install taplo-cli
62+
63+
# Run CI checks locally
64+
ci: fmt-check clippy test build
65+
66+
# Show this help message
67+
help:
68+
@echo ''
69+
@echo 'Usage:'
70+
@echo ' make [target]'
71+
@echo ''
72+
@echo 'Targets:'
73+
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
74+
helpMessage = match(lastLine, /^# (.*)/); \
75+
if (helpMessage) { \
76+
helpCommand = substr($$1, 0, index($$1, ":")); \
77+
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
78+
printf "\033[36m%-15s\033[0m %s\n", helpCommand, helpMessage; \
79+
} \
80+
} \
81+
{ lastLine = $$0 }' $(MAKEFILE_LIST)
82+
83+
.DEFAULT_GOAL := help

core/Cargo.toml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,23 @@ edition = "2018"
1111
[dependencies]
1212
log = { version = "0.4", optional = true }
1313
primitive-types = { version = "0.13", default-features = false }
14-
scale-codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = ["derive", "full"], optional = true }
15-
scale-info = { version = "2.3", default-features = false, features = ["derive"], optional = true }
16-
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
14+
scale-codec = { package = "parity-scale-codec", version = "3.2", default-features = false, features = [
15+
"derive",
16+
"full",
17+
], optional = true }
18+
scale-info = { version = "2.3", default-features = false, features = [
19+
"derive",
20+
], optional = true }
21+
serde = { version = "1.0", default-features = false, features = [
22+
"derive",
23+
], optional = true }
1724

1825
[dev-dependencies]
1926
hex = "0.4"
2027

2128
[features]
2229
default = ["std"]
23-
std = [
24-
"primitive-types/std",
25-
"serde/std",
26-
"scale-codec/std",
27-
"scale-info/std",
28-
]
29-
with-codec = [
30-
"scale-codec",
31-
"scale-info",
32-
"primitive-types/impl-codec",
33-
]
34-
with-serde = [
35-
"serde",
36-
"primitive-types/impl-serde",
37-
]
38-
force-debug = [
39-
"log",
40-
]
30+
std = ["primitive-types/std", "serde/std", "scale-codec/std", "scale-info/std"]
31+
with-codec = ["scale-codec", "scale-info", "primitive-types/impl-codec"]
32+
with-serde = ["serde", "primitive-types/impl-serde"]
33+
force-debug = ["log"]

gasometer/Cargo.toml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,11 @@ evm-runtime = { version = "0.43", path = "../runtime", default-features = false
1919
[features]
2020
default = ["std"]
2121
std = [
22-
"environmental/std",
23-
"primitive-types/std",
24-
"evm-core/std",
25-
"evm-runtime/std",
26-
]
27-
tracing = [
28-
"environmental",
22+
"environmental/std",
23+
"primitive-types/std",
24+
"evm-core/std",
25+
"evm-runtime/std",
2926
]
27+
tracing = ["environmental"]
3028

31-
force-debug = [
32-
"log",
33-
]
29+
force-debug = ["log"]

runtime/Cargo.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,5 @@ evm-core = { version = "0.43", path = "../core", default-features = false }
1818

1919
[features]
2020
default = ["std"]
21-
std = [
22-
"environmental/std",
23-
"primitive-types/std",
24-
"sha3/std",
25-
"evm-core/std",
26-
]
27-
tracing = [
28-
"environmental",
29-
]
21+
std = ["environmental/std", "primitive-types/std", "sha3/std", "evm-core/std"]
22+
tracing = ["environmental"]

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
22
channel = "1.85.0"
33
profile = "minimal"
4-
components = [ "rustfmt", "clippy" ]
4+
components = ["rustfmt", "clippy"]

0 commit comments

Comments
 (0)