Skip to content

Commit 2d964a7

Browse files
author
Nathan Fallet
authored
Merge pull request #1237 from AnthonyMDev/vision-os
2 parents 0435dd1 + a2a550e commit 2d964a7

File tree

12 files changed

+495
-19
lines changed

12 files changed

+495
-19
lines changed

.github/workflows/build.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
name: Build and test
22
on: [push, pull_request]
33
env:
4-
IOS_SIMULATOR: "iPhone 14"
5-
IOS_VERSION: "16.2"
4+
IOS_SIMULATOR: "iPhone 15"
5+
IOS_VERSION: "17.2"
66
jobs:
77
build:
8-
runs-on: macos-13
8+
runs-on: macos-14
99
steps:
1010
- uses: actions/checkout@v2
1111
- name: "Select Xcode"
1212
# Currently only works with Xcode 14.2:
1313
# https://github.com/CocoaPods/CocoaPods/issues/11839
1414
run: |
1515
xcode-select -p
16-
sudo xcode-select -s /Applications/Xcode_14.2.app/Contents/Developer
16+
sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer
1717
- name: "Lint"
1818
run: make lint
1919
- name: "Run tests (PACKAGE_MANAGER_COMMAND: test)"
@@ -64,6 +64,10 @@ jobs:
6464
env:
6565
CARTHAGE_PLATFORM: tvOS
6666
run: ./run-tests.sh
67+
- name: "Run tests (CARTHAGE_PLATFORM: visionOS)"
68+
env:
69+
CARTHAGE_PLATFORM: visionOS
70+
run: ./run-tests.sh
6771
build-linux:
6872
runs-on: ubuntu-latest
6973
steps:

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
source "https://rubygems.org"
2+
13
gem 'cocoapods', :git => 'https://github.com/SagarSDagdu/CocoaPods.git', tag: '1.15.2.1-sagard'

Gemfile.lock

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ GIT
2323
xcodeproj (>= 1.23.0, < 2.0)
2424

2525
GEM
26+
remote: https://rubygems.org/
2627
specs:
2728
CFPropertyList (3.0.7)
2829
base64
@@ -45,7 +46,7 @@ GEM
4546
json (>= 1.5.1)
4647
atomos (0.1.3)
4748
base64 (0.2.0)
48-
bigdecimal (3.1.5)
49+
bigdecimal (3.1.7)
4950
claide (1.1.0)
5051
cocoapods-core (1.15.2)
5152
activesupport (>= 5.0, < 8)
@@ -69,8 +70,7 @@ GEM
6970
colored2 (3.1.2)
7071
concurrent-ruby (1.2.3)
7172
connection_pool (2.4.1)
72-
drb (2.2.0)
73-
ruby2_keywords
73+
drb (2.2.1)
7474
escape (0.0.4)
7575
ethon (0.16.0)
7676
ffi (>= 1.15.0)
@@ -81,18 +81,17 @@ GEM
8181
httpclient (2.8.3)
8282
i18n (1.14.4)
8383
concurrent-ruby (~> 1.0)
84-
json (2.7.1)
85-
minitest (5.22.0)
84+
json (2.7.2)
85+
minitest (5.22.3)
8686
molinillo (0.8.0)
8787
mutex_m (0.2.0)
8888
nanaimo (0.3.0)
8989
nap (1.1.0)
9090
netrc (0.11.0)
91-
nkf (0.1.3)
91+
nkf (0.2.0)
9292
public_suffix (4.0.7)
9393
rexml (3.2.6)
9494
ruby-macho (2.5.1)
95-
ruby2_keywords (0.0.5)
9695
typhoeus (1.4.1)
9796
ethon (>= 0.9.0)
9897
tzinfo (2.0.6)

Package.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version:5.9
22
import PackageDescription
33

