-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
294 lines (245 loc) · 14.6 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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
proj_root = $(shell pwd)
# Dar dependencies
daml_finance_dir = .lib
# Daml models directory
models_src_dir = models
# Wallet views directory
wallet_views_dir = wallet-views
wallet_views_types_dir = $(wallet_views_dir)/types
wallet_views_ts_client_dir = $(wallet_views_dir)/typescript-client
wallet_views_ts_client_package_json = $(wallet_views_ts_client_dir)/package.json
# Wallet UI directory
wallet_ui_dir = wallet-ui
wallet_ui_package_json = $(wallet_ui_dir)/package.json
# Dar build outputs
build_dir = .build
assert_dar = $(build_dir)/synfini-assert.dar
trackable_holding_dar = $(build_dir)/synfini-trackable-holding.dar
trackable_settlement_dar = $(build_dir)/synfini-trackable-settlement.dar
account_onboarding_one_time_offer_interface_dar = $(build_dir)/synfini-account-onboarding-one-time-offer-interface.dar
account_onboarding_one_time_offer_dar = $(build_dir)/synfini-account-onboarding-one-time-offer.dar
account_onboarding_open_offer_interface_dar = $(build_dir)/synfini-account-onboarding-open-offer-interface.dar
account_onboarding_open_offer_dar = $(build_dir)/synfini-account-onboarding-open-offer.dar
issuer_onboarding_token_interface_dar = $(build_dir)/synfini-issuer-onboarding-token-interface.dar
issuer_onboarding_token_dar = $(build_dir)/synfini-issuer-onboarding-token.dar
issuer_onboarding_metadata_interface_dar = $(build_dir)/synfini-issuer-onboarding-metadata-interface.dar
issuer_onboarding_metadata_dar = $(build_dir)/synfini-issuer-onboarding-metadata.dar
operations_scripts_dar = $(build_dir)/synfini-operations.dar
minter_burner_interface_dar = $(build_dir)/synfini-issuer-onboarding-minter-burner-interface.dar
minter_burner_dar = $(build_dir)/synfini-issuer-onboarding-minter-burner.dar
settlement_one_time_offer_interface_dar = $(build_dir)/synfini-settlement-one-time-offer-interface.dar
settlement_one_time_offer_dar = $(build_dir)/synfini-settlement-one-time-offer.dar
settlement_open_offer_interface_dar = $(build_dir)/synfini-settlement-open-offer-interface.dar
settlement_open_offer_dar = $(build_dir)/synfini-settlement-open-offer.dar
settlement_helpers_dar = $(build_dir)/synfini-settlement-helpers.dar
instrument_metadata_dar = $(build_dir)/synfini-instrument-metadata.dar
instrument_metadata_interface_dar = $(build_dir)/synfini-instrument-metadata-interface.dar
wallet_views_types_dar = $(build_dir)/synfini-wallet-views-types.dar
# Codegen outputs
wallet_views_main_codegen = $(wallet_views_dir)/java/src/generated-main/java
wallet_views_test_codegen = $(wallet_views_dir)/java/src/generated-test/java
wallet_views_ts_client_codegen = $(wallet_views_dir)/typescript-client/daml.js
wallet_ui_codegen = $(wallet_ui_dir)/daml.js
# npm outputs
wallet_views_ts_client_node_modules = $(wallet_views_ts_client_dir)/node_modules
wallet_views_ts_client_build = $(wallet_views_ts_client_dir)/lib
wallet_ui_node_modules = $(wallet_ui_dir)/node_modules
# Conf file is used to configure dependencies on Daml Finance
# It has been copied from https://github.com/digital-asset/daml-finance/blob/8a4b826a683364f06f6dd1068a3d2f15f03ff6e6/docs/code-samples/tutorials-config/0.0.3.conf
$(daml_finance_dir): dependencies.conf
./get-dependencies.sh
$(assert_dar): $(shell ./find-daml-project-files.sh $(models_src_dir)/util/assert)
cd $(models_src_dir)/util/assert && daml build -o $(proj_root)/$(assert_dar)
$(trackable_holding_dar): $(daml_finance_dir) $(shell ./find-daml-project-files.sh $(models_src_dir)/trackable-holding/main)
cd $(models_src_dir)/trackable-holding/main && daml build -o $(proj_root)/$(trackable_holding_dar)
$(trackable_settlement_dar): $(daml_finance_dir) $(shell ./find-daml-project-files.sh $(models_src_dir)/trackable-settlement/main)
cd $(models_src_dir)/trackable-settlement/main && daml build -o $(proj_root)/$(trackable_settlement_dar)
## BEGIN settlement
$(settlement_one_time_offer_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/settlement/one-time-offer-interface)
cd $(models_src_dir)/settlement/one-time-offer-interface && daml build -o $(proj_root)/$(settlement_one_time_offer_interface_dar)
$(settlement_one_time_offer_dar): $(settlement_one_time_offer_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/settlement/one-time-offer-implementation)
cd $(models_src_dir)/settlement/one-time-offer-implementation && daml build -o $(proj_root)/$(settlement_one_time_offer_dar)
$(settlement_open_offer_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/settlement/open-offer-interface)
cd $(models_src_dir)/settlement/open-offer-interface && daml build -o $(proj_root)/$(settlement_open_offer_interface_dar)
$(settlement_open_offer_dar): $(settlement_open_offer_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/settlement/open-offer-implementation)
cd $(models_src_dir)/settlement/open-offer-implementation && daml build -o $(proj_root)/$(settlement_open_offer_dar)
$(settlement_helpers_dar): $(settlement_one_time_offer_interface_dar) \
$(minter_burner_interface_dar) \
$(assert_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/settlement/helpers)
cd $(models_src_dir)/settlement/helpers && daml build -o $(proj_root)/$(settlement_helpers_dar)
.PHONY: test-settlement
test-settlement: $(settlement_one_time_offer_dar) $(assert_dar)
cd $(models_src_dir)/settlement/test && daml test
## END settlement
## BEGIN onboarding
# Account
$(account_onboarding_one_time_offer_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/account-onboarding/one-time-offer-interface)
cd $(models_src_dir)/account-onboarding/one-time-offer-interface && daml build -o $(proj_root)/$(account_onboarding_one_time_offer_interface_dar)
$(account_onboarding_one_time_offer_dar): $(account_onboarding_one_time_offer_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/account-onboarding/one-time-offer-implementation)
cd $(models_src_dir)/account-onboarding/one-time-offer-implementation && daml build -o $(proj_root)/$(account_onboarding_one_time_offer_dar)
$(account_onboarding_open_offer_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/account-onboarding/open-offer-interface)
cd $(models_src_dir)/account-onboarding/open-offer-interface && daml build -o $(proj_root)/$(account_onboarding_open_offer_interface_dar)
$(account_onboarding_open_offer_dar): $(account_onboarding_open_offer_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/account-onboarding/open-offer-implementation)
cd $(models_src_dir)/account-onboarding/open-offer-implementation && daml build -o $(proj_root)/$(account_onboarding_open_offer_dar)
.PHONY: test-account-onboarding
test-account-onboarding: $(account_onboarding_open_offer_dar) $(assert_dar)
cd $(models_src_dir)/account-onboarding/test && daml test
# Issuer
$(issuer_onboarding_token_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/issuer-onboarding/instrument-token-interface)
cd $(models_src_dir)/issuer-onboarding/instrument-token-interface && daml build -o $(proj_root)/$(issuer_onboarding_token_interface_dar)
$(issuer_onboarding_token_dar): $(issuer_onboarding_token_interface_dar) \
$(assert_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/issuer-onboarding/instrument-token-implementation)
cd $(models_src_dir)/issuer-onboarding/instrument-token-implementation && daml build -o $(proj_root)/$(issuer_onboarding_token_dar)
$(issuer_onboarding_metadata_interface_dar): $(instrument_metadata_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/issuer-onboarding/metadata-interface)
cd $(models_src_dir)/issuer-onboarding/metadata-interface && daml build -o $(proj_root)/$(issuer_onboarding_metadata_interface_dar)
$(issuer_onboarding_metadata_dar): $(issuer_onboarding_metadata_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/issuer-onboarding/metadata-implementation)
cd $(models_src_dir)/issuer-onboarding/metadata-implementation && daml build -o $(proj_root)/$(issuer_onboarding_metadata_dar)
$(minter_burner_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/issuer-onboarding/minter-burner-interface)
cd $(models_src_dir)/issuer-onboarding/minter-burner-interface && daml build -o $(proj_root)/$(minter_burner_interface_dar)
$(minter_burner_dar): $(minter_burner_interface_dar) \
$(assert_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/issuer-onboarding/minter-burner-implementation)
cd $(models_src_dir)/issuer-onboarding/minter-burner-implementation && daml build -o $(proj_root)/$(minter_burner_dar)
.PHONY: test-issuer-onboarding
test-issuer-onboarding: $(issuer_onboarding_token_dar) $(minter_burner_dar) $(assert_dar)
cd $(models_src_dir)/issuer-onboarding/test && daml test
# Scripts
$(operations_scripts_dar): $(daml_finance_dir) \
$(account_onboarding_one_time_offer_dar) \
$(account_onboarding_open_offer_dar) \
$(issuer_onboarding_token_dar) \
$(issuer_onboarding_metadata_dar) \
$(minter_burner_dar) \
$(settlement_one_time_offer_dar) \
$(settlement_open_offer_dar) \
$(settlement_helpers_dar) \
$(trackable_holding_dar) \
$(trackable_settlement_dar) \
$(instrument_metadata_dar) \
$(shell ./find-daml-project-files.sh operations/main)
cd operations/main && daml build -o $(proj_root)/$(operations_scripts_dar)
.PHONY: install-operations
install-operations: $(operations_scripts_dar)
export DOPS_DAR=$(proj_root)/$(operations_scripts_dar) && cd operations && ./install.sh
## END onboarding
## BEGIN instrument metadata
$(instrument_metadata_interface_dar): $(daml_finance_dir) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/instrument-metadata/interface)
cd $(models_src_dir)/instrument-metadata/interface && daml build -o $(proj_root)/$(instrument_metadata_interface_dar)
$(instrument_metadata_dar): $(daml_finance_dir) \
$(instrument_metadata_interface_dar) \
$(shell ./find-daml-project-files.sh $(models_src_dir)/instrument-metadata/implementation)
cd $(models_src_dir)/instrument-metadata/implementation && daml build -o $(proj_root)/$(instrument_metadata_dar)
## END instrument metadata
## BEGIN wallet-views
$(wallet_views_types_dar): $(daml_finance_dir) \
$(account_onboarding_open_offer_interface_dar) \
$(issuer_onboarding_token_interface_dar) \
$(shell ./find-daml-project-files.sh $(wallet_views_types_dir))
cd $(wallet_views_types_dir) && daml build -o $(proj_root)/$(wallet_views_types_dar)
# Codegen - java
$(wallet_views_main_codegen): $(wallet_views_types_dar)
rm -rf $(wallet_views_main_codegen)
daml codegen java -o $(wallet_views_main_codegen) $(wallet_views_types_dar)
$(wallet_views_test_codegen): $(daml_finance_dir) \
$(account_onboarding_open_offer_dar) \
$(issuer_onboarding_token_dar)
rm -rf $(wallet_views_test_codegen)
daml codegen java \
-o $(wallet_views_test_codegen) \
$(daml_finance_dir)/daml-finance-account.dar \
$(daml_finance_dir)/daml-finance-holding.dar \
$(daml_finance_dir)/daml-finance-settlement.dar \
$(daml_finance_dir)/daml-finance-instrument-token.dar \
$(account_onboarding_open_offer_dar) \
$(issuer_onboarding_token_dar)
.PHONY: compile-wallet-views
compile-wallet-views: $(wallet_views_main_codegen)
cd wallet-views/java && mvn compile
.PHONY: build-wallet-views
build-wallet-views: $(wallet_views_main_codegen)
cd wallet-views/java && mvn install -Dmaven.test.skip=true
.PHONY: test-wallet-views
test-wallet-views: $(wallet_views_main_codegen) $(wallet_views_test_codegen)
cd wallet-views/java && mvn test ${TEST_WALLET_VIEWS_ARGS}
# Codegen - TypeScript
$(wallet_views_ts_client_codegen): $(wallet_views_ts_client_package_json) \
$(wallet_views_types_dar)
rm -rf $(wallet_views_ts_client_codegen)
daml codegen js \
$(daml_finance_dir)/daml-finance-interface-account.dar \
$(daml_finance_dir)/daml-finance-interface-holding.dar \
$(daml_finance_dir)/daml-finance-interface-instrument-base.dar \
$(daml_finance_dir)/daml-finance-interface-instrument-token.dar \
$(daml_finance_dir)/daml-finance-interface-settlement.dar \
$(daml_finance_dir)/daml-finance-interface-types-common.dar \
$(account_onboarding_open_offer_interface_dar) \
$(issuer_onboarding_token_interface_dar) \
$(wallet_views_types_dar) \
-o $(wallet_views_ts_client_codegen)
# TypeScript client
$(wallet_views_ts_client_node_modules): $(wallet_views_ts_client_package_json) $(wallet_views_ts_client_codegen)
cd $(wallet_views_ts_client_dir) && npm install
$(wallet_views_ts_client_build): $(wallet_views_ts_client_node_modules) \
$(shell ./find-ts-project-files.sh $(wallet_views_ts_client_dir))
cd $(wallet_views_ts_client_dir) && npm run build
.PHONY: build-wallet-views-ts-client
build-wallet-views-ts-client: $(wallet_views_ts_client_build)
.PHONY: test-wallet-views-ts-client
test-wallet-views-ts-client: install-operations compile-wallet-views $(wallet_views_ts_client_build)
cd $(wallet_views_ts_client_dir) && ./test.sh
## END wallet-views
## BEGIN wallet ui
$(wallet_ui_codegen): $(wallet_ui_package_json) \
$(daml_finance_dir) \
$(account_onboarding_open_offer_interface_dar) \
$(minter_burner_interface_dar) \
$(settlement_one_time_offer_interface_dar) \
$(settlement_open_offer_interface_dar) \
$(settlement_helpers_dar) \
$(instrument_metadata_interface_dar)
rm -rf $(wallet_ui_codegen)
daml codegen js \
$(account_onboarding_open_offer_interface_dar) \
$(minter_burner_interface_dar) \
$(settlement_one_time_offer_interface_dar) \
$(settlement_open_offer_interface_dar) \
$(settlement_helpers_dar) \
$(instrument_metadata_interface_dar) \
$(daml_finance_dir)/daml-finance-interface-types-common.dar \
$(daml_finance_dir)/daml-finance-interface-util.dar \
$(daml_finance_dir)/daml-finance-interface-holding.dar \
$(daml_finance_dir)/daml-finance-interface-settlement.dar \
$(daml_finance_dir)/daml-finance-interface-instrument-token.dar -o $(wallet_ui_codegen)
$(wallet_ui_node_modules): $(wallet_ui_codegen) $(wallet_ui_package_json) $(wallet_views_ts_client_codegen)
cd $(wallet_ui_dir) && npm install
.PHONY: build-wallet-ui
build-wallet-ui: $(wallet_ui_node_modules) $(wallet_views_ts_client_build)
cd $(wallet_ui_dir) && npm run build
.PHONY: start-wallet-ui
start-wallet-ui: $(wallet_ui_node_modules) $(wallet_views_ts_client_build)
cd $(wallet_ui_dir) && npm start
## END wallet ui
.PHONY: clean
clean:
./clean-daml-projects.sh
cd wallet-views/java && mvn clean
rm -rf $(wallet_views_main_codegen) $(wallet_views_test_codegen)
rm -rf $(wallet_views_ts_client_codegen) $(wallet_views_ts_client_node_modules) $(wallet_views_ts_client_build)
rm -rf $(wallet_ui_codegen) $(wallet_ui_node_modules) $(wallet_ui_dir)/build
rm -rf $(build_dir)
rm -rf $(daml_finance_dir)