Open
Description
Description
The SwiftIfConfig library has a BuildConfiguration
protocol, but there is no concrete implementation of the BuildConfiguration
protocol in the library. The only BuildConfiguration
in normal use right now is buried in the Swift compiler itself, to query the configuration of the compiler.
We should add some kind of "fixed" or "static" build configuration that conforms to BuildConfiguration
and is Codable
so it can easily be saved and restored. Ideas for such a configuration:
- Use it for some of the unit tests instead of the bare-bones testing build configuration we have now
- Extend the compiler and/or SourceKit with an option to dump out JSON in a format that's compatible with this type, so tools can query the build configuration once and then apply it in other contexts such as an IDE (e.g., in SourceKit-LSP)
- Extend swift-parser-cli with an option to apply a build configuration file (the serialized JSON), removing all of the inactive
#if
regions based on that configuration (SwiftIfConfig already has an API for this)