swift_macro
Swift compiler-plugin executable built for the host.
Compiles Swift sources into a macOS host executable that the Swift compiler
loads at compile time. The macro implementation typically depends on a
swift-syntax checkout supplied through deps. Any
apple_library dependency edge that
reaches a swift_macro target picks up the executable and declaring module
automatically.
| Attribute | Type | Required | Default | Description |
|---|
minimum_os | string | no | "13.0" | Minimum macOS version for the host plugin |
module_name | string | no | target name | Compiled module name (not configurable) |
swift_flags | list<string> | no | [] | Extra Swift compiler flags |
xcode_developer_dir | string | no | | Pin a specific Xcode by overriding DEVELOPER_DIR. Folded into the action cache key |
| Edge | Accepts | Description |
|---|
deps | apple_linkable | Libraries the plugin links against (typically a swift-syntax checkout) |
The target emits apple_swift_plugin.
| Capability | Output groups |
|---|
build | default, plugin_executable, swiftmodule |
| Field | Type | Meaning |
|---|
label_id | string | Canonical target id |
plugin_executable | string | Path to the produced macOS host executable |
plugin_module_name | string | Declaring module name paired with the executable by downstream compilers |
transitive_plugin_executables | list<string> | <path>#<module> descriptors propagated through libraries and frameworks |
| Output | Location |
|---|
| Plugin executable | .once/out/<target>/<module_name>-tool |
| Swift module | .once/out/<target>/<module_name>.swiftmodule |
[[target]]
name = "StringifyMacro"
kind = "swift_macro"
srcs = ["Sources/**/*.swift"]
deps = [
"//third_party/swift-syntax:SwiftSyntax",
"//third_party/swift-syntax:SwiftCompilerPlugin",
][[target]]
name = "StringifyMacro"
kind = "swift_macro"
srcs = ["Sources/**/*.swift"]
deps = [
"//third_party/swift-syntax:SwiftSyntax",
"//third_party/swift-syntax:SwiftCompilerPlugin",
]