Open dabrahams opened 9 months ago
It appears that the only way to request that the executable be linked without building the whole package is to make a product and use swift build --product
.
If I make a library target that depends on the executable target and build that, the executable is linked.
This sounds like an issue with the implicitness of executable products. It seems like --target
should actually build the implicit product for an executable to make this behavior more consistent.
Description
If you
swift build --target SomeExecutableTarget
and thenswift run --skip-build SomeExecutableTarget
, it fails because the executable is missing.Expected behavior
Actual behavior
Steps to reproduce
mdkir demo && cd demo && swift package init --type executable && echo
swift build --target demo && echo BUILT TARGET
swift run --skip-build demo || echo RUN SKIPPING BUILD FAILED
swift run demo
Swift Package Manager version/commit hash
5.9
Swift & OS version (output of
swift --version ; uname -a
)swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1) Target: arm64-apple-macosx14.0 Darwin DaveA-MBP16.localdomain 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64