-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (99 loc) · 3.53 KB
/
Copy pathMakefile
File metadata and controls
122 lines (99 loc) · 3.53 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
ARCH ?= arm64
APP_VERSION ?= 0.0.5
VERSION_NUM := $(patsubst v%,%,$(APP_VERSION))
## ----------------------------------------------------------------
## build
## ----------------------------------------------------------------
.PHONY: build-debug
build-debug:
xcodebuild -project WinPin.xcodeproj \
-scheme WinPin \
-configuration Debug \
-derivedDataPath build/DerivedData \
build
.PHONY: build-app
build-app:
@mkdir -p .build/$(ARCH)
xcodebuild -project WinPin.xcodeproj \
-scheme WinPin \
-configuration Release \
-destination "generic/platform=macOS" \
ARCHS="$(ARCH)" \
ONLY_ACTIVE_ARCH=NO \
MARKETING_VERSION="$(VERSION_NUM)" \
CURRENT_PROJECT_VERSION="$(VERSION_NUM)" \
-derivedDataPath "build/DerivedData-$(ARCH)" \
clean build
rm -rf .build/$(ARCH)/WinPin.app
cp -R build/DerivedData-$(ARCH)/Build/Products/Release/WinPin.app .build/$(ARCH)/WinPin.app
.PHONY: build-all-arch
build-all-arch:
$(MAKE) build-app ARCH=arm64 APP_VERSION=$(APP_VERSION)
$(MAKE) build-app ARCH=x86_64 APP_VERSION=$(APP_VERSION)
## ----------------------------------------------------------------
## goreleaser
## ----------------------------------------------------------------
.PHONY: goreleaser-prep
goreleaser-prep:
@mkdir -p .goreleaser/WinPin_arm64 .goreleaser/WinPin_x86_64
rm -rf .goreleaser/WinPin_arm64/WinPin.app .goreleaser/WinPin_x86_64/WinPin.app
cp -R .build/arm64/WinPin.app .goreleaser/WinPin_arm64/WinPin.app
cp -R .build/x86_64/WinPin.app .goreleaser/WinPin_x86_64/WinPin.app
.PHONY: goreleaser-dryrun
goreleaser-dryrun:
GORELEASER_CURRENT_TAG=$(APP_VERSION) goreleaser release --snapshot --clean --skip=publish,announce,validate
#; GoReleaser emits unacceptable format of cask file (at least for the order of 'on_macos > {on_intel,on_arm}' block),
#; so we don't use it.
#;
# .PHONY: goreleaser-release
# goreleaser-release:
# GITHUB_TOKEN=$(gh auth token) GORELEASER_CURRENT_TAG=$(APP_VERSION) goreleaser release --clean --snapshot --verbose
## ----------------------------------------------------------------
## test
## ----------------------------------------------------------------
.PHONY: test
test:
xcodebuild -project WinPin.xcodeproj \
-scheme WinPin \
-configuration Debug \
-destination "platform=macOS" \
-derivedDataPath build/DerivedData \
test
## ----------------------------------------------------------------
## lint
## ----------------------------------------------------------------
.PHONY: lint-format
lint-format:
swiftformat --version
swiftformat --lint --reporter github-actions-log WinPin WinPinTests
swiftlint --version
swiftlint lint --strict --cache-path .build/swiftlint-cache WinPin WinPinTests
.PHONY: lint-unused
lint-unused:
periphery version
periphery scan --project WinPin.xcodeproj --schemes WinPin
.PHONY: lint
lint: lint-unused lint-format
## ----------------------------------------------------------------
## fix
## ----------------------------------------------------------------
.PHONY: lint-fix
lint-fix:
swiftlint lint --strict --fix --cache-path .build/swiftlint-cache WinPin WinPinTests
.PHONY: format
format:
swiftformat WinPin WinPinTests
.PHONY: fix
fix: lint-fix format
## ----------------------------------------------------------------
## run & restart
## ----------------------------------------------------------------
.PHONY: restart
restart:
./scripts/restart.sh
## ----------------------------------------------------------------
## clean
## ----------------------------------------------------------------
.PHONY: clean
clean:
rm -rf .build build dist .goreleaser