forked from pointfreeco/swift-composable-architecture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
118 lines (106 loc) · 3.6 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
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
CONFIG = debug
PLATFORM = iOS
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iOS,iPhone \d\+ Pro [^M])
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,tvOS,TV)
PLATFORM_VISIONOS = visionOS Simulator,id=$(call udid_for,visionOS,Vision)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,watchOS,Watch)
TEST_RUNNER_CI = $(CI)
default: test-all
test-all: test-examples
$(MAKE) CONFIG=debug test-library
$(MAKE) CONFIG=release test-library
xcodebuild:
if test "$(PLATFORM)" = "iOS"; \
then xcodebuild $(COMMAND) \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_IOS)" \
-derivedDataPath ~/.derivedData/$(CONFIG); \
elif test "$(PLATFORM)" = "macOS"; \
then xcodebuild $(COMMAND) \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_MACOS)" \
-derivedDataPath ~/.derivedData/$(CONFIG); \
elif test "$(PLATFORM)" = "tvOS"; \
then xcodebuild $(COMMAND) \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_TVOS)" \
-derivedDataPath ~/.derivedData/$(CONFIG); \
elif test "$(PLATFORM)" = "watchOS"; \
then xcodebuild $(COMMAND) \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_WATCHOS)" \
-derivedDataPath ~/.derivedData/$(CONFIG); \
elif test "$(PLATFORM)" = "visionOS"; \
then xcodebuild $(COMMAND) \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_VISIONOS)" \
-derivedDataPath ~/.derivedData/$(CONFIG); \
elif test "$(PLATFORM)" = "macCatalyst"; \
then xcodebuild $(COMMAND) \
-skipMacroValidation \
-configuration $(CONFIG) \
-workspace .github/package.xcworkspace \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_MAC_CATALYST)" \
-derivedDataPath ~/.derivedData/$(CONFIG); \
else exit 1; \
fi;
build-for-library-evolution:
swift build \
-c release \
--target ComposableArchitecture \
-Xswiftc -emit-module-interface \
-Xswiftc -enable-library-evolution
DOC_WARNINGS = $(shell xcodebuild clean docbuild \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_MACOS)" \
-quiet \
2>&1 \
| grep "couldn't be resolved to known documentation" \
| sed 's|$(PWD)|.|g' \
| tr '\n' '\1')
test-docs:
@test "$(DOC_WARNINGS)" = "" \
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
&& exit 1)
test-example:
xcodebuild test \
-skipMacroValidation \
-scheme "$(SCHEME)" \
-destination platform="$(PLATFORM_IOS)" \
-derivedDataPath ~/.derivedData
test-integration:
xcodebuild test \
-skipMacroValidation \
-scheme "Integration" \
-destination platform="$(PLATFORM_IOS)"
benchmark:
swift run --configuration release \
swift-composable-architecture-benchmark
format:
find . \
-path '*/Documentation.docc' -prune -o \
-name '*.swift' \
-not -path '*/.*' -print0 \
| xargs -0 swift format --ignore-unparsable-files --in-place
.PHONY: format test-all test-swift test-workspace
define udid_for
$(shell xcrun simctl list devices available '$(1)' | grep '$(2)' | sort -r | head -1 | awk -F '[()]' '{ print $$(NF-3) }')
endef