44
let package = Package(
@@ -7,7 +7,8 @@ let package = Package(
77
.iOS(.v11),
88
.macOS(.v10_13),
99
.watchOS(.v4),
10-
.tvOS(.v11)
10+
.tvOS(.v11),
11+
.visionOS(.v1)
1112
],
1213
products: [
1314
.library(

SQLite.swift.podspec

+15
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ Pod::Spec.new do |s|
3232
ss.source_files = 'Sources/SQLite/**/*.{c,h,m,swift}'
3333
ss.exclude_files = 'Sources/**/Cipher.swift'
3434
ss.library = 'sqlite3'
35+
36+
ss.ios.deployment_target = ios_deployment_target
37+
ss.tvos.deployment_target = tvos_deployment_target
38+
ss.osx.deployment_target = osx_deployment_target
39+
ss.watchos.deployment_target = watchos_deployment_target
3540

3641
ss.test_spec 'tests' do |test_spec|
3742
test_spec.resources = 'Tests/SQLiteTests/Resources/*'
@@ -51,6 +56,11 @@ Pod::Spec.new do |s|
5156
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_SWIFT_STANDALONE=1'
5257
}
5358
ss.dependency 'sqlite3'
59+
60+
ss.ios.deployment_target = ios_deployment_target
61+
ss.tvos.deployment_target = tvos_deployment_target
62+
ss.osx.deployment_target = osx_deployment_target
63+
ss.watchos.deployment_target = watchos_deployment_target
5464

5565
ss.test_spec 'tests' do |test_spec|
5666
test_spec.resources = 'Tests/SQLiteTests/Resources/*'
@@ -68,6 +78,11 @@ Pod::Spec.new do |s|
6878
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) SQLITE_HAS_CODEC=1 SQLITE_SWIFT_SQLCIPHER=1'
6979
}
7080
ss.dependency 'SQLCipher', '>= 4.0.0'
81+
82+
ss.ios.deployment_target = ios_deployment_target
83+
ss.tvos.deployment_target = tvos_deployment_target
84+
ss.osx.deployment_target = osx_deployment_target
85+
ss.watchos.deployment_target = watchos_deployment_target
7186

7287
ss.test_spec 'tests' do |test_spec|
7388
test_spec.resources = 'Tests/SQLiteTests/Resources/*'

SQLite.xcodeproj/project.pbxproj

+340
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1520"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "DEB306B82B61CEF500F9D46B"
18+
BuildableName = "SQLite.framework"
19+
BlueprintName = "SQLite visionOS"
20+
ReferencedContainer = "container:SQLite.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<TestPlans>
31+
<TestPlanReference
32+
reference = "container:Tests/SQLite visionOS.xctestplan"
33+
default = "YES">
34+
</TestPlanReference>
35+
</TestPlans>
36+
</TestAction>
37+
<LaunchAction
38+
buildConfiguration = "Debug"
39+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
40+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
41+
launchStyle = "0"
42+
useCustomWorkingDirectory = "NO"
43+
ignoresPersistentStateOnLaunch = "NO"
44+
debugDocumentVersioning = "YES"
45+
debugServiceExtension = "internal"
46+
allowLocationSimulation = "YES">
47+
</LaunchAction>
48+
<ProfileAction
49+
buildConfiguration = "Release"
50+
shouldUseLaunchSchemeArgsEnv = "YES"
51+
savedToolIdentifier = ""
52+
useCustomWorkingDirectory = "NO"
53+
debugDocumentVersioning = "YES">
54+
<MacroExpansion>
55+
<BuildableReference
56+
BuildableIdentifier = "primary"
57+
BlueprintIdentifier = "DEB306B82B61CEF500F9D46B"
58+
BuildableName = "SQLite.framework"
59+
BlueprintName = "SQLite visionOS"
60+
ReferencedContainer = "container:SQLite.xcodeproj">
61+
</BuildableReference>
62+
</MacroExpansion>
63+
</ProfileAction>
64+
<AnalyzeAction
65+
buildConfiguration = "Debug">
66+
</AnalyzeAction>
67+
<ArchiveAction
68+
buildConfiguration = "Release"
69+
revealArchiveInOrganizer = "YES">
70+
</ArchiveAction>
71+
</Scheme>

Tests/Carthage/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CARTHAGE := /usr/local/bin/carthage
1+
CARTHAGE := $(shell which carthage)
22
CARTHAGE_PLATFORM := iOS
33
CARTHAGE_CONFIGURATION := Release
44
CARTHAGE_DIR := Carthage

