-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add support for macros with new swift_compiler_plugin
rule
#1061
Conversation
bazelbuild/rules_swift#1061 Signed-off-by: Brentley Jones <github@brentleyjones.com>
might need 69349ee |
This adds support for macros with a new swift_compiler_plugin rule. (Cherry picked from b114729)
…ring debug builds. LLDB wants these files to be present on the file system to step into macro expansions, because their file paths are recorded in debug info. The compiler uses `TMPDIR` (if set) as the location for those files, so we can have the worker set `TMPDIR` to a target-specific location before spawning `swiftc`. If this location is workspace-relative, then those file paths are also remapped via `-debug-prefix-map`—an added bonus. The `macro_expansions` group will contain a tree (directory) artifact that contains a `swift-generated-sources` subdirectory (the compiler forces that name), which contains one or more `.swift` files representing the expanded macro buffers. Manual cherry pick of 69349ee
…during debug builds. LLDB wants these files to be present on the file system to step into macro expansions, because their file paths are recorded in debug info. The compiler uses `TMPDIR` (if set) as the location for those files, so we can have the worker set `TMPDIR` to a target-specific location before spawning `swiftc`. If this location is workspace-relative, then those file paths are also remapped via `-debug-prefix-map`—an added bonus. The `macro_expansions` group will contain a tree (directory) artifact that contains a `swift-generated-sources` subdirectory (the compiler forces that name), which contains one or more `.swift` files representing the expanded macro buffers. PiperOrigin-RevId: 549932429
swift_compiler_plugin
rule
I'll update my local usage of this tomorrow to test it out. |
When using this accidentally with an older swift version, the errors are super cryptic:
I wonder if we can throw an error when using the |
Local testing worked. |
added a feature check inside |
This adds support for macros with a new swift_compiler_plugin rule. Example usage: