[swift-build-dev] Local tool configuration

Daniel Dunbar daniel_dunbar at apple.com
Thu Oct 27 11:27:18 CDT 2016


Hi all,

We have a need for local tool (swift build, swift package) configuration data to be able to be present in a repository. Currently, many projects *require* some amount of `-Xcc` or `-Xswiftc` arguments be passed to the tools, and are documenting this in their README files. This is lame... we should support a mechanism by which that data can live inside the project repository.

I *do not* think we should put this data in the manifest -- the manifest should aim to have a good schema for all of the things a package requires. However, we need a stop gap solution to make the package manager easier to use.

I would like to propose that we invent some simple mechanism by which:
1. Local configuration data can live in a checked in location, like `.swiftpm-config`. This would be a simple JSON file with a limited number of options, starting with the -Xcc & -Xswiftc ones.
2. User local configuration data could live in `.swiftpm-config.local`. This would usually be put in .gitignore.
3. The command line tool would use these by default, but with have `--no-config` style options for testing without it. It could also have a `--package-config path/to/config` option to use a different config.
4. We would eventually add `git config` like options under `swift package config`.
5. We would never inherit this data across a package dependency. This is not intended to be a long term solution for how we manage this problem, it is just intended to be something which makes the tool more usable *today*, and thus lets us focus on the bigger problems without ignoring this pain point.
6. As with Git, we would eventually support ~/.swiftpm-config

What do others think?

 - Daniel


More information about the swift-build-dev mailing list