This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (65 loc) · 1.93 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
# Facts
GIT_REPO_TOPLEVEL := $(shell git rev-parse --show-toplevel)
# Apple Platform Destinations
DESTINATION_PLATFORM_IOS_SIMULATOR = "platform=iOS Simulator,name=iPhone 16 Pro Max"
DESTINATION_PLATFORM_WATCHOS_SIMULATOR = "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)"
# Run Results
IOS_RUN_RESULT_BUNDLE_PATH="$(GIT_REPO_TOPLEVEL)/xcresults/ios_result.xcresult"
WATCHOS_RUN_RESULT_BUNDLE_PATH="$(GIT_REPO_TOPLEVEL)/xcresults/watchos_result.xcresult"
# Formatting
SWIFT_FORMAT_BIN := swift format
SWIFT_FORMAT_CONFIG_FILE := $(GIT_REPO_TOPLEVEL)/.swift-format.json
FORMAT_PATHS := "$(GIT_REPO_TOPLEVEL)"
# Tasks
.PHONY: default
default: test-all-clean
.PHONY: test-all-clean
test-all-clean: clean-all test-xcode
.PHONY: clean-all
clean-all: xcode-result-clean xcode-clean
.PHONY: xcode-result-clean
xcode-result-clean:
rm -rf "$(GIT_REPO_TOPLEVEL)/xcresults"
.PHONY: xcode-clean
xcode-clean:
xcodebuild \
clean \
-project Kasa.xcodeproj \
-scheme 'KasaApp' \
-destination "generic/platform=iOS" \
-destination "generic/platform=iOS Simulator"
.PHONY: test-xcode
test-xcode: test-xcode-ios test-xcode-watchos
.PHONY: test-xcode-ios
test-xcode-ios:
xcodebuild \
-project Kasa.xcodeproj \
-scheme 'KasaApp' \
-destination $(DESTINATION_PLATFORM_IOS_SIMULATOR) \
-resultBundlePath $(IOS_RUN_RESULT_BUNDLE_PATH) \
-quiet
.PHONY: test-xcode-watchos
test-xcode-watchos:
xcodebuild \
-project Kasa.xcodeproj \
-scheme 'Kasa WatchKit App' \
-destination $(DESTINATION_PLATFORM_WATCHOS_SIMULATOR) \
-resultBundlePath $(WATCHOS_RUN_RESULT_BUNDLE_PATH) \
-quiet
.PHONY: format
format:
$(SWIFT_FORMAT_BIN) \
--configuration $(SWIFT_FORMAT_CONFIG_FILE) \
--ignore-unparsable-files \
--in-place \
--parallel \
--recursive \
$(FORMAT_PATHS)
.PHONY: lint
lint:
$(SWIFT_FORMAT_BIN) lint \
--configuration $(SWIFT_FORMAT_CONFIG_FILE) \
--ignore-unparsable-files \
--parallel \
--recursive \
$(FORMAT_PATHS)