Future possibility: using `swift-configuration` in `Package.swift`

From my perspective, any use of environment variable in a Package.swift is an indication of a missing feature in SwiftPM. I very much favour the idea of removing usage of environment variables in Package.swift. This is one aspect of the Quality Vision document (yet to be posted) I have for Swift Package Manager.

Here's a use case I would like to see supported:

  • I build at desk using swift build
  • the CI does a swift build with it's own configuration, and which generates some sort of metadata file
  • The CI build fails
  • To reproduce the same environment as CI at-desk, I could so swift build <additional args> where <additional args> would pass it the metadata file. The CI failure is reproducible at-desk.
2 Likes