-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
157 lines (125 loc) · 5.28 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
# configure path to unity
UNITY_EDITOR_VERSION := 2021.3.13f1
ifeq ($(OS),Windows_NT)
UNITY_EDITOR := C:\Program Files\Unity\Hub\Editor\$(UNITY_EDITOR_VERSION)\Editor\Unity.exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
UNITY_EDITOR := /Applications/Unity/Hub/Editor/$(UNITY_EDITOR_VERSION)/Unity.app/Contents/MacOS/Unity
else
# Check if running under WSL
ifneq ($(shell grep -i microsoft /proc/version),)
UNITY_EDITOR := /mnt/c/Program\ Files/Unity/Hub/Editor/$(UNITY_EDITOR_VERSION)/Editor/Unity.exe
else
UNITY_EDITOR := /Applications/Unity/Hub/Editor/$(UNITY_EDITOR_VERSION)/Unity.app/Contents/Linux/Unity
endif
endif
endif
# srcs
COG_SERVICES_SRC := $(shell find contracts/lib/cog/services -name '*.go')
CORE_GRAPHQL_SRC := $(shell find core/src -name '*.graphql')
CORE_TS_SRC := $(shell find core/src -maxdepth 1 -name '*.ts')
# paths to tools
NODE := node
NPM := npm
all: node_modules contracts/lib/cog/services/bin/ds-node cli core/dist/core.js frontend/public/ds-unity/Build/ds-unity.wasm
map:
$(UNITY_EDITOR) -batchmode -quit -projectPath ./map -executeMethod BuildScript.GitHubBuild -buildTarget WebGL -logFile -
debugmap:
$(UNITY_EDITOR) -batchmode -quit -projectPath ./map -executeMethod BuildScript.DevBuild -buildTarget WebGL -logFile -
dev: all
$(NODE) .devstartup.js
live: all
$(NODE) .livestartup.js
contracts/src/maps/performance-test:
$(NODE) ./scripts/generate-perf-test-map
compose: frontend/public/ds-unity/Build/ds-unity.wasm
docker compose up --build
contracts/out/Actions.sol/Actions.json:
(cd contracts && forge build)
contracts:
(cd contracts && forge build)
core: core/dist/core.js
core/dist/core.js: $(CORE_GRAPHQL_SRC) $(CORE_TS_SRC) contracts/out/Actions.sol/Actions.json
(cd core && npm run build)
frontend/public/ds-unity/Build/ds-unity.wasm:
$(MAKE) map
node_modules: package.json package-lock.json
$(NPM) ci
touch $@
contracts/lib/cog/services/bin/ds-node: contracts/lib/cog/services/Makefile $(COG_SERVICES_SRC)
$(MAKE) -C contracts/lib/cog/services bin/ds-node
cli: node_modules core/dist/core.js
(cd cli && $(NPM) run build && $(NPM) install -g --force .)
publish: cli
(cd cli && $(NPM) version patch && rm -rf /tmp/ds-cli && mkdir -p /tmp/ds-cli && cp -r dist /tmp/ds-cli/dist && jq 'del(.dependencies, .devDependencies)' package.json > /tmp/ds-cli/package.json && cd /tmp/ds-cli && $(NPM) publish)
deployments/garnet/contracts.json:
(cd contracts && forge script script/Deploy.sol:GameDeployer \
--broadcast \
--rpc-url "https://rpc.garnetchain.com" \
--ledger --mnemonic-indexes 0 --sender 0xfE4Aab053FED3cFbB7e5f6434e1585b4F17CC207 \
-vvv)
cp contracts/out/latest.json $@
deployments/garnet/contracts.yaml: deployments/garnet/contracts.json
./scripts/genvalues deployments/garnet/contracts.json > $@
deployments/garnet/version.json:
node ./scripts/get-latest-images.mjs -o $@
deploy-garnet: deployments/garnet/contracts.yaml deployments/garnet/version.json
bw login --check
helm upgrade --force --install --wait --timeout 30m --history-max 5 \
ds ./chart $(EXTRA_ARGS) -n garnet \
--create-namespace\
--values ./deployments/garnet/values.yaml \
--values ./deployments/garnet/version.json \
--values ./deployments/garnet/contracts.yaml \
--set sequencer.privateKey=$(shell bw get password 647bd598-f9e4-410a-a7cc-b16100fac3fb | sed s/,/\\\\\\\\,/g)
kubectl get po -n garnet
clean-garnet:
rm -f deployments/garnet/contracts.json
rm -f deployments/garnet/contracts.yaml
rm -f deployments/garnet/version.json
deployments/redstone/contracts.json:
(cd contracts && forge script script/Deploy.sol:GameDeployer \
--broadcast \
--rpc-url "https://rpc.redstonechain.com" \
--ledger --mnemonic-indexes 0 --sender 0xfE4Aab053FED3cFbB7e5f6434e1585b4F17CC207 \
-vvv)
cp contracts/out/latest.json $@
deployments/redstone/contracts.yaml: deployments/redstone/contracts.json
./scripts/genvalues deployments/redstone/contracts.json > $@
deployments/redstone/version.json:
node ./scripts/get-latest-images.mjs -o $@
deploy-redstone: deployments/redstone/contracts.yaml deployments/redstone/version.json
bw login --check
helm upgrade --force --install --wait --timeout 30m --history-max 5 \
ds ./chart $(EXTRA_ARGS) -n redstone \
--create-namespace\
--values ./deployments/redstone/values.yaml \
--values ./deployments/redstone/version.json \
--values ./deployments/redstone/contracts.yaml \
--set sequencer.privateKey=$(shell bw get password 1d719381-cceb-46f7-bc2f-b15c0100f285 | sed s/,/\\\\\\\\,/g)
kubectl get po -n redstone
clean-redstone:
rm -f deployments/redstone/contracts.json
rm -f deployments/redstone/contracts.yaml
rm -f deployments/redstone/version.json
clean:
rm -rf cli/dist
rm -rf cli/node_modules
rm -f contracts/lib/cog/services/bin/ds-node
rm -rf contracts/out
rm -rf contracts/broadcast
rm -rf contracts/cache
rm -rf core/dist
rm -rf core/src/gql
rm -rf core/src/abi
rm -rf core/node_modules
rm -f frontend/public/ds-unity/Build/ds-unity.wasm
rm -rf frontend/public/ds-unity
rm -rf frontend/dist
rm -rf frontend/node_modules
rm -rf node_modules
rm -rf contracts/src/maps/performance-test
$(MAKE) -C contracts/lib/cog/services clean
.PHONY: all clean dev map compose debugmap cli contracts release
.SILENT: contracts/lib/cog/services/bin/ds-node frontend/public/ds-unity/Build/ds-unity.wasm