Reapply "Capacitor 8 — Step B: migrate iOS from CocoaPods to Swift Package Manager"
This reverts commit 166bea4314.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// swift-tools-version: 5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "AudioRoute",
|
||||
platforms: [.iOS(.v15)],
|
||||
products: [
|
||||
.library(name: "AudioRoute", targets: ["AudioRoutePlugin"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "AudioRoutePlugin",
|
||||
dependencies: [
|
||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||
.product(name: "Cordova", package: "capacitor-swift-pm")
|
||||
],
|
||||
path: "ios/Sources/AudioRoutePlugin")
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,22 @@
|
||||
// swift-tools-version: 5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "MediaLibrary",
|
||||
platforms: [.iOS(.v15)],
|
||||
products: [
|
||||
.library(name: "MediaLibrary", targets: ["MediaLibraryPlugin"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "MediaLibraryPlugin",
|
||||
dependencies: [
|
||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||
.product(name: "Cordova", package: "capacitor-swift-pm")
|
||||
],
|
||||
path: "ios/Sources/MediaLibraryPlugin")
|
||||
]
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
// swift-tools-version: 5.9
|
||||
import PackageDescription
|
||||
|
||||
// SPM manifest for the native-call Capacitor plugin (Capacitor 8 uses SPM). LiveKit is declared here as a
|
||||
// REAL SPM dependency — LiveKit 2.1+ is SPM-native, so this replaces the CocoaPods git-tag pin hack entirely.
|
||||
// SPM resolves LiveKit + its LiveKitWebRTC / LiveKitUniFFI / SwiftProtobuf sub-packages directly.
|
||||
let package = Package(
|
||||
name: "NativeCall",
|
||||
platforms: [.iOS(.v15)],
|
||||
products: [
|
||||
.library(name: "NativeCall", targets: ["NativeCallPlugin"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
|
||||
.package(url: "https://github.com/livekit/client-sdk-swift.git", exact: "2.15.3")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "NativeCallPlugin",
|
||||
dependencies: [
|
||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||
.product(name: "Cordova", package: "capacitor-swift-pm"),
|
||||
.product(name: "LiveKit", package: "client-sdk-swift")
|
||||
],
|
||||
path: "ios/Sources/NativeCallPlugin")
|
||||
]
|
||||
)
|
||||
@@ -3,7 +3,7 @@ import Capacitor
|
||||
import PushKit
|
||||
import CallKit
|
||||
import AVFoundation
|
||||
import LiveKitClient // the CocoaPod is 'LiveKitClient' (no module_name), so the Swift module is LiveKitClient — NOT LiveKit
|
||||
import LiveKit // SPM product name is 'LiveKit' (Package.swift). (The old CocoaPods module was 'LiveKitClient'.)
|
||||
|
||||
// Native calling for Biz Connect (iOS). Registered by `cap sync` as window.Capacitor.Plugins.NativeCall.
|
||||
//
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// swift-tools-version: 5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "ShareInbox",
|
||||
platforms: [.iOS(.v15)],
|
||||
products: [
|
||||
.library(name: "ShareInbox", targets: ["ShareInboxPlugin"])
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "ShareInboxPlugin",
|
||||
dependencies: [
|
||||
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
||||
.product(name: "Cordova", package: "capacitor-swift-pm")
|
||||
],
|
||||
path: "ios/Sources/ShareInboxPlugin")
|
||||
]
|
||||
)
|
||||
@@ -123,46 +123,11 @@ if [ -f "$AD" ]; then
|
||||
node "$(dirname "$0")/inject-push.js" "$AD" || echo " (push forwarding patch skipped — non-fatal)"
|
||||
fi
|
||||
|
||||
# ── Pin LiveKit to 2.15.3 via its Git tag (stay on CocoaPods; no SPM migration) ─────────────────────
|
||||
# The CallKit audio-session coordination API (AudioManager.audioSession / setEngineAvailability) exists only
|
||||
# in LiveKit 2.1+, but the LiveKitClient CocoaPod PUBLISHED to trunk caps at 2.0.18 (2.1+ is SPM-only). The
|
||||
# repo still ships a VALID podspec at tag 2.15.3, and its deps (LiveKitWebRTC 144.7559.11 / LiveKitUniFFI
|
||||
# 0.0.6 / SwiftProtobuf) ARE on trunk — so we point the Podfile straight at the git tag. The NativeCall
|
||||
# podspec's `LiveKitClient ~> 2.0` is satisfied by 2.15.3 (2.15.3 ∈ [2.0, 3.0)). Idempotent (grep guard).
|
||||
PODFILE="mobile/ios/App/Podfile"
|
||||
if [ -f "$PODFILE" ]; then
|
||||
if grep -q "client-sdk-swift.git" "$PODFILE"; then
|
||||
echo "Podfile: LiveKitClient git pin already present"
|
||||
else
|
||||
ruby -e '
|
||||
p = "mobile/ios/App/Podfile"
|
||||
s = File.read(p)
|
||||
# LiveKit 2.15.3 pulls two binary deps that are SPM-only (NOT on the CocoaPods CDN), so we pin each to
|
||||
# its own repo podspec (neither has further deps):
|
||||
# * LiveKitUniFFI 0.0.6 — podspec has a :git source + prepare_command that downloads its xcframework, so :git works.
|
||||
# * LiveKitWebRTC 144.7559.11 — podspec has an :http source (release-zip), NOT in the git tree, so we
|
||||
# point at the podspec URL with :podspec (using :git would clone a repo with no xcframework and fail).
|
||||
# SwiftProtobuf (the only other dep) resolves from the CDN normally.
|
||||
pin = " pod \x27LiveKitClient\x27, :git => \x27https://github.com/livekit/client-sdk-swift.git\x27, :tag => \x272.15.3\x27\n" +
|
||||
" pod \x27LiveKitUniFFI\x27, :git => \x27https://github.com/livekit/livekit-uniffi-xcframework.git\x27, :tag => \x270.0.6\x27\n" +
|
||||
" pod \x27LiveKitWebRTC\x27, :podspec => \x27https://raw.githubusercontent.com/livekit/webrtc-xcframework/144.7559.11/LiveKitWebRTC.podspec\x27\n"
|
||||
if s =~ /target ["\x27]App["\x27] do\n/
|
||||
s = s.sub(/target ["\x27]App["\x27] do\n/) { |m| m + pin }
|
||||
File.write(p, s)
|
||||
puts "Podfile: pinned LiveKitClient 2.15.3 + LiveKitUniFFI 0.0.6 + LiveKitWebRTC 144.7559.11"
|
||||
else
|
||||
STDERR.puts "WARN: could not find \"target App do\" in Podfile — LiveKit pin NOT applied"
|
||||
exit 1
|
||||
end
|
||||
'
|
||||
fi
|
||||
grep -n "LiveKitClient" "$PODFILE" || true
|
||||
# `npx cap sync` already ran `pod install` with the PRE-pin Podfile, leaving a Podfile.lock that pins
|
||||
# LiveKitClient = 2.0.18 — which conflicts with the git-tag source we just injected ("could not find
|
||||
# compatible versions … In snapshot (Podfile.lock): LiveKitClient (= 2.0.18)"). Drop the lock so the
|
||||
# later "Install CocoaPods" step re-resolves cleanly against tag 2.15.3.
|
||||
rm -f "mobile/ios/App/Podfile.lock" && echo "Removed stale Podfile.lock (cap-sync pinned 2.0.18)"
|
||||
fi
|
||||
# ── LiveKit under SPM (Capacitor 8) ─────────────────────────────────────────────────────────────────
|
||||
# LiveKit is now a proper Swift Package Manager dependency declared in the native-call plugin's Package.swift
|
||||
# (github.com/livekit/client-sdk-swift, exact 2.15.3) — SPM resolves it + its WebRTC/UniFFI/SwiftProtobuf
|
||||
# sub-packages at build time. So there is NO Podfile to patch here anymore (the old CocoaPods git-tag pin
|
||||
# hack is gone).
|
||||
|
||||
echo "Info.plist patched:"
|
||||
"$PB" -c "Print :NSCameraUsageDescription" "$PLIST"
|
||||
|
||||
Reference in New Issue
Block a user