Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftIfConfig: Create a "fixed" or "static" build configuration that is Codable #2884

Open
DougGregor opened this issue Oct 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@DougGregor
Copy link
Member

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)
@DougGregor DougGregor added the enhancement New feature or request label Oct 21, 2024
@ahoppen
Copy link
Member

ahoppen commented Oct 21, 2024

Synced to Apple’s issue tracker as rdar://138352412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants