[swift-build-dev] Package Manager command line option clean-up

Anders Bertelrud anders at apple.com
Wed May 25 18:13:19 CDT 2016


Hello all,

Now that the `package` subcommand has been implemented (see https://github.com/apple/swift-evolution/blob/master/proposals/0085-package-manager-command-name.md), some of the options have ended up with awkward syntax.  For example, the old `--init` option took an optional package type parameter, and after the command renaming, the syntax has become somewhat awkward:  `package init=library`.

In order to clean this up, we have added some flags for the newly introduced subcommands, and I wanted to run them by the list to get any feedback before making the change.

The command line interface vended by the new `package` subcommand introduced by SE-0085 is shown in its help text:

OVERVIEW: Perform operations on Swift packages

USAGE: swift package [command] [options]

COMMANDS:
  init [--type <type>]                   Initialize a new package (executable|library)
  fetch                                  Fetch package dependencies
  update                                 Update package dependencies
  generate-xcodeproj [--output <path>]   Generates an Xcode project
  show-dependencies [--format <format>]  Print dependency graph (text|dot|json)
  dump-package [--output <path>]         Print Package.swift as JSON

OPTIONS:
  --chdir <path>       Change working directory before any command [-C]
  --color <mode>       Specify color mode (auto|always|never)
  --verbose            Increase verbosity of informational output [-v]
  -Xcc <flag>          Pass flag through to all C compiler instantiations
  -Xlinker <flag>      Pass flag through to all linker instantiations
  -Xswiftc <flag>      Pass flag through to all Swift compiler instantiations

NOTE: Use `swift build` to build packages, and `swift test` to test packages

The changes are to introduce new flags for the parameters that were previously passed to the subcommand names themselves.  The last three flags listed (-Xcc, -Xlinker, and -Xswiftc) are unchanged to maintain compatibility with the swift compiler — this will likely be revisited at a later time.

As described in SE-0085, the `build` subcommand stays.  It how has this interface:

OVERVIEW: Build sources into binary products

USAGE: swift build [mode] [options]

MODES:
  --configuration <value>   Build with configuration (debug|release)
  --clean [<mode>]          Delete artifacts (build|dist)

OPTIONS:
  --chdir <path>       Change working directory before any other operation [-C]
  --build-path <path>  Specify build directory
  --color <mode>       Specify color mode (auto|always|never)
  --verbose            Increase verbosity of informational output [-v]
  -Xcc <flag>          Pass flag through to all C compiler instantiations
  -Xlinker <flag>      Pass flag through to all linker instantiations
  -Xswiftc <flag>      Pass flag through to all Swift compiler instantiations

NOTE: Use `swift package` to perform other functions on packages

Finally, the `test` subcommand remains largely unmodified, with this interface:

OVERVIEW: Build and run tests

USAGE: swift test [specifier] [options]

SPECIFIER:
  -s TestModule.TestCase         Run a test case subclass
  -s TestModule.TestCase/test1   Run a specific test method

OPTIONS:
  --chdir              Change working directory before any other operation [-C]
  --build-path <path>  Specify build directory

NOTE: Use `swift package` to perform other functions on packages

Questions / comments / concerns?

Anders

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-build-dev/attachments/20160525/b6f99b90/attachment.html>


More information about the swift-build-dev mailing list