Reputation: 11857
Say I have some debugging library, and I want it to not be included in the production versions of my iOS app, how can I achieve this with Swift Package Manager? so in short, I want it to be only part of development builds.
Upvotes: 2
Views: 1392
Reputation: 2102
You can conditionally include a package in a target, reference.
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "BestPackage",
dependencies: [
.package(url: "https://github.com/pureswift/bluetooth", .branch("master")),
.package(url: "https://github.com/pureswift/bluetoothlinux", .branch("master")),
],
targets: [
.target(
name: "BestExecutable",
dependencies: [
.product(name: "Bluetooth", condition: .when(platforms: [.macOS])),
.product(name: "BluetoothLinux", condition: .when(platforms: [.linux])),
.target(name: "DebugHelpers", condition: .when(configuration: .debug)),
]
),
.target(name: "DebugHelpers")
]
)
Upvotes: 0