forked from stephan-tolksdorf/STULabel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
125 lines (92 loc) · 4.36 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
119
120
121
122
# This Makefile is used for CI builds and tests.
BUILD_DIR := build
DERIVED_DATA_DIR := $(BUILD_DIR)/derived_data
RESULTS_DIR := $(BUILD_DIR)/results
CONFIGURATION := Debug
XCODE_BUILD_OPTIONS := -configuration $(CONFIGURATION)
XCODE_BUILD_SETTINGS := ONLY_ACTIVE_ARCH=NO
ifdef LTO
XCODE_BUILD_SETTINGS += LLVM_LTO=$(LTO)
endif
ASAN := YES
SKIP_SLOW_TESTS := true
IOS11_VERSION := 11.4
XCPRETTY_PATH := $(shell command -v xcpretty 2> /dev/null)
XCPRETTY :=
ifdef XCPRETTY_PATH
XCPRETTY := | xcpretty -c
ifeq ($(TRAVIS),true)
XCPRETTY += -f `xcpretty-travis-formatter`
endif
endif
XCODEBUILD := set -o pipefail && $(shell command -v xcodebuild) \
-derivedDataPath $(DERIVED_DATA_DIR) \
$(XCODE_BUILD_OPTIONS)
RESULTBUNDLEPATH = -resultBundlePath $(BUILD_DIR)/results/$@_$(shell date +%Y-%m-%d_%H_%M_%S)
# The order determines the order in the HTML report.
TEST_RESULT_PATHS = $(wildcard $(BUILD_DIR)/results/test-ios12*) \
$(wildcard $(BUILD_DIR)/results/test-ios11*) \
$(wildcard $(BUILD_DIR)/results/test-ios10*) \
$(wildcard $(BUILD_DIR)/results/test-ios9*)
XCODEBUILD_STATIC_FOR_TEST = $(XCODEBUILD) $(RESULTBUNDLEPATH) -scheme "STULabel static" \
-enableAddressSanitizer $(ASAN)
SKIP_TESTING :=
ifeq ($(SKIP_SLOW_TESTS),true)
SKIP_TESTING := -skip-testing:AllTests/NSStringRefTests/testGraphemeClusterBreakFinding \
-skip-testing:AllTests/ShapedStringTests/testCTTypesetterThreadSafety
endif
XCODEBUILD_TEST_WITHOUT_BUILDING = \
$(XCODEBUILD_STATIC_FOR_TEST) -destination $($@_DESTINATION) \
test-without-building $(SKIP_TESTING) $(XCPRETTY)
XCODEBUILD_TEST_ALL_WITHOUT_BUILDING = \
$(XCODEBUILD_STATIC_FOR_TEST) -destination $($@_DESTINATION) \
test-without-building $(XCPRETTY)
build: build-for-testing build-demo
build-for-testing:
$(XCODEBUILD_STATIC_FOR_TEST) -destination 'generic/platform=iOS Simulator' \
build-for-testing $(XCODE_BUILD_SETTINGS) $(XCPRETTY)
build-demo:
$(XCODEBUILD) $(RESULTBUNDLEPATH) -scheme "Demo" -destination 'generic/platform=iOS' \
build $(XCODE_BUILD_SETTINGS) $(XCPRETTY)
clean:
$(XCODEBUILD) -scheme "STULabel static" clean $(XCPRETTY)
$(XCODEBUILD) -scheme "Demo" clean $(XCPRETTY)
test: test-ios12 test-ios11 test-ios10 test-ios9
test-ios12: test-ios12-ipad-pro-11 test-ios12-iphone-xs-max
test-ios11: test-ios11-ipad-pro-10_5 test-ios11-iphone-x
test-ios10: test-ios10-ipad-pro-9_7 test-ios10-iphone-7-plus
test-ios9: test-ios9-iphone-6s test-ios9-iphone-6s-plus test-ios9-ipad-2
generate-test-report:
mkdir -p $(BUILD_DIR)/results/html-test-report
xchtmlreport -j $(foreach dir,$(TEST_RESULT_PATHS),-r $(dir))
cp $(firstword $(TEST_RESULT_PATHS))/*.{html,txt} $(BUILD_DIR)/results/html-test-report/
rm $(firstword $(TEST_RESULT_PATHS))/*.{html,txt}
cp $(firstword $(TEST_RESULT_PATHS))/report.junit $(BUILD_DIR)/results/test-results.xml
rm $(firstword $(TEST_RESULT_PATHS))/report.junit
test-ios12-ipad-pro-11_DESTINATION := 'platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch)'
test-ios12-ipad-pro-11:
$(XCODEBUILD_TEST_ALL_WITHOUT_BUILDING)
test-ios12-iphone-xs-max_DESTINATION := 'platform=iOS Simulator,OS=latest,name=iPhone Xs Max'
test-ios12-iphone-xs-max:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios11-ipad-pro-10_5_DESTINATION := 'platform=iOS Simulator,OS=$(IOS11_VERSION),name=iPad Pro (10.5-inch)'
test-ios11-ipad-pro-10_5:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios11-iphone-x_DESTINATION := 'platform=iOS Simulator,OS=$(IOS11_VERSION),name=iPhone X'
test-ios11-iphone-x:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios10-ipad-pro-9_7_DESTINATION := 'platform=iOS Simulator,OS=10.3.1,name=iPad Pro (9.7-inch)'
test-ios10-ipad-pro-9_7:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios10-iphone-7-plus_DESTINATION := 'platform=iOS Simulator,OS=10.3.1,name=iPhone 7 Plus'
test-ios10-iphone-7-plus:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios9-iphone-6s_DESTINATION := 'platform=iOS Simulator,OS=9.3,name=iPhone 6s'
test-ios9-iphone-6s:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios9-iphone-6s-plus_DESTINATION := 'platform=iOS Simulator,OS=9.3,name=iPhone 6s Plus'
test-ios9-iphone-6s-plus:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)
test-ios9-ipad-2_DESTINATION := 'platform=iOS Simulator,OS=9.3,name=iPad 2'
test-ios9-ipad-2:
$(XCODEBUILD_TEST_WITHOUT_BUILDING)