-
Notifications
You must be signed in to change notification settings - Fork 137
/
Makefile
96 lines (84 loc) · 2.99 KB
/
Makefile
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
XDR_BASE_URL_CURR=https://github.com/stellar/stellar-xdr/raw/529d5176f24c73eeccfa5eba481d4e89c19b1181
XDR_BASE_LOCAL_CURR=xdr/curr
XDR_FILES_CURR= \
Stellar-SCP.x \
Stellar-ledger-entries.x \
Stellar-ledger.x \
Stellar-overlay.x \
Stellar-transaction.x \
Stellar-types.x \
Stellar-contract.x \
Stellar-contract-env-meta.x \
Stellar-contract-meta.x \
Stellar-contract-spec.x \
Stellar-contract-config-setting.x
XDR_FILES_LOCAL_CURR=$(addprefix xdr/curr/,$(XDR_FILES_CURR))
XDR_BASE_URL_NEXT=https://github.com/stellar/stellar-xdr/raw/8c88608d0a20b01873056a5ec13be245e1f2aa27
XDR_BASE_LOCAL_NEXT=xdr/next
XDR_FILES_NEXT= \
Stellar-SCP.x \
Stellar-ledger-entries.x \
Stellar-ledger.x \
Stellar-overlay.x \
Stellar-transaction.x \
Stellar-types.x \
Stellar-contract.x \
Stellar-contract-env-meta.x \
Stellar-contract-meta.x \
Stellar-contract-spec.x \
Stellar-contract-config-setting.x
XDR_FILES_LOCAL_NEXT=$(addprefix xdr/next/,$(XDR_FILES_NEXT))
XDRGEN_COMMIT=master
DTSXDR_COMMIT=master
all: generate
generate: src/generated/curr_generated.js types/curr.d.ts src/generated/next_generated.js types/next.d.ts
src/generated/curr_generated.js: $(XDR_FILES_LOCAL_CURR)
mkdir -p $(dir $@)
> $@
docker run -it --rm -v $$PWD:/wd -w /wd ruby:3.1 /bin/bash -c '\
gem install specific_install -v 0.3.8 && \
gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_COMMIT) && \
xdrgen --language javascript --namespace curr --output src/generated $^ \
'
src/generated/next_generated.js: $(XDR_FILES_LOCAL_NEXT)
mkdir -p $(dir $@)
> $@
docker run -it --rm -v $$PWD:/wd -w /wd ruby:3.1 /bin/bash -c '\
gem install specific_install -v 0.3.8 && \
gem specific_install https://github.com/stellar/xdrgen.git -b $(XDRGEN_COMMIT) && \
xdrgen --language javascript --namespace next --output src/generated $^ \
'
types/curr.d.ts: src/generated/curr_generated.js
docker run -it --rm -v $$PWD:/wd -w / --entrypoint /bin/sh node:alpine -c '\
apk add --update git && \
git clone --depth 1 https://github.com/stellar/dts-xdr -b $(DTSXDR_COMMIT) --single-branch && \
cd /dts-xdr && \
yarn install --network-concurrency 1 && \
OUT=/wd/$@ npx jscodeshift -t src/transform.js /wd/$< && \
cd /wd && \
yarn run prettier --write /wd/$@ \
'
types/next.d.ts: src/generated/next_generated.js
docker run -it --rm -v $$PWD:/wd -w / --entrypoint /bin/sh node:alpine -c '\
apk add --update git && \
git clone --depth 1 https://github.com/stellar/dts-xdr -b $(DTSXDR_COMMIT) --single-branch && \
cd /dts-xdr && \
yarn install --network-concurrency 1 && \
OUT=/wd/$@ npx jscodeshift -t src/transform.js /wd/$< && \
cd /wd && \
yarn run prettier --write /wd/$@ \
'
clean:
rm -f src/generated/*
$(XDR_FILES_LOCAL_CURR):
mkdir -p $(dir $@)
curl -L -o $@ $(XDR_BASE_URL_CURR)/$(notdir $@)
$(XDR_FILES_LOCAL_NEXT):
mkdir -p $(dir $@)
curl -L -o $@ $(XDR_BASE_URL_NEXT)/$(notdir $@)
reset-xdr:
rm -f xdr/*/*.x
rm -f src/generated/*.js
rm -f types/curr.d.ts
rm -f types/next.d.ts
$(MAKE) generate