Tests/SQLite visionOS.xctestplan

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"configurations" : [
3+
{
4+
"id" : "72B91FD4-441C-4C06-9E92-CAEDCB7325AB",
5+
"name" : "Configuration 1",
6+
"options" : {
7+
8+
}
9+
}
10+
],
11+
"defaultOptions" : {
12+
13+
},
14+
"testTargets" : [
15+
{
16+
"target" : {
17+
"containerPath" : "container:SQLite.xcodeproj",
18+
"identifier" : "DEB306E72B61CF9500F9D46B",
19+
"name" : "SQLiteTests visionOS"
20+
}
21+
}
22+
],
23+
"version" : 1
24+
}

Tests/SQLiteTests/TestHelpers.swift

+10
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ func assertSQL(_ expression1: @autoclosure () -> String, _ expression2: @autoclo
105105
XCTAssertEqual(expression1(), expression2().asSQL(), file: file, line: line)
106106
}
107107

108+
func extractAndReplace(_ value: String, regex: String, with replacement: String) -> (String, String) {
109+
// We cannot use `Regex` because it is not available before iOS 16 :(
110+
let regex = try! NSRegularExpression(pattern: regex)
111+
let valueRange = NSRange(location: 0, length: value.utf16.count)
112+
let match = regex.firstMatch(in: value, options: [], range: valueRange)!.range
113+
let range = Range(match, in: value)!
114+
let extractedValue = String(value[range])
115+
return (value.replacingCharacters(in: range, with: replacement), extractedValue)
116+
}
117+
108118
let table = Table("table")
109119
let qualifiedTable = Table("table", database: "main")
110120
let virtualTable = VirtualTable("virtual_table")

Tests/SQLiteTests/Typed/QueryTests.swift

+12-3
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,22 @@ class QueryTests: XCTestCase {
364364
let insert = try emails.insert(value)
365365
let encodedJSON = try JSONEncoder().encode(value1)
366366
let encodedJSONString = String(data: encodedJSON, encoding: .utf8)!
367-
assertSQL(
367+
368+
let expectedSQL =
368369
"""
369370
INSERT INTO \"emails\" (\"int\", \"string\", \"bool\", \"float\", \"double\", \"date\", \"uuid\", \"optional\",
370371
\"sub\") VALUES (1, '2', 1, 3.0, 4.0, '1970-01-01T00:00:00.000', 'E621E1F8-C36C-495A-93FC-0C247A3E6E5F',
371372
'optional', '\(encodedJSONString)')
372-
""".replacingOccurrences(of: "\n", with: ""),
373-
insert
373+
""".replacingOccurrences(of: "\n", with: "")
374+
375+
// As JSON serialization gives a different result each time, we extract JSON and compare it by deserializing it
376+
// and keep comparing the query but with the json replaced by the `JSON` string
377+
let (expectedQuery, expectedJSON) = extractAndReplace(expectedSQL, regex: "\\{.*\\}", with: "JSON")
378+
let (actualQuery, actualJSON) = extractAndReplace(insert.asSQL(), regex: "\\{.*\\}", with: "JSON")
379+
XCTAssertEqual(expectedQuery, actualQuery)
380+
XCTAssertEqual(
381+
try JSONDecoder().decode(TestCodable.self, from: expectedJSON.data(using: .utf8)!),
382+
try JSONDecoder().decode(TestCodable.self, from: actualJSON.data(using: .utf8)!)
374383
)
375384
}
376385
#endif

run-tests.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ if [ -n "$BUILD_SCHEME" ]; then
77
make test BUILD_SCHEME="$BUILD_SCHEME"
88
fi
99
elif [ -n "$VALIDATOR_SUBSPEC" ]; then
10+
bundle install
1011
if [ "$VALIDATOR_SUBSPEC" == "none" ]; then
11-
pod lib lint --no-subspecs --fail-fast
12+
bundle exec pod lib lint --no-subspecs --fail-fast
1213
else
13-
pod lib lint --subspec="${VALIDATOR_SUBSPEC}" --fail-fast
14+
bundle exec pod lib lint --subspec="${VALIDATOR_SUBSPEC}" --fail-fast
1415
fi
1516
elif [ -n "$CARTHAGE_PLATFORM" ]; then
1617
cd Tests/Carthage && make test CARTHAGE_PLATFORM="$CARTHAGE_PLATFORM"

0 commit comments

Comments
 (0)