-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (60 loc) · 2.76 KB
/
Makefile
File metadata and controls
81 lines (60 loc) · 2.76 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
export RUSTFLAGS=-Dwarnings -Dclippy::all -Dclippy::pedantic
CARGO_HACK_ARGS=--feature-powerset --exclude-features default --group-features base64,serde,arbitrary,hex,rand
CARGO_DOC_ARGS?=--open
all: build test
test:
cargo hack test $(CARGO_HACK_ARGS)
build: generate
cargo hack clippy $(CARGO_HACK_ARGS) --all-targets
cargo clippy --no-default-features --features curr,next --release --target wasm32v1-none
doc:
cargo test --doc --all-features
RUSTDOCFLAGS="--cfg docs" cargo +nightly doc --package stellar-xdr --all-features $(CARGO_DOC_ARGS)
install:
cargo install --locked --path . --force --features cli
readme:
cargo +nightly rustdoc -- -Zunstable-options -wjson \
&& echo '# stellar-xdr' \
| cat target/doc/stellar_xdr.json \
| jq -r '"# stellar-xdr\n\n" + .index[.root|tostring].docs' \
> README.md
watch:
cargo watch --clear --watch-when-idle --shell '$(MAKE)'
generate: generate-files xdr/curr-version xdr/next-version xdr-json/curr xdr-json/next
CUSTOM_DEFAULT_IMPL=TransactionEnvelope
CUSTOM_STR_IMPL=PublicKey,AccountId,ContractId,MuxedAccount,MuxedAccountMed25519,SignerKey,SignerKeyEd25519SignedPayload,NodeId,ScAddress,AssetCode,AssetCode4,AssetCode12,ClaimableBalanceId,PoolId,MuxedEd25519Account,Int128Parts,UInt128Parts,Int256Parts,UInt256Parts
generate-files: src/curr/generated.rs src/next/generated.rs
src/curr/generated.rs: $(sort $(wildcard xdr/curr/*.x))
cargo run --manifest-path xdr-generator-rust/generator/Cargo.toml -- \
$(addprefix --input ,$(sort $(wildcard xdr/curr/*.x))) \
--output $@ \
--custom-default $(CUSTOM_DEFAULT_IMPL) \
--custom-str $(CUSTOM_STR_IMPL)
rustfmt $@
src/next/generated.rs: $(sort $(wildcard xdr/next/*.x))
cargo run --manifest-path xdr-generator-rust/generator/Cargo.toml -- \
$(addprefix --input ,$(sort $(wildcard xdr/next/*.x))) \
--output $@ \
--custom-default $(CUSTOM_DEFAULT_IMPL) \
--custom-str $(CUSTOM_STR_IMPL)
rustfmt $@
xdr/curr-version: $(wildcard .git/modules/xdr/curr/**/*) $(wildcard xdr/curr/*.x)
git submodule status -- xdr/curr | sed 's/^ *//g' | cut -f 1 -d " " | tr -d '\n' | tr -d '+' > xdr/curr-version
xdr/next-version: $(wildcard .git/modules/xdr/next/**/*) $(wildcard xdr/next/*.x)
git submodule status -- xdr/next | sed 's/^ *//g' | cut -f 1 -d " " | tr -d '\n' | tr -d '+' > xdr/next-version
xdr-json/curr: src/curr/generated.rs
mkdir -p xdr-json/curr
cargo run --features cli -- +curr types schema-files --out-dir xdr-json/curr
xdr-json/next: src/next/generated.rs
mkdir -p xdr-json/next
cargo run --features cli -- +next types schema-files --out-dir xdr-json/next
clean:
rm -f src/*/generated.rs
rm -f xdr/*-version
rm -fr xdr-json/curr
rm -fr xdr-json/next
cargo clean --quiet
fmt:
cargo fmt --all
publish:
cargo workspaces publish --all --force '*' --from-git --yes