XcodeProj icon indicating copy to clipboard operation
XcodeProj copied to clipboard

Switching SPM products

Open arielelkin opened this issue 3 years ago • 0 comments

I have a Swift package with two library products:

let package = Package(
    name: "IRIS",
    platforms: [.macOS(.v10_10)],
    products: [
        .library(
            name: "MySDK-release",
            targets: ["sdk-release"]
        ),
        .library(
            name: "MySDK-debug",
            targets: ["sdk-debug"]
        )
    ],
    targets: [
        .binaryTarget(
            name: "sdk-release",
            url: "https://api.github.com/bar.zip",
            checksum: "..."
        ),
        .binaryTarget(
            name: "sdk-debug",
            url: "https://api.github.com/foo.zip",
            checksum: "..."
        )
    ]
)

I need to link against MySDK-debug in the debug version of my app, and against MySDK-release in the release version of my app. SPM doesn't support this, so I'm trying to find a way to do it with XcodeProj (on CI I'd run a script which uses XcodeProj to switch the product). I unfortunately can't add both products to the xcode project as they have the same symbol names, and that produces "Multiple commands produce foo.h" errors. Is there a way to do this?

arielelkin avatar Jun 16 '22 11:06 arielelkin