You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The add-target command doesn't seem to properly support either creating a target that points to a remote binary artifact or creating a target that points to a local binary artifact. The arguments in the command exist, but the command doesn't seem to property process them and create the correct target type. For example, the following two commands fail, but in different ways (see "Actual Behavior" for how these fail):
swift package add-target Capacitor \
--url "https://github.com/ionic-team/capacitor-swift-pm/releases/download/7.0.1/Capacitor.xcframework.zip" \
--checksum "7781e0a8d8072c26132fd1170e4fe08ae72a98ef664e28176c7e43f241c3479e"
swift package add-target LocalBinaryDependency --path Artifacts/LocalBinaryDependency.xcframework
This seems to be because the presence of these arguments doesn't change the type of the target to be created from .regular to .binary. Some of these values being present gets caught in TargetDescription's validation and fails the command line call. Binary targets aren't supported, in the sense of the --type argument does not accept a value named binary to explicitly change the type of the created target to .binary, which would then map to a .binaryTarget value in the manifest.
I have limited knowledge of the internals of SPM, but I would hazard a guess that this could be addressed by adding a new binary case to the TargetType enumeration, and then properly mapping that to a TargetDescription.TargetKind.binary.
Expected behavior
Providing the information for a binary target would properly create a .binaryTarget target in the SPM package's manifest.
Actual behavior
For remote binary targets, the command will fail with the following error:
error: target 'Capacitor' contains a value for disallowed property 'url'
For local binary targets, the command succeeds, but creates a normal target, but with its path set in the manifest to the path provided to the command. The command will also create the target's source folders in the Sources/ folder.
Steps to reproduce
Use one of the command invocations included in the description of this ticket to attempt to create a new binary target in a package.
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.3
Swift & OS version (output of swift --version ; uname -a)
$ swift --version
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx14.0
$ uname -a
Darwin 603e5f49c974 23.6.0 Darwin Kernel Version 23.6.0: Fri Nov 15 15:12:52 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T6031 arm64
The text was updated successfully, but these errors were encountered:
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
The
add-target
command doesn't seem to properly support either creating a target that points to a remote binary artifact or creating a target that points to a local binary artifact. The arguments in the command exist, but the command doesn't seem to property process them and create the correct target type. For example, the following two commands fail, but in different ways (see "Actual Behavior" for how these fail):This seems to be because the presence of these arguments doesn't change the type of the target to be created from
.regular
to.binary
. Some of these values being present gets caught inTargetDescription
's validation and fails the command line call. Binary targets aren't supported, in the sense of the--type
argument does not accept a value namedbinary
to explicitly change the type of the created target to.binary
, which would then map to a.binaryTarget
value in the manifest.I have limited knowledge of the internals of SPM, but I would hazard a guess that this could be addressed by adding a new
binary
case to theTargetType
enumeration, and then properly mapping that to aTargetDescription.TargetKind.binary
.Expected behavior
Providing the information for a binary target would properly create a
.binaryTarget
target in the SPM package's manifest.Actual behavior
For remote binary targets, the command will fail with the following error:
For local binary targets, the command succeeds, but creates a normal target, but with its
path
set in the manifest to the path provided to the command. The command will also create the target's source folders in theSources/
folder.Steps to reproduce
Use one of the command invocations included in the description of this ticket to attempt to create a new binary target in a package.
Swift Package Manager version/commit hash
Swift Package Manager - Swift 6.0.3
Swift & OS version (output of
swift --version ; uname -a
)$ swift --version swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1) Target: arm64-apple-macosx14.0 $ uname -a Darwin 603e5f49c974 23.6.0 Darwin Kernel Version 23.6.0: Fri Nov 15 15:12:52 PST 2024; root:xnu-10063.141.1.702.7~1/RELEASE_ARM64_T6031 arm64
The text was updated successfully, but these errors were encountered: