-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
214 lines (155 loc) · 5.27 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
# project paths
CORE := Disunity.Core
EDITOR := Disunity.Editor
PRELOADER := Disunity.Preloader
RUNTIME := Disunity.Runtime
MANAGEMENT := Disunity.Management
MANAGEMENT_STARTUP := $(MANAGEMENT).Startup
MANAGER_UI := $(MANAGEMENT).Ui
CLI := $(MANAGEMENT).Cli
CLIENT := Disunity.Client
STORE := Disunity.Store
# makefile boilerplate
DIR := ${CURDIR}
TAG ?= ${TRAVIS_TAG}
SRC_DIR := src
PAKET_ARGS ?= $(ARGS)
UNITY_EDITOR ?= /mnt/c/Program\ Files/Unity/Editor/Unity.exe
COMPOSE = docker-compose --project-directory ${DIR} -f docker/docker-compose.yml
DOTNET_ARGS = -p:SolutionDir=$(DIR)
DOTNET :=
ifeq (, $(shell which dotnet-nix 2>/dev/null))
DOTNET +=dotnet
else
DOTNET +=dotnet-nix
endif
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG += WIN32
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG +=$(strip LINUX)
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG +=$(strip OSX)
endif
endif
OSFLAG := $(strip $(OSFLAG))
PAKET :=
ifeq ($(OSFLAG),LINUX)
PAKET += mono .paket/paket.exe
else
PAKET += .paket/paket.exe
endif
PAKET := $(strip $(PAKET))
# Paket commands
.PHONY: paket install-deps update-deps restore refresh-paket
paket:
$(PAKET) $(PAKET_ARGS)
restore:
$(DOTNET) restore $(ARGS)
paket-refresh: clean clean-paket-files install-deps
paket-hard-refresh: PAKET_ARGS := clear-cache
paket-hard-refresh: clean clean-paket-files paket-clear-cache update-deps
clean-paket-files:
rm -rf packages paket-files
paket-clear-cache:
$(PAKET) clear-cache
install-deps: PAKET_ARGS := install $(ARGS)
update-deps: PAKET_ARGS := update $(ARGS)
install-deps update-deps: paket restore
paket-files: paket.dependencies */paket.references
$(PAKET) update
# Clean commands
.PHONY: clean clean-release %/clean %/clean-publish
clean-release:
rm -rf ./Release
clean: clean-release
rm -fr **/obj **/bin **/publish **/nupkg
%/clean: %
rm -rf $^/obj $^/bin $^/publish
# Build commands
build: build-core build-editor build-preloader build-runtime build-management build-management-ui build-cli build-store build-client
# dotnet build $(DOTNET_ARGS) $(ARGS)
build-core: $(CORE)/bin
build-editor: $(EDITOR)/bin
build-preloader: $(PRELOADER)/bin
build-runtime: $(RUNTIME)/bin
build-management: $(MANAGEMENT)/bin
build-management-ui: $(MANAGER_UI)/bin
build-cli: $(CLI)/bin
build-store: $(STORE)/bin
build-client: $(CLIENT)/bin
# Publish commands
$(CORE)/publish $(RUNTIME)/publish $(PRELOADER)/publish: ARGS += -f net471
$(STORE)/publish: SRC_DIR := .
$(MANAGER_UI)/publish: SRC_DIR := .
%/bin: COMMAND := build
%/publish: COMMAND := publish
%/bin: %/clean-bin
%/publish: %/clean-publish
# release commands
release-all: release-core release-client release-cli release-management release-manager-ui \
release-editor release-distro
release-cli: $(CLI)/publish
release-client: $(CLIENT)/publish
release-core: $(CORE)/publish
release-editor: $(EDITOR)/publish
release-management: $(MANAGEMENT)/publish
release-manager-ui: $(MANAGER_UI)/publish
release-%: scripts/release-%.sh clean-release
./scripts/$@.sh $(ARGS)
release-distro: clean-release $(CORE)/publish $(RUNTIME)/publish $(PRELOADER)/publish
./scripts/release-distro.sh $(TAG)
release-example-mod: WINDIR = $(shell wslpath -w -a $(DIR))
release-example-mod: release-editor
./scripts/release-example-mod.sh
# $(UNITY_EDITOR) -batchmode -nographics -projectPath "$(WINDIR)\ExampleMod" -exportPackage "Assets" "$(WINDIR)\Release\ExampleMod.unitypackage" -quit
travis-release:
$(COMPOSE) -f docker/docker-compose.travis.yml build release
$(COMPOSE) -f docker/docker-compose.travis.yml run release
# Store commands
store-run:
# TODO need some way to set the db ip
$(DOTNET) run -p Disunity.Store/Disunity.Store.csproj
store-build:
$(COMPOSE) build web $(ARGS)
store-up: store-build
$(COMPOSE) up db cache frontend web
store-up-quick:
$(COMPOSE) build web
$(COMPOSE) up db cache frontend web
store-db:
$(DOTNET) ef --project $(STORE) $(ARGS)
store-db-migrate:
$(DOTNET) ef --project $(STORE) migrations add -o Entities/Migrations $(ARGS)
store-db-init:
$(DOTNET) ef --project $(STORE) migrations add Initial -o Entities/Migrations
store-db-drop:
docker rm --project-directory $(shell pwd) -f store_db_1
docker volume rm store_db-data
# management db commands
management-db-drop:
$(DOTNET) ef --project $(MANAGEMENT) --startup-project $(MANAGEMENT_STARTUP) database drop -f
management-db-migrate:
$(DOTNET) ef --project $(MANAGEMENT) --startup-project $(MANAGEMENT_STARTUP) database update
managment-db-migration: MIGRATION ?= Initial
managment-db-migration:
$(DOTNET) ef --project $(MANAGEMENT) --startup-project $(MANAGEMENT_STARTUP) migrations add -o src/Data/Migrations $(MIGRATION)
management-db-clean-migrations:
rm -rf $(MANAGEMENT)/src/Data/Migrations
management-db-reset: management-db-clean-migrations management-db-drop managment-db-migration management-db-migrate
# Db commands
db-up:
$(COMPOSE) up db cache
test:
$(COMPOSE) build release
$(COMPOSE) run --entrypoint /app/Disunity.Tests/start.sh release
watcher:
docker-volume-watcher -v --debounce 0.1 disunitystore_* ${DIR}/*
# Secondary expansion commands
.SECONDEXPANSION:
%/bin %/publish: paket-files $$(shell find %/$$(SRC_DIR) -type f -not -path "*/obj/*" -not -path "*/bin/*") $$(shell find % -type f -name *.csproj)
$(DOTNET) $(COMMAND) $(DOTNET_ARGS) $(shell dirname $@) $(ARGS)
touch $@