10
10
default : test
11
11
smokeTest : test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget test_framework_SQLCipher3 test_framework_SQLCipher4Encrypted test_framework_GRDBCustomSQLiteiOS_maxTarget test_SPM
12
12
13
- # Requirements
14
- # ============
15
- #
16
- # Xcode
17
- # CocoaPods - https://cocoapods.org
13
+ # =====
14
+ # Tools
18
15
19
16
GIT := $(shell command -v git)
20
17
POD := $(shell command -v pod)
21
18
XCRUN := $(shell command -v xcrun)
22
19
XCODEBUILD := set -o pipefail && $(shell command -v xcodebuild)
23
20
24
- # Xcode Version Information
25
- XCODEVERSION_FULL := $(word 2, $(shell xcodebuild -version) )
26
- XCODEVERSION_MAJOR := $(shell xcodebuild -version 2>&1 | grep Xcode | cut -d' ' -f2 | cut -d'.' -f1)
27
- XCODEVERSION_MINOR := $(shell xcodebuild -version 2>&1 | grep Xcode | cut -d' ' -f2 | cut -d'.' -f2)
28
- XCODEVERSION_PATCH := $(shell xcodebuild -version 2>&1 | grep Xcode | cut -d' ' -f2 | cut -d'.' -f3)
29
-
30
- # The Xcode Version, containing only the "MAJOR.MINOR" (ex. "8.3" for Xcode 8.3, 8.3.1, etc.)
31
- XCODEVERSION := $(XCODEVERSION_MAJOR ) .$(XCODEVERSION_MINOR )
32
-
33
- # Used to determine if xcpretty is available
34
- XCPRETTY_PATH := $(shell command -v xcpretty 2> /dev/null)
35
-
36
- # Avoid the "No output has been received in the last 10m0s" error on Travis:
37
- COCOAPODS_EXTRA_TIME =
38
- ifeq ($(TRAVIS ) ,true)
39
- COCOAPODS_EXTRA_TIME = --verbose
40
- endif
41
-
42
- DOCS_PATH = Documentation/Reference
43
-
44
- # Tests
45
- # =====
46
-
47
- # xcodebuild actions to run test targets
48
- TEST_ACTIONS = clean build build-for-testing test-without-building
49
-
50
- # When adding support for an Xcode version, look for available devices with
51
- # `xcrun xctrace list devices` (or the deprecated `instruments -s devices`).
52
- ifeq ($(XCODEVERSION ) ,14.1)
53
- MAX_SWIFT_VERSION = 5.7
54
- MIN_SWIFT_VERSION = # MAX_SWIFT_VERSION is the minimum supported Swift version
55
- MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 14,OS=16.1"
56
- # MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=12.4" TODO: restore
57
- MAX_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=16.1"
58
- # MIN_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=11.4" TODO: restore
59
- OTHER_SWIFT_FLAGS = '$$(inherited ) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK' # -Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks'
60
- GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited ) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
61
- else ifeq ($(XCODEVERSION),14.0)
62
- MAX_SWIFT_VERSION = 5.7
63
- MIN_SWIFT_VERSION = # MAX_SWIFT_VERSION is the minimum supported Swift version
64
- MAX_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 13,OS=16.0"
65
- MIN_IOS_DESTINATION = "platform=iOS Simulator,name=iPhone 8,OS=12.4"
66
- MAX_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=16.0"
67
- # MIN_TVOS_DESTINATION = "platform=tvOS Simulator,name=Apple TV,OS=11.4" TODO: restore
68
- OTHER_SWIFT_FLAGS = '$$(inherited ) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK' # -Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks'
69
- GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited ) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
70
- else
71
- # Swift 5.3 required: Xcode < 12.0 is not supported
72
- endif
73
-
74
- # If xcpretty is available, use it for xcodebuild output
75
- XCPRETTY =
76
- ifdef XCPRETTY_PATH
77
- XCPRETTY = | xcpretty -c
78
-
79
- # On Travis-CI, use xcpretty-travis-formatter
80
- ifeq ($(TRAVIS),true)
81
- XCPRETTY += -f ` xcpretty-travis-formatter `
82
- endif
83
- endif
84
-
85
21
ifdef TOOLCHAIN
86
22
# If TOOLCHAIN is specified, add xcodebuild parameter
87
23
XCODEBUILD += -toolchain $(TOOLCHAIN )
@@ -100,157 +36,118 @@ else
100
36
SWIFT = $(shell $(XCRUN ) --find swift 2> /dev/null)
101
37
endif
102
38
103
- # We test framework test suites, and if GRBD can be installed in an application:
39
+ # =====
40
+ # Configuration
41
+
42
+ DOCS_PATH = Documentation/Reference
43
+
44
+ TEST_ACTIONS = clean build build-for-testing test-without-building
45
+
46
+ OTHER_SWIFT_FLAGS = '$$(inherited ) -D SQLITE_ENABLE_FTS5 -D SQLITE_ENABLE_PREUPDATE_HOOK' # -Xfrontend -warn-concurrency -Xfrontend -enable-actor-data-race-checks'
47
+ GCC_PREPROCESSOR_DEFINITIONS = '$$(inherited ) GRDB_SQLITE_ENABLE_PREUPDATE_HOOK=1'
48
+
49
+ # Extract min and max destinations from the available devices
50
+ MIN_IOS_DESTINATION := $(shell xcrun simctl list -j devices available | Scripts/destination.rb | grep iPhone | grep -v ^13\.7 | sort -n | head -1 | cut -wf 3 | sed 's/\(.* \) /"platform=iOS Simulator,id=\1"/')
51
+ MAX_IOS_DESTINATION := $(shell xcrun simctl list -j devices available | Scripts/destination.rb | grep iPhone | grep -v ^13\.7 | sort -rn | head -1 | cut -wf 3 | sed 's/\(.* \) /"platform=iOS Simulator,id=\1"/')
52
+ MIN_TVOS_DESTINATION := $(shell xcrun simctl list -j devices available | Scripts/destination.rb | grep tvOS | sort -n | head -1 | cut -wf 3 | sed 's/\(.* \) /"platform=tvOS Simulator,id=\1"/')
53
+ MAX_TVOS_DESTINATION := $(shell xcrun simctl list -j devices available | Scripts/destination.rb | grep tvOS | sort -rn | head -1 | cut -wf 3 | sed 's/\(.* \) /"platform=tvOS Simulator,id=\1"/')
54
+
55
+ # If xcpretty is available, use it for xcodebuild output
56
+ XCPRETTY =
57
+ XCPRETTY_PATH := $(shell command -v xcpretty 2> /dev/null)
58
+ ifdef XCPRETTY_PATH
59
+ XCPRETTY = | xcpretty -c
60
+ endif
61
+
62
+ # =====
63
+ # Tests
64
+
104
65
test : test_framework test_archive test_install test_demo_apps
105
66
106
67
test_framework : test_framework_darwin
107
68
test_framework_darwin : test_framework_GRDB test_framework_GRDBCustom test_framework_SQLCipher test_SPM
108
- test_framework_GRDB : test_framework_GRDBOSX test_framework_GRDBWatchOS test_framework_GRDBiOS test_framework_GRDBtvOS
69
+ test_framework_GRDB : test_framework_GRDBOSX test_framework_GRDBiOS test_framework_GRDBtvOS
109
70
test_framework_GRDBCustom : test_framework_GRDBCustomSQLiteOSX test_framework_GRDBCustomSQLiteiOS
110
71
test_framework_SQLCipher : test_framework_SQLCipher3 test_framework_SQLCipher3Encrypted test_framework_SQLCipher4 test_framework_SQLCipher4Encrypted
111
72
test_archive : test_archive_GRDBOSX_xcframework
112
73
test_install : test_install_manual test_install_SPM test_install_customSQLite test_install_GRDB_CocoaPods test_CocoaPodsLint
113
74
test_CocoaPodsLint : test_CocoaPodsLint_GRDB
114
75
test_demo_apps : test_GRDBDemoiOS test_GRDBCombineDemo test_GRDBAsyncDemo
115
76
116
- test_framework_GRDBOSX : test_framework_GRDBOSX_maxSwift test_framework_GRDBOSX_minSwift
117
-
118
- test_framework_GRDBOSX_maxSwift :
119
- $(XCODEBUILD ) \
120
- -project GRDB.xcodeproj \
121
- -scheme GRDB \
122
- SWIFT_VERSION=$(MAX_SWIFT_VERSION ) \
123
- OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS ) \
124
- GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS ) \
125
- $(TEST_ACTIONS )
126
-
127
- test_framework_GRDBOSX_minSwift :
128
- ifdef MIN_SWIFT_VERSION
77
+ test_framework_GRDBOSX :
129
78
$(XCODEBUILD ) \
130
79
-project GRDB.xcodeproj \
131
80
-scheme GRDB \
132
- SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
81
+ -destination " platform=macOS " \
133
82
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS ) \
134
83
GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS ) \
135
- $(TEST_ACTIONS)
136
- endif
137
-
138
- test_framework_GRDBWatchOS :
139
- # XCTest is not supported for watchOS: we only make sure that the framework builds.
140
- $(XCODEBUILD ) \
141
- -project GRDB.xcodeproj \
142
- -scheme GRDB \
143
- SWIFT_VERSION=$(MAX_SWIFT_VERSION ) \
144
- clean build \
84
+ $(TEST_ACTIONS ) \
145
85
$(XCPRETTY )
146
86
147
87
test_framework_GRDBiOS : test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget
148
- test_framework_GRDBiOS_maxTarget : test_framework_GRDBiOS_maxTarget_maxSwift test_framework_GRDBiOS_maxTarget_minSwift
149
88
150
- test_framework_GRDBiOS_maxTarget_maxSwift :
89
+ test_framework_GRDBiOS_maxTarget :
151
90
$(XCODEBUILD ) \
152
91
-project GRDB.xcodeproj \
153
92
-scheme GRDB \
154
93
-destination $(MAX_IOS_DESTINATION ) \
155
- SWIFT_VERSION=$(MAX_SWIFT_VERSION ) \
156
94
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS ) \
157
95
GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS ) \
158
- $(TEST_ACTIONS )
159
-
160
- test_framework_GRDBiOS_maxTarget_minSwift :
161
- ifdef MIN_SWIFT_VERSION
162
- $(XCODEBUILD) \
163
- -project GRDB.xcodeproj \
164
- -scheme GRDB \
165
- -destination $(MAX_IOS_DESTINATION) \
166
- SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
167
- OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS) \
168
- GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS) \
169
- $(TEST_ACTIONS)
170
- endif
96
+ $(TEST_ACTIONS ) \
97
+ $(XCPRETTY )
171
98
172
99
test_framework_GRDBiOS_minTarget :
173
- ifdef MIN_IOS_DESTINATION
174
100
$(XCODEBUILD ) \
175
101
-project GRDB.xcodeproj \
176
102
-scheme GRDB \
177
103
-destination $(MIN_IOS_DESTINATION ) \
178
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
179
- $(TEST_ACTIONS)
180
- endif
104
+ $(TEST_ACTIONS ) \
105
+ $(XCPRETTY )
181
106
182
107
test_framework_GRDBtvOS : test_framework_GRDBtvOS_maxTarget test_framework_GRDBtvOS_minTarget
183
- test_framework_GRDBtvOS_maxTarget : test_framework_GRDBtvOS_maxTarget_maxSwift test_framework_GRDBtvOS_maxTarget_minSwift
184
-
185
- test_framework_GRDBtvOS_maxTarget_maxSwift :
186
- $(XCODEBUILD ) \
187
- -project GRDB.xcodeproj \
188
- -scheme GRDB \
189
- -destination $(MAX_TVOS_DESTINATION ) \
190
- SWIFT_VERSION=$(MAX_SWIFT_VERSION ) \
191
- OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS ) \
192
- GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS ) \
193
- $(TEST_ACTIONS )
194
108
195
- test_framework_GRDBtvOS_maxTarget_minSwift :
196
- ifdef MIN_SWIFT_VERSION
109
+ test_framework_GRDBtvOS_maxTarget :
197
110
$(XCODEBUILD ) \
198
111
-project GRDB.xcodeproj \
199
112
-scheme GRDB \
200
113
-destination $(MAX_TVOS_DESTINATION ) \
201
- SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
202
114
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS ) \
203
115
GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS ) \
204
- $(TEST_ACTIONS)
205
- endif
116
+ $(TEST_ACTIONS ) \
117
+ $( XCPRETTY )
206
118
207
119
test_framework_GRDBtvOS_minTarget :
208
- ifdef MIN_TVOS_DESTINATION
209
120
$(XCODEBUILD ) \
210
121
-project GRDB.xcodeproj \
211
122
-scheme GRDB \
212
123
-destination $(MIN_TVOS_DESTINATION ) \
213
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
214
- $(TEST_ACTIONS)
215
- endif
124
+ $(TEST_ACTIONS ) \
125
+ $(XCPRETTY )
216
126
217
127
test_framework_GRDBCustomSQLiteOSX : SQLiteCustom
218
128
$(XCODEBUILD ) \
219
129
-project GRDBCustom.xcodeproj \
220
130
-scheme GRDBCustom \
221
- SWIFT_VERSION= $( MAX_SWIFT_VERSION ) \
222
- $(TEST_ACTIONS )
131
+ $( TEST_ACTIONS ) \
132
+ $(XCPRETTY )
223
133
224
134
test_framework_GRDBCustomSQLiteiOS : test_framework_GRDBCustomSQLiteiOS_maxTarget test_framework_GRDBCustomSQLiteiOS_minTarget
225
- test_framework_GRDBCustomSQLiteiOS_maxTarget : test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift
226
135
227
- test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift : SQLiteCustom
136
+ test_framework_GRDBCustomSQLiteiOS_maxTarget : SQLiteCustom
228
137
$(XCODEBUILD ) \
229
138
-project GRDBCustom.xcodeproj \
230
139
-scheme GRDBCustom \
231
140
-destination $(MAX_IOS_DESTINATION ) \
232
- SWIFT_VERSION=$(MAX_SWIFT_VERSION ) \
233
- $(TEST_ACTIONS )
234
-
235
- test_framework_GRDBCustomSQLiteiOS_maxTarget_minSwift : SQLiteCustom
236
- ifdef MIN_SWIFT_VERSION
237
- $(XCODEBUILD) \
238
- -project GRDBCustom.xcodeproj \
239
- -scheme GRDBCustom \
240
- -destination $(MAX_IOS_DESTINATION) \
241
- SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
242
- $(TEST_ACTIONS)
243
- endif
141
+ $(TEST_ACTIONS ) \
142
+ $(XCPRETTY )
244
143
245
144
test_framework_GRDBCustomSQLiteiOS_minTarget : SQLiteCustom
246
- ifdef MIN_IOS_DESTINATION
247
145
$(XCODEBUILD ) \
248
146
-project GRDBCustom.xcodeproj \
249
147
-scheme GRDBCustom \
250
148
-destination $(MIN_IOS_DESTINATION ) \
251
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
252
- $(TEST_ACTIONS)
253
- endif
149
+ $(TEST_ACTIONS ) \
150
+ $(XCPRETTY )
254
151
255
152
test_framework_SQLCipher3 :
256
153
ifdef POD
@@ -259,8 +156,8 @@ ifdef POD
259
156
$(XCODEBUILD) \
260
157
-workspace GRDBTests.xcworkspace \
261
158
-scheme GRDBTests \
262
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
263
- build-for-testing test-without-building
159
+ build-for-testing test-without-building \
160
+ $(XCPRETTY)
264
161
else
265
162
@echo CocoaPods must be installed for test_framework_SQLCipher3
266
163
@exit 1
@@ -273,8 +170,8 @@ ifdef POD
273
170
$(XCODEBUILD) \
274
171
-workspace GRDBTests.xcworkspace \
275
172
-scheme GRDBEncryptedTests \
276
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
277
- build-for-testing test-without-building
173
+ build-for-testing test-without-building \
174
+ $(XCPRETTY)
278
175
else
279
176
@echo CocoaPods must be installed for test_framework_SQLCipher3Encrypted
280
177
@exit 1
@@ -287,8 +184,8 @@ ifdef POD
287
184
$(XCODEBUILD) \
288
185
-workspace GRDBTests.xcworkspace \
289
186
-scheme GRDBTests \
290
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
291
- build-for-testing test-without-building
187
+ build-for-testing test-without-building \
188
+ $(XCPRETTY)
292
189
else
293
190
@echo CocoaPods must be installed for test_framework_SQLCipher4
294
191
@exit 1
@@ -301,8 +198,8 @@ ifdef POD
301
198
$(XCODEBUILD) \
302
199
-workspace GRDBTests.xcworkspace \
303
200
-scheme GRDBEncryptedTests \
304
- SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
305
- build-for-testing test-without-building
201
+ build-for-testing test-without-building \
202
+ $(XCPRETTY)
306
203
else
307
204
@echo CocoaPods must be installed for test_framework_SQLCipher4Encrypted
308
205
@exit 1
@@ -323,7 +220,6 @@ test_archive_GRDBOSX_xcframework:
323
220
-scheme GRDB \
324
221
-configuration Release \
325
222
-destination " generic/platform=macOS" \
326
- SWIFT_VERSION=$(MAX_SWIFT_VERSION ) \
327
223
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS ) \
328
224
GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS ) \
329
225
-archivePath " $( PWD) /Tests/products/GRDB.xcarchive" \
@@ -427,7 +323,7 @@ endif
427
323
428
324
test_CocoaPodsLint_GRDB :
429
325
ifdef POD
430
- $(POD) lib lint GRDB.swift.podspec --allow-warnings $(COCOAPODS_EXTRA_TIME)
326
+ $(POD) lib lint GRDB.swift.podspec --allow-warnings
431
327
else
432
328
@echo CocoaPods must be installed for test_CocoaPodsLint_GRDB
433
329
@exit 1
@@ -438,24 +334,24 @@ test_GRDBDemoiOS:
438
334
-project Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj \
439
335
-scheme GRDBDemoiOS \
440
336
-destination $(MAX_IOS_DESTINATION ) \
441
- SWIFT_VERSION= $( MAX_SWIFT_VERSION ) \
442
- $(TEST_ACTIONS )
337
+ $( TEST_ACTIONS ) \
338
+ $(XCPRETTY )
443
339
444
340
test_GRDBCombineDemo :
445
341
$(XCODEBUILD ) \
446
342
-project Documentation/DemoApps/GRDBCombineDemo/GRDBCombineDemo.xcodeproj \
447
343
-scheme GRDBCombineDemo \
448
344
-destination $(MAX_IOS_DESTINATION ) \
449
- SWIFT_VERSION= $( MAX_SWIFT_VERSION ) \
450
- $(TEST_ACTIONS )
345
+ $( TEST_ACTIONS ) \
346
+ $(XCPRETTY )
451
347
452
348
test_GRDBAsyncDemo :
453
349
$(XCODEBUILD ) \
454
350
-project Documentation/DemoApps/GRDBAsyncDemo/GRDBAsyncDemo.xcodeproj \
455
351
-scheme GRDBAsyncDemo \
456
352
-destination $(MAX_IOS_DESTINATION ) \
457
- SWIFT_VERSION= $( MAX_SWIFT_VERSION ) \
458
- $(TEST_ACTIONS )
353
+ $( TEST_ACTIONS ) \
354
+ $(XCPRETTY )
459
355
460
356
test_performance :
461
357
$(XCODEBUILD ) \
0 commit comments