-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathMakefile
More file actions
137 lines (102 loc) · 4.5 KB
/
Copy pathMakefile
File metadata and controls
137 lines (102 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
RUST_TOOLCHAIN_NIGHTLY = nightly-2026-01-22
SOLANA_CLI_VERSION = v4.0.0-beta.7
nightly = +${RUST_TOOLCHAIN_NIGHTLY}
make-path = $1
rust-toolchain-nightly:
@echo ${RUST_TOOLCHAIN_NIGHTLY}
solana-cli-version:
@echo ${SOLANA_CLI_VERSION}
cargo-nightly:
cargo $(nightly) $(ARGS)
audit:
cargo audit \
--ignore RUSTSEC-2022-0093 \
--ignore RUSTSEC-2024-0421 \
--ignore RUSTSEC-2024-0344 \
$(ARGS)
spellcheck:
cargo spellcheck --code 1 $(ARGS)
clippy-%:
cargo $(nightly) clippy --manifest-path $(call make-path,$*)/Cargo.toml \
--all-targets \
--all-features \
-- \
--deny=warnings \
--deny=clippy::default_trait_access \
--deny=clippy::arithmetic_side_effects \
--deny=clippy::manual_let_else \
--deny=clippy::used_underscore_binding $(ARGS)
format-check-%:
cargo $(nightly) fmt --check --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
powerset-%:
cargo $(nightly) hack check --feature-powerset --all-targets --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
check-no-std-alloc-%:
cargo $(nightly) hack check \
--target bpfel-unknown-none \
--each-feature \
--manifest-path $(call make-path,$*)/Cargo.toml \
-Zbuild-std=alloc,core \
$(ARGS)
semver-check-%:
cargo semver-checks --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
shellcheck:
git ls-files -- '*.sh' | xargs shellcheck --color=always --external-sources --shell=bash $(ARGS)
sort-check:
cargo $(nightly) sort --workspace --check $(ARGS)
bench-%:
cargo $(nightly) bench --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
format-rust:
cargo $(nightly) fmt --all $(ARGS)
build-sbf-%:
cargo build-sbf --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
build-wasm-js-%:
wasm-pack build --target nodejs --out-dir dist/node --out-name index $(call make-path,$*)
wasm-pack build --target web --out-dir dist/web --out-name index $(call make-path,$*)
wasm-pack build --target bundler --out-dir dist/bundler --out-name index $(call make-path,$*)
test-wasm-js-%:
wasm-pack test --node $(call make-path,$*) $(ARGS)
wasm-pack test --headless --firefox $(call make-path,$*) --features test-browser $(ARGS)
wasm-pack test --headless --chrome $(call make-path,$*) --features test-browser $(ARGS)
pnpm i --dir $(call make-path,$*)/examples/node-integration && pnpm test --dir $(call make-path,$*)/examples/node-integration
pnpm i --dir $(call make-path,$*)/examples/web-integration && \
pnpm i --dir $(call make-path,$*)/examples/vite-integration && \
pnpm i --dir $(call make-path,$*)/examples/webpack-integration && \
pnpm exec playwright install --with-deps && \
pnpm exec playwright test --config $(call make-path,$*)/examples/playwright.config.js
build-wasm-%:
cargo build --target wasm32-unknown-unknown --manifest-path $(call make-path,$*)/Cargo.toml --all-features $(ARGS)
build-doc-%:
RUSTDOCFLAGS="--cfg docsrs -D warnings" cargo $(nightly) doc --all-features --no-deps --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
test-doc-%:
cargo $(nightly) test --doc --all-features --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
format-check-js-%:
cd $(call make-path,$*) && pnpm install && pnpm format $(ARGS)
lint-js-%:
cd $(call make-path,$*) && pnpm install && pnpm lint $(ARGS)
test-js-%:
make restart-test-validator
cd $(call make-path,$*) && pnpm install && pnpm build && pnpm test $(ARGS)
make stop-test-validator
test-%:
SBF_OUT_DIR=$(PWD)/target/deploy cargo $(nightly) test --manifest-path $(call make-path,$*)/Cargo.toml $(ARGS)
restart-test-validator:
./scripts/restart-test-validator.sh
stop-test-validator:
pkill -f solana-test-validator
generate-clients:
exit 0
# Helpers for publishing
tag-name = $(lastword $(subst /, ,$(call make-path,$1)))
preid-arg = $(subst pre,--preid $2,$(findstring pre,$1))
package-version = $(subst ",,$(shell jq -r '.version' $(call make-path,$1)/package.json))
crate-version = $(subst ",,$(shell toml get $(call make-path,$1)/Cargo.toml package.version))
git-tag-js-%:
@echo "$(call tag-name,$*)@v$(call package-version,$*)"
publish-js-%:
cd "$(call make-path,$*)" && pnpm install && pnpm version $(LEVEL) --no-git-tag-version $(call preid-arg,$(LEVEL),$(TAG)) && pnpm publish --no-git-checks --tag $(TAG)
git-tag-rust-%:
@echo "$(call tag-name,$*)@v$(call crate-version,$*)"
publish-rust-%:
cd "$(call make-path,$*)" && cargo release $(LEVEL) --tag-name "$(call tag-name,$*)@v{{version}}" --execute --no-confirm --dependent-version fix
publish-rust-dry-run-%:
cd "$(call make-path,$*)" && cargo release $(LEVEL) --tag-name "$(call tag-name,$*)@v{{version}}"