swift package plugin
argument processing is confusingly sensitive to argument order
#8425
Open
1 task done
Labels
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?swift build
,swift test
,swift package
etc.Description
Possibly the same as #8418.
The
plugin
subcommand is optional, but some of the arguments in a typicalplugin
command are handled byswift
, some by thepackage
subcommand and others by theplugin sub-subcommand
. Although these flags have unique names, the order they are presented on the command line must match the order of the subcommands. Specifying a flag forpackage
after specifying one forplugin
is an error. This can be very confusing for users.Expected behavior
Order of
swift package
arguments should not be significant, unless specifically documented in the help.Error messages should explain argument order more helpfully.
Actual behavior
Order of arguments is significant. Changing the order, or adding a new argument in the wrong place, can cause a command which currently works to fail with an error.
Steps to reproduce
-Xswiftc
is handled byswift package
;--allow-network-connections
is handled byswift package plugin
, but writingplugin
is optional so the argument list appears to be one unbroken list. Many users will be surprised to find that the ordering of such an argument list is significant.Swapping
-Xswiftc
and--allow-network-connections
makes this fail:Swift Package Manager version/commit hash
6.0.3
Swift & OS version (output of
swift --version ; uname -a
)Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: aarch64-unknown-linux-gnu
Linux 0527dce5b4de 6.1.68 #1 SMP Fri Nov 22 18:05:17 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
The text was updated successfully, but these errors were encountered: