+1. Super excited to see this proposed, thanks @NeoNacho and @hartbit !
Some nits / ideas:
One small thing is that .byName seems a little weird. Could we have something like .module or .dependency? For example:
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: [
.module(name: "Bluetooth", condition: .when(platforms: [.macOS])),
.module(name: "BluetoothLinux", condition: .when(platforms: [.linux])),
.module(name: "DebugHelpers", condition: .when(configuration: .debug)),
]
),
.target(name: "DebugHelpers")
]
)
Just a thought though, I'm sure there's good reasoning behind .byName.
My other question is whether .when is needed. Is there some future direction I'm missing where things other than when would be used or could we simplify this to:
.product(name: "Bluetooth", condition: .platforms([.macOS])),
.product(name: "BluetoothLinux", condition: .platforms([.linux])),
.target(name: "DebugHelpers", condition: .configuration(.debug)),
Or perhaps:
.product(name: "Bluetooth", condition: .platform(.macOS)),
.product(name: "BluetoothLinux", condition: .platforms([.linux, .windows])),
.target(name: "DebugHelpers", condition: .buildConfiguration(.debug)),