-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Is it reproducible with SwiftPM command-line tools: swift build
, swift test
, swift package
etc?
- Confirmed reproduction steps with SwiftPM CLI. The description text must include reproduction steps with either of command-line SwiftPM commands,
swift build
,swift test
,swift package
etc.
Description
When I call swift package describe
on a package which has an executable
product which is just a proxy to a binaryTarget
, the command fails because executable product is identified as missing an executable target.
ex:
products: [ .executable(name: "ForwardedSourcery", targets: ["SourceryTool"]), ],
targets: [
.binaryTarget(
name: "SourceryTool",
url: "https://github.com/krzysztofzablocki/Sourcery/releases/download/2.0.2/sourcery-2.0.2.artifactbundle.zip",
checksum: "28d2c35db0cdb0c242b4faa042c137ede4f1d4d242b77ee6363530d3a23d6baf"
),
]
error: 'bugrepro': executable product 'ForwardedSourcery' expects target 'SourceryTool' to be executable; an executable target requires a 'main.swift' file
If I then add an explicit main.swift file, I get a conflicting error when resolving the package graph: the executable product has two executable targets, and should only have one.
ex:
products: [ .executable(name: "ForwardedSourcery", targets: ["SourceryTool", "SourceryProxy"]), ],
targets: [
.executableTarget(name: "SourceryProxy"),
.binaryTarget(
name: "SourceryTool",
url: "https://github.com/krzysztofzablocki/Sourcery/releases/download/2.0.2/sourcery-2.0.2.artifactbundle.zip",
checksum: "28d2c35db0cdb0c242b4faa042c137ede4f1d4d242b77ee6363530d3a23d6baf"
),
]
executable product 'ForwardedSourcery' should not have more than one executable target
These two errors are at odds with each other - is a binaryTarget
an executable target or not?
Expected behavior
binaryTarget
should be appropriately identified as an executable target, or have the ability to opt-in/out to being identified as an executable target if automatic detection is impossible.
Actual behavior
binaryTarget
counting as an executable target will change depending on context.
Steps to reproduce
Sample project attached
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.0-dev
Swift & OS version (output of swift --version ; uname -a
)
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx14.0
Darwin US-PA-A-MCORN 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030 arm64