-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (54 loc) · 1.58 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
ifdef CI
LINTFLAGS := --reporter github-actions-logging
FMTFLAGS := --lint --reporter github-actions-log
else
LINTFLAGS :=
FMTFLAGS :=
endif
PROJECT := Coder\ Desktop
XCPROJECT := Coder\ Desktop/Coder\ Desktop.xcodeproj
SCHEME := Coder\ Desktop
SWIFT_VERSION := 6.0
.PHONY: setup
setup: \
$(XCPROJECT) \
$(PROJECT)/VPNLib/vpn.pb.swift
$(XCPROJECT): $(PROJECT)/project.yml
cd $(PROJECT); \
SWIFT_VERSION=$(SWIFT_VERSION) xcodegen
$(PROJECT)/VPNLib/vpn.pb.swift: $(PROJECT)/VPNLib/vpn.proto
protoc --swift_opt=Visibility=public --swift_out=. 'Coder Desktop/VPNLib/vpn.proto'
.PHONY: fmt
fmt: ## Run Swift file formatter
swiftformat \
--swiftversion $(SWIFT_VERSION) \
$(FMTFLAGS) .
.PHONY: test
test: $(XCPROJECT) ## Run all tests
set -o pipefail && xcodebuild test \
-project $(XCPROJECT) \
-scheme $(SCHEME) \
-testPlan $(SCHEME) \
-skipPackagePluginValidation \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO | xcbeautify
.PHONY: lint
lint: ## Lint swift files
swiftlint \
--strict \
--quiet $(LINTFLAGS)
.PHONY: clean
clean: ## Clean Xcode project
xcodebuild clean \
-project $(XCPROJECT)
rm -rf $(XCPROJECT)
.PHONY: proto
proto: $(PROJECT)/VPNLib/vpn.pb.swift ## Generate Swift files from protobufs
.PHONY: help
help: ## Show this help
@echo "Specify a command. The choices are:"
@grep -hE '^[0-9a-zA-Z_-]+:.*?## .*$$' ${MAKEFILE_LIST} | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[0;36m%-20s\033[m %s\n", $$1, $$2}'
@echo ""
.PHONY: watch-gen
watch-gen: ## Generate Xcode project file and watch for changes
watchexec -w 'Coder Desktop/project.yml' make $(XCPROJECT)