From 4241e7654860ac4ec603f89b6961752e4d237e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=20Do=C3=A3n?= Date: Thu, 16 Sep 2021 16:47:23 +0900 Subject: [PATCH] Generate module maps for `cc_library` deps Workaround for not being able to merge the change that adds `swift_interop_hint` rule. --- swift/internal/swift_clang_module_aspect.bzl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/swift/internal/swift_clang_module_aspect.bzl b/swift/internal/swift_clang_module_aspect.bzl index 72333be6f..c4401cc97 100644 --- a/swift/internal/swift_clang_module_aspect.bzl +++ b/swift/internal/swift_clang_module_aspect.bzl @@ -403,6 +403,17 @@ def _module_info_for_target( attr = aspect_ctx.rule.attr module_map_file = None + # TODO: Remove once we cherry-pick the `swift_interop_hint` rule + if not module_name and aspect_ctx.rule.kind == "cc_library": + # For all other targets, there is no mechanism to provide a custom + # module map, and we only generate one if the target is tagged. + module_name = _tagged_target_module_name( + label = target.label, + tags = attr.tags, + ) + if not module_name: + return None, None + if not module_name: if apple_common.Objc not in target: return None, None