Skip to content

chore: add support for using local packages on swift package manifest #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ concurrency:
jobs:
example:
runs-on: macos-12
strategy:
matrix:
xcode: ["14.1"]
steps:
- uses: actions/checkout@v3
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Setup Secrets.swift
run: cp Examples/Examples/_Secrets.swift Examples/Examples/Secrets.swift
- name: Build example
Expand All @@ -35,4 +30,4 @@ jobs:
run: cp Examples/Examples/_Secrets.swift Examples/Examples/Secrets.swift
- name: Test library
run: make test-library


Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "793895C52954ABFF0044F2B8"
BuildableName = "Examples.app"
BlueprintName = "Examples"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "793895C52954ABFF0044F2B8"
BuildableName = "Examples.app"
BlueprintName = "Examples"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "793895C52954ABFF0044F2B8"
BuildableName = "Examples.app"
BlueprintName = "Examples"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
33 changes: 25 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import Foundation
import PackageDescription

let package = Package(
var package = Package(
name: "Supabase",
platforms: [
.iOS(.v13),
Expand All @@ -18,13 +19,7 @@ let package = Package(
targets: ["Supabase"]
),
],
dependencies: [
.package(url: "https://github.com/supabase-community/gotrue-swift", from: "1.0.0"),
.package(url: "https://github.com/supabase-community/storage-swift.git", from: "0.1.1"),
.package(url: "https://github.com/supabase-community/realtime-swift.git", from: "0.0.2"),
.package(url: "https://github.com/supabase-community/postgrest-swift", from: "1.0.0"),
.package(url: "https://github.com/supabase-community/functions-swift", from: "1.0.0"),
],
dependencies: [],
targets: [
.target(
name: "Supabase",
Expand All @@ -39,3 +34,25 @@ let package = Package(
.testTarget(name: "SupabaseTests", dependencies: ["Supabase"]),
]
)

if ProcessInfo.processInfo.environment["USE_LOCAL_PACKAGES"] != nil {
package.dependencies.append(
contentsOf: [
.package(path: "../gotrue-swift"),
.package(path: "../storage-swift"),
.package(path: "../realtime-swift"),
.package(path: "../postgrest-swift"),
.package(path: "../functions-swift"),
]
)
} else {
package.dependencies.append(
contentsOf: [
.package(url: "https://github.com/supabase-community/gotrue-swift", from: "1.0.0"),
.package(url: "https://github.com/supabase-community/storage-swift.git", from: "0.1.1"),
.package(url: "https://github.com/supabase-community/realtime-swift.git", from: "0.0.2"),
.package(url: "https://github.com/supabase-community/postgrest-swift", from: "1.0.0"),
.package(url: "https://github.com/supabase-community/functions-swift", from: "1.0.0"),
]
)
}
7 changes: 5 additions & 2 deletions Tests/SupabaseTests/SupabaseClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,18 @@ final class SupabaseClientTests: XCTestCase {
XCTAssertEqual(client.storageURL.absoluteString, "https://project-ref.supabase.co/storage/v1")
XCTAssertEqual(client.databaseURL.absoluteString, "https://project-ref.supabase.co/rest/v1")
XCTAssertEqual(client.realtimeURL.absoluteString, "https://project-ref.supabase.co/realtime/v1")
XCTAssertEqual(client.functionsURL.absoluteString, "https://project-ref.supabase.co/functions/v1")
XCTAssertEqual(
client.functionsURL.absoluteString,
"https://project-ref.supabase.co/functions/v1"
)

XCTAssertEqual(
client.defaultHeaders,
[
"X-Client-Info": "supabase-swift/\(Supabase.version)",
"apikey": "ANON_KEY",
"header_field": "header_value",
"Authorization": "Bearer ANON_KEY"
"Authorization": "Bearer ANON_KEY",
]
)
}
Expand Down
28 changes: 14 additions & 14 deletions supabase-swift.xcworkspace/xcshareddata/swiftpm/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.