Skip to content

Commit 82ed41b

Browse files
committed
Remove junk from Makefile
1 parent 639eadb commit 82ed41b

File tree

2 files changed

+79
-168
lines changed

2 files changed

+79
-168
lines changed

Makefile

Lines changed: 64 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -10,78 +10,14 @@
1010
default: test
1111
smokeTest: test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget test_framework_SQLCipher3 test_framework_SQLCipher4Encrypted test_framework_GRDBCustomSQLiteiOS_maxTarget test_SPM
1212

13-
# Requirements
14-
# ============
15-
#
16-
# Xcode
17-
# CocoaPods - https://cocoapods.org
13+
# =====
14+
# Tools
1815

1916
GIT := $(shell command -v git)
2017
POD := $(shell command -v pod)
2118
XCRUN := $(shell command -v xcrun)
2219
XCODEBUILD := set -o pipefail && $(shell command -v xcodebuild)
2320

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-
8521
ifdef TOOLCHAIN
8622
# If TOOLCHAIN is specified, add xcodebuild parameter
8723
XCODEBUILD += -toolchain $(TOOLCHAIN)
@@ -100,157 +36,118 @@ else
10036
SWIFT = $(shell $(XCRUN) --find swift 2> /dev/null)
10137
endif
10238

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+
10465
test: test_framework test_archive test_install test_demo_apps
10566

10667
test_framework: test_framework_darwin
10768
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
10970
test_framework_GRDBCustom: test_framework_GRDBCustomSQLiteOSX test_framework_GRDBCustomSQLiteiOS
11071
test_framework_SQLCipher: test_framework_SQLCipher3 test_framework_SQLCipher3Encrypted test_framework_SQLCipher4 test_framework_SQLCipher4Encrypted
11172
test_archive: test_archive_GRDBOSX_xcframework
11273
test_install: test_install_manual test_install_SPM test_install_customSQLite test_install_GRDB_CocoaPods test_CocoaPodsLint
11374
test_CocoaPodsLint: test_CocoaPodsLint_GRDB
11475
test_demo_apps: test_GRDBDemoiOS test_GRDBCombineDemo test_GRDBAsyncDemo
11576

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:
12978
$(XCODEBUILD) \
13079
-project GRDB.xcodeproj \
13180
-scheme GRDB \
132-
SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
81+
-destination "platform=macOS" \
13382
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS) \
13483
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) \
14585
$(XCPRETTY)
14686

14787
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
14988

150-
test_framework_GRDBiOS_maxTarget_maxSwift:
89+
test_framework_GRDBiOS_maxTarget:
15190
$(XCODEBUILD) \
15291
-project GRDB.xcodeproj \
15392
-scheme GRDB \
15493
-destination $(MAX_IOS_DESTINATION) \
155-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
15694
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS) \
15795
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)
17198

17299
test_framework_GRDBiOS_minTarget:
173-
ifdef MIN_IOS_DESTINATION
174100
$(XCODEBUILD) \
175101
-project GRDB.xcodeproj \
176102
-scheme GRDB \
177103
-destination $(MIN_IOS_DESTINATION) \
178-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
179-
$(TEST_ACTIONS)
180-
endif
104+
$(TEST_ACTIONS) \
105+
$(XCPRETTY)
181106

182107
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)
194108

195-
test_framework_GRDBtvOS_maxTarget_minSwift:
196-
ifdef MIN_SWIFT_VERSION
109+
test_framework_GRDBtvOS_maxTarget:
197110
$(XCODEBUILD) \
198111
-project GRDB.xcodeproj \
199112
-scheme GRDB \
200113
-destination $(MAX_TVOS_DESTINATION) \
201-
SWIFT_VERSION=$(MIN_SWIFT_VERSION) \
202114
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS) \
203115
GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS) \
204-
$(TEST_ACTIONS)
205-
endif
116+
$(TEST_ACTIONS) \
117+
$(XCPRETTY)
206118

207119
test_framework_GRDBtvOS_minTarget:
208-
ifdef MIN_TVOS_DESTINATION
209120
$(XCODEBUILD) \
210121
-project GRDB.xcodeproj \
211122
-scheme GRDB \
212123
-destination $(MIN_TVOS_DESTINATION) \
213-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
214-
$(TEST_ACTIONS)
215-
endif
124+
$(TEST_ACTIONS) \
125+
$(XCPRETTY)
216126

217127
test_framework_GRDBCustomSQLiteOSX: SQLiteCustom
218128
$(XCODEBUILD) \
219129
-project GRDBCustom.xcodeproj \
220130
-scheme GRDBCustom \
221-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
222-
$(TEST_ACTIONS)
131+
$(TEST_ACTIONS) \
132+
$(XCPRETTY)
223133

224134
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
226135

227-
test_framework_GRDBCustomSQLiteiOS_maxTarget_maxSwift: SQLiteCustom
136+
test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
228137
$(XCODEBUILD) \
229138
-project GRDBCustom.xcodeproj \
230139
-scheme GRDBCustom \
231140
-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)
244143

