Skip to content

Commit 634d0d1

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Ensure that swift_synthesize_interface_aspect generates unique outputs.
The aspect generated a file named `<target>.synthesized.swift`, which was incorrect if a target had multiple modules in its `SwiftInfo.direct_modules` field. It would also be incorrect to just switch to `<module name>.synthesized.swift`, because two targets could potentially re-export the same module. To fully disambiguate, we create an intermediate directory named for the target, and then use the module name as the filename in that directory. PiperOrigin-RevId: 740414505
1 parent 7f28991 commit 634d0d1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

swift/swift_synthesize_interface_aspect.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def _swift_synthesize_interface_aspect_impl(target, aspect_ctx):
6060

6161
for module in swift_info.direct_modules:
6262
output_file = aspect_ctx.actions.declare_file(
63-
"{}.synthesized.swift".format(target.label.name),
63+
"{}.synthesized_interfaces/{}.synthesized.swift".format(
64+
target.label.name,
65+
module.name,
66+
),
6467
)
6568
direct_outputs.append(output_file)
6669
synthesize_interface(

0 commit comments

Comments
 (0)