-
-
Notifications
You must be signed in to change notification settings - Fork 708
Expand file tree
/
Copy pathMakefile
More file actions
240 lines (188 loc) · 5.94 KB
/
Makefile
File metadata and controls
240 lines (188 loc) · 5.94 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
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
SHELL := /bin/bash
.PHONY: help ios update tvos lite ci update-cheatdb update-skin-catalog
RUBY := $(shell command -v ruby 2>/dev/null)
HOMEBREW := $(shell command -v brew 2>/dev/null)
BUNDLER := $(shell command -v bundle 2>/dev/null)
default: help
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
# COLORS
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
## ----- Helper functions ------
# Helper target for declaring an external executable as a recipe dependency.
# For example,
# `my_target: | _program_awk`
# will fail before running the target named `my_target` if the command `awk` is
# not found on the system path.
_program_%: FORCE
@_=$(or $(shell which $* 2> /dev/null),$(error `$*` command not found. Please install `$*` and try again))
# Helper target for declaring required environment variables.
#
# For example,
# `my_target`: | _var_PARAMETER`
#
# will fail before running `my_target` if the variable `PARAMETER` is not declared.
_var_%: FORCE
@_=$(or $($*),$(error `$*` is a required parameter))
_tag: | _var_VERSION
make --no-print-directory -B README.md
git commit -am "Tagging release $(VERSION)"
git tag -a $(VERSION) $(if $(NOTES),-m '$(NOTES)',-m $(VERSION))
.PHONY: _tag
_push: | _var_VERSION
git push origin $(VERSION)
git push origin master
.PHONY: _push
## ------ Commmands -----------
TARGET_MAX_CHAR_NUM=20
## Show help
help:
@echo ''
@echo 'Usage:'
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^## (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")-1); \
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \
printf " ${YELLOW}%-$(TARGET_MAX_CHAR_NUM)s${RESET} ${GREEN}%s${RESET}\n", helpCommand, helpMessage; \
} \
} \
{ lastLine = $$0 }' \
$(MAKEFILE_LIST)
## Install dependencies.
setup: \
pre_setup \
check_for_ruby \
check_for_homebrew \
update_homebrew \
install_bundler_gem \
install_ruby_gems
pull_request: \
test \
codecov_upload \
danger
pre_setup:
$(info Project setup…)
check_for_ruby:
$(info Checking for Ruby…)
ifeq ($(RUBY),)
$(error Ruby is not installed.)
endif
check_for_homebrew:
$(info Checking for Homebrew…)
ifeq ($(HOMEBREW),)
$(error Homebrew is not installed)
endif
update_homebrew:
$(info Updating Homebrew…)
brew update
install_swift_lint:
$(info Install swiftlint…)
brew unlink swiftlint || true
brew install swiftlint
brew link --overwrite swiftlint
install_bundler_gem:
$(info Checking and installing bundler…)
ifeq ($(BUNDLER),)
gem install bundler -v '~> 1.17'
else
gem update bundler '~> 1.17'
endif
install_ruby_gems:
$(info Installing Ruby gems…)
bundle install
pull:
$(info Pulling new commits…)
git stash push || true
git pull
git stash pop || true
## -- Source Code Tasks --
## Pull upstream and update 3rd party frameworks
update: pull submodules install_ruby_gems
submodules:
$(info Updating submodules…)
git submodule update --init --recursive
## -- QA Task Runners --
codecov_upload:
curl -s https://codecov.io/bash | bash
danger:
bundle exec danger
## -- Testing --
## Run test on all targets
test:
bundle exec fastlane test
## -- Building --
## Fast CI simulator build (no cores, no code signing)
lite:
$(info Building Provenance-CI for iOS Simulator…)
xcodebuild build \
-workspace Provenance.xcworkspace \
-scheme "Provenance-CI" \
-destination "generic/platform=iOS Simulator" \
-skipPackagePluginValidation \
-skipMacroValidation \
CODE_SIGNING_ALLOWED=NO \
| xcbeautify || xcodebuild build \
-workspace Provenance.xcworkspace \
-scheme "Provenance-CI" \
-destination "generic/platform=iOS Simulator" \
-skipPackagePluginValidation \
-skipMacroValidation \
CODE_SIGNING_ALLOWED=NO
## Alias for lite (CI build)
ci: lite
developer_ios:
$(info Building iOS for Developer profile…)
bundle exec fastlane build_developer scheme:Provenance-Release
developer_tvos:
$(info Building tvOS for Developer profile…)
bundle exec fastlane build_developer scheme:ProvenanceTV-Release
## Update & build for iOS
ios: | update developer_ios
## Update & build for tvOS
tvos: | update developer_tvos
## Open the workspace
open:
open Provenance.xcworkspace
## Generate libretro cheat database if missing (for builds/tests)
ensure-cheatdb:
@PVLookup/Scripts/generate_cheatdb_if_needed.sh
## Force-regenerate libretro cheat database from libretro-database repo
## Uses MD5 cross-referencing from DAT files for ROM hash lookup support.
update-cheatdb:
$(info Generating libretro cheat database…)
rm -rf /tmp/libretro-database
rm -f PVLookup/Sources/LibretroCheatDB/Resources/libretro_cheats.sqlite.zip
git clone --depth=1 https://github.com/libretro/libretro-database.git /tmp/libretro-database
python3 Scripts/generate_cheatdb.py /tmp/libretro-database/cht/ \
--dat-dir /tmp/libretro-database \
--output PVLookup/Sources/LibretroCheatDB/Resources/libretro_cheats.sqlite
rm -rf /tmp/libretro-database
## Scrape community Delta skin sites and generate catalog.json
update-skin-catalog:
$(info Scraping Delta skin catalogs…)
@if [ ! -d /tmp/scraper-venv ]; then \
python3 -m venv /tmp/scraper-venv; \
fi
/tmp/scraper-venv/bin/pip install -q -r Scripts/requirements-scraper.txt
/tmp/scraper-venv/bin/python3 Scripts/scrape_skin_catalog.py \
--source all \
--skip-validation \
--output Scripts/catalog_seed.json
cp Scripts/catalog_seed.json PVUI/Sources/PVUIBase/Resources/catalog_seed.json
## tag and release to github
release: | _var_VERSION
@if ! git diff --quiet HEAD; then \
( $(call _error,refusing to release with uncommitted changes) ; exit 1 ); \
fi
test
package
make --no-print-directory _tag VERSION=$(VERSION)
make --no-print-directory _push VERSION=$(VERSION)