245144
test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
246-
ifdef MIN_IOS_DESTINATION
247145
$(XCODEBUILD) \
248146
-project GRDBCustom.xcodeproj \
249147
-scheme GRDBCustom \
250148
-destination $(MIN_IOS_DESTINATION) \
251-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
252-
$(TEST_ACTIONS)
253-
endif
149+
$(TEST_ACTIONS) \
150+
$(XCPRETTY)
254151

255152
test_framework_SQLCipher3:
256153
ifdef POD
@@ -259,8 +156,8 @@ ifdef POD
259156
$(XCODEBUILD) \
260157
-workspace GRDBTests.xcworkspace \
261158
-scheme GRDBTests \
262-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
263-
build-for-testing test-without-building
159+
build-for-testing test-without-building \
160+
$(XCPRETTY)
264161
else
265162
@echo CocoaPods must be installed for test_framework_SQLCipher3
266163
@exit 1
@@ -273,8 +170,8 @@ ifdef POD
273170
$(XCODEBUILD) \
274171
-workspace GRDBTests.xcworkspace \
275172
-scheme GRDBEncryptedTests \
276-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
277-
build-for-testing test-without-building
173+
build-for-testing test-without-building \
174+
$(XCPRETTY)
278175
else
279176
@echo CocoaPods must be installed for test_framework_SQLCipher3Encrypted
280177
@exit 1
@@ -287,8 +184,8 @@ ifdef POD
287184
$(XCODEBUILD) \
288185
-workspace GRDBTests.xcworkspace \
289186
-scheme GRDBTests \
290-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
291-
build-for-testing test-without-building
187+
build-for-testing test-without-building \
188+
$(XCPRETTY)
292189
else
293190
@echo CocoaPods must be installed for test_framework_SQLCipher4
294191
@exit 1
@@ -301,8 +198,8 @@ ifdef POD
301198
$(XCODEBUILD) \
302199
-workspace GRDBTests.xcworkspace \
303200
-scheme GRDBEncryptedTests \
304-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
305-
build-for-testing test-without-building
201+
build-for-testing test-without-building \
202+
$(XCPRETTY)
306203
else
307204
@echo CocoaPods must be installed for test_framework_SQLCipher4Encrypted
308205
@exit 1
@@ -323,7 +220,6 @@ test_archive_GRDBOSX_xcframework:
323220
-scheme GRDB \
324221
-configuration Release \
325222
-destination "generic/platform=macOS" \
326-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
327223
OTHER_SWIFT_FLAGS=$(OTHER_SWIFT_FLAGS) \
328224
GCC_PREPROCESSOR_DEFINITIONS=$(GCC_PREPROCESSOR_DEFINITIONS) \
329225
-archivePath "$(PWD)/Tests/products/GRDB.xcarchive" \
@@ -427,7 +323,7 @@ endif
427323

428324
test_CocoaPodsLint_GRDB:
429325
ifdef POD
430-
$(POD) lib lint GRDB.swift.podspec --allow-warnings $(COCOAPODS_EXTRA_TIME)
326+
$(POD) lib lint GRDB.swift.podspec --allow-warnings
431327
else
432328
@echo CocoaPods must be installed for test_CocoaPodsLint_GRDB
433329
@exit 1
@@ -438,24 +334,24 @@ test_GRDBDemoiOS:
438334
-project Documentation/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj \
439335
-scheme GRDBDemoiOS \
440336
-destination $(MAX_IOS_DESTINATION) \
441-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
442-
$(TEST_ACTIONS)
337+
$(TEST_ACTIONS) \
338+
$(XCPRETTY)
443339

444340
test_GRDBCombineDemo:
445341
$(XCODEBUILD) \
446342
-project Documentation/DemoApps/GRDBCombineDemo/GRDBCombineDemo.xcodeproj \
447343
-scheme GRDBCombineDemo \
448344
-destination $(MAX_IOS_DESTINATION) \
449-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
450-
$(TEST_ACTIONS)
345+
$(TEST_ACTIONS) \
346+
$(XCPRETTY)
451347

452348
test_GRDBAsyncDemo:
453349
$(XCODEBUILD) \
454350
-project Documentation/DemoApps/GRDBAsyncDemo/GRDBAsyncDemo.xcodeproj \
455351
-scheme GRDBAsyncDemo \
456352
-destination $(MAX_IOS_DESTINATION) \
457-
SWIFT_VERSION=$(MAX_SWIFT_VERSION) \
458-
$(TEST_ACTIONS)
353+
$(TEST_ACTIONS) \
354+
$(XCPRETTY)
459355

460356
test_performance:
461357
$(XCODEBUILD) \

Scripts/destination.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
gem 'json'
3+
require 'json'
4+
require 'optparse'
5+
6+
samples = JSON.parse(STDIN.read)
7+
8+
samples['devices'].each do |key, devices|
9+
next unless key =~ /^com\.apple\.CoreSimulator\.SimRuntime\.([^-]*)-(.*)$/
10+
platform = $1
11+
version = $2.gsub('-', '.')
12+
devices.each do |device|
13+
puts "#{version} #{platform} #{device["udid"]} #{device["name"]}"
14+
end
15+
end

0 commit comments

Comments
 (0)