Skip to content

SPM Solution for multiple targets. #1070

@lucas-zimerman

Description

@lucas-zimerman

Problem: Sentry Capacitor allows targeting multiple "Capacitor" SDKs. That is not an issue on the JavaScript side on package.json by defining "@capacitor/core": "^7.0.0 || ^8.0.0"

The issue starts on Package.swift where we can't target Capacitor V7 and V8, only a range without break changes like 7.0.0 to 7.9.9.

.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),

// swift-tools-version: 5.9
import PackageDescription
let package = Package(
name: "SentryCapacitor",
platforms: [.iOS(.v14)],
products: [
.library(
name: "SentryCapacitor",
targets: ["SentryCapacitorPlugin"])
],
dependencies: [
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"),
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.56.2")
],
targets: [
.target(
name: "SentryCapacitorPlugin",
dependencies: [
.product(name: "Capacitor", package: "capacitor-swift-pm"),
.product(name: "Cordova", package: "capacitor-swift-pm"),
.product(name: "Sentry", package: "sentry-cocoa")
],
path: "ios/Sources/SentryCapacitorPlugin"),
.testTarget(
name: "SentryCapacitorPluginTests",
dependencies: ["SentryCapacitorPlugin"],
path: "ios/Tests/SentryCapacitorPluginTests")
]
)

Should we release two major versions of Sentry Capacitor, that shares the same codebase but differs on which capacitor is used? let's say, Sentry Capacitor 4.0.0 will only support Capacitor 7.0.0 whereas Sentry Capacitor 5.0.0 will support 8.0.0 up to 8.9.9.

Are there better approaches for this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions