Skip to content

Commit 5fe76b3

Browse files
authored
chore: add support for using local packages on swift package manifest (#92)
* chore: add support for using local packages on swift package manifest * Use default Xcode available * Fix build * Rollback format
1 parent 00b9e7d commit 5fe76b3

File tree

5 files changed

+122
-30
lines changed

5 files changed

+122
-30
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ concurrency:
1515
jobs:
1616
example:
1717
runs-on: macos-12
18-
strategy:
19-
matrix:
20-
xcode: ["14.1"]
2118
steps:
2219
- uses: actions/checkout@v3
23-
- name: Select Xcode ${{ matrix.xcode }}
24-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
2520
- name: Setup Secrets.swift
2621
run: cp Examples/Examples/_Secrets.swift Examples/Examples/Secrets.swift
2722
- name: Build example
@@ -35,4 +30,4 @@ jobs:
3530
run: cp Examples/Examples/_Secrets.swift Examples/Examples/Secrets.swift
3631
- name: Test library
3732
run: make test-library
38-
33+
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1500"
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 = "793895C52954ABFF0044F2B8"
18+
BuildableName = "Examples.app"
19+
BlueprintName = "Examples"
20+
ReferencedContainer = "container:Examples.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+
shouldAutocreateTestPlan = "YES">
31+
</TestAction>
32+
<LaunchAction
33+
buildConfiguration = "Debug"
34+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
35+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
36+
launchStyle = "0"
37+
useCustomWorkingDirectory = "NO"
38+
ignoresPersistentStateOnLaunch = "NO"
39+
debugDocumentVersioning = "YES"
40+
debugServiceExtension = "internal"
41+
allowLocationSimulation = "YES">
42+
<BuildableProductRunnable
43+
runnableDebuggingMode = "0">
44+
<BuildableReference
45+
BuildableIdentifier = "primary"
46+
BlueprintIdentifier = "793895C52954ABFF0044F2B8"
47+
BuildableName = "Examples.app"
48+
BlueprintName = "Examples"
49+
ReferencedContainer = "container:Examples.xcodeproj">
50+
</BuildableReference>
51+
</BuildableProductRunnable>
52+
</LaunchAction>
53+
<ProfileAction
54+
buildConfiguration = "Release"
55+
shouldUseLaunchSchemeArgsEnv = "YES"
56+
savedToolIdentifier = ""
57+
useCustomWorkingDirectory = "NO"
58+
debugDocumentVersioning = "YES">
59+
<BuildableProductRunnable
60+
runnableDebuggingMode = "0">
61+
<BuildableReference
62+
BuildableIdentifier = "primary"
63+
BlueprintIdentifier = "793895C52954ABFF0044F2B8"
64+
BuildableName = "Examples.app"
65+
BlueprintName = "Examples"
66+
ReferencedContainer = "container:Examples.xcodeproj">
67+
</BuildableReference>
68+
</BuildableProductRunnable>
69+
</ProfileAction>
70+
<AnalyzeAction
71+
buildConfiguration = "Debug">
72+
</AnalyzeAction>
73+
<ArchiveAction
74+
buildConfiguration = "Release"
75+
revealArchiveInOrganizer = "YES">
76+
</ArchiveAction>
77+
</Scheme>

Package.swift

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// swift-tools-version:5.7
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

4+
import Foundation
45
import PackageDescription
56

6-
let package = Package(
7+
var package = Package(
78
name: "Supabase",
89
platforms: [
910
.iOS(.v13),
@@ -18,13 +19,7 @@ let package = Package(
1819
targets: ["Supabase"]
1920
),
2021
],
21-
dependencies: [
22-
.package(url: "https://github.com/supabase-community/gotrue-swift", from: "1.0.0"),
23-
.package(url: "https://github.com/supabase-community/storage-swift.git", from: "0.1.1"),
24-
.package(url: "https://github.com/supabase-community/realtime-swift.git", from: "0.0.2"),
25-
.package(url: "https://github.com/supabase-community/postgrest-swift", from: "1.0.0"),
26-
.package(url: "https://github.com/supabase-community/functions-swift", from: "1.0.0"),
27-
],
22+
dependencies: [],
2823
targets: [
2924
.target(
3025
name: "Supabase",
@@ -39,3 +34,25 @@ let package = Package(
3934
.testTarget(name: "SupabaseTests", dependencies: ["Supabase"]),
4035
]
4136
)
37+
38+
if ProcessInfo.processInfo.environment["USE_LOCAL_PACKAGES"] != nil {
39+
package.dependencies.append(
40+
contentsOf: [
41+
.package(path: "../gotrue-swift"),
42+
.package(path: "../storage-swift"),
43+
.package(path: "../realtime-swift"),
44+
.package(path: "../postgrest-swift"),
45+
.package(path: "../functions-swift"),
46+
]
47+
)
48+
} else {
49+
package.dependencies.append(
50+
contentsOf: [
51+
.package(url: "https://github.com/supabase-community/gotrue-swift", from: "1.0.0"),
52+
.package(url: "https://github.com/supabase-community/storage-swift.git", from: "0.1.1"),
53+
.package(url: "https://github.com/supabase-community/realtime-swift.git", from: "0.0.2"),
54+
.package(url: "https://github.com/supabase-community/postgrest-swift", from: "1.0.0"),
55+
.package(url: "https://github.com/supabase-community/functions-swift", from: "1.0.0"),
56+
]
57+
)
58+
}

Tests/SupabaseTests/SupabaseClientTests.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,18 @@ final class SupabaseClientTests: XCTestCase {
3838
XCTAssertEqual(client.storageURL.absoluteString, "https://project-ref.supabase.co/storage/v1")
3939
XCTAssertEqual(client.databaseURL.absoluteString, "https://project-ref.supabase.co/rest/v1")
4040
XCTAssertEqual(client.realtimeURL.absoluteString, "https://project-ref.supabase.co/realtime/v1")
41-
XCTAssertEqual(client.functionsURL.absoluteString, "https://project-ref.supabase.co/functions/v1")
41+
XCTAssertEqual(
42+
client.functionsURL.absoluteString,
43+
"https://project-ref.supabase.co/functions/v1"
44+
)
4245

4346
XCTAssertEqual(
4447
client.defaultHeaders,
4548
[
4649
"X-Client-Info": "supabase-swift/\(Supabase.version)",
4750
"apikey": "ANON_KEY",
4851
"header_field": "header_value",
49-
"Authorization": "Bearer ANON_KEY"
52+
"Authorization": "Bearer ANON_KEY",
5053
]
5154
)
5255
}

supabase-swift.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)