Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit 1b63232

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Add a swift_explicit_module output group to the swift_clang_module_aspect to provide a way to invoke the aspect from the command line and retrieve the .pcm file.
This provides an easier way to manually verify that a `{cc,objc}_library` builds correctly as an explicit module. PiperOrigin-RevId: 353103538
1 parent 2140619 commit 1b63232

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

swift/internal/swift_clang_module_aspect.bzl

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,30 @@ def _handle_cc_target(
338338
module_name = derive_module_name(target.label)
339339
precompiled_module = None
340340

341-
return [create_swift_info(
342-
modules = [
343-
create_module(
344-
name = module_name,
345-
clang = create_clang_module(
346-
compilation_context = compilation_context,
347-
module_map = module_map_file,
348-
precompiled_module = precompiled_module,
341+
providers = [
342+
create_swift_info(
343+
modules = [
344+
create_module(
345+
name = module_name,
346+
clang = create_clang_module(
347+
compilation_context = compilation_context,
348+
module_map = module_map_file,
349+
precompiled_module = precompiled_module,
350+
),
349351
),
352+
],
353+
swift_infos = swift_infos,
354+
),
355+
]
356+
357+
if precompiled_module:
358+
providers.append(
359+
OutputGroupInfo(
360+
swift_explicit_module = depset([precompiled_module]),
350361
),
351-
],
352-
swift_infos = swift_infos,
353-
)]
362+
)
363+
364+
return providers
354365

355366
def _swift_clang_module_aspect_impl(target, aspect_ctx):
356367
# Do nothing if the target already propagates `SwiftInfo`.

0 commit comments

Comments
 (0)