-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
63 lines (51 loc) · 1.76 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
.DEFAULT_GOAL := test
SOURCERY=$(PWD)/.build/release/sourcery
## install dependencies
install:
brew bundle
## build the project and run the tests
test: sourcery
cd Tests; $(SOURCERY)
swift test
swiftlint
## run sourcery to generate code from the root templates
sourcery: $(SOURCERY)
$(SOURCERY)
## run Sourcery in watch mode for live preview of templates
watch: $(SOURCERY)
$(SOURCERY) --watch
## clean the project build artifacts
clean:
swift package clean
## generate an Xcode project without the custom build steps like Sourcery and Swiftlint
xcode: sourcery
swift package generate-xcodeproj
open AutoJSONSerialization.xcodeproj
XCODEFLAGS=-project 'AutoJSONSerialization.xcodeproj' \
-scheme 'AutoJSONSerialization' \
-enableCodeCoverage YES
## setup the environment and run the tests using the Xcode generated project to generate code coverage
ci: install test
swift package generate-xcodeproj
xcodebuild $(XCODEFLAGS) test
$(SOURCERY):
swift build -c release
.PHONY: install sourcery watch test clean xcode ci
.PHONY: help
# taken from this gist https://gist.github.com/rcmachado/af3db315e31383502660
## Show this help message.
help:
$(info Usage: make [target...])
$(info Available targets)
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
nb = sub( /^## /, "", helpMsg ); \
if(nb == 0) { \
helpMsg = $$0; \
nb = sub( /^[^:]*:.* ## /, "", helpMsg ); \
} \
if (nb) \
print $$1 "\t" helpMsg; \
} \
{ helpMsg = $$0 }' \
$(MAKEFILE_LIST) | column -ts $$'\t' | \
grep --color '^[^ ]*'