Skip to content

Commit 45d5cac

Browse files
Remove ObjcProvider.module_map -> ObjcProvider.header (#625)
Remove the “hack” that propagates the `ObjcProvider.module_map` into `ObjcProvider.header` field since it doesn’t exist anymore. This is sorta like bazelbuild/rules_apple#1319 in `rules_apple`.
1 parent 9703512 commit 45d5cac

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

rules/apple_patched.bzl

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,38 +109,25 @@ def _get_framework_info_providers(ctx, old_cc_info, old_objc_provider):
109109

110110
def _apple_framework_import_modulemap_impl(ctx):
111111
legacy_target = ctx.attr.legacy_target
112-
old_objc_provider = legacy_target[apple_common.Objc]
112+
objc_provider = legacy_target[apple_common.Objc]
113113
old_cc_info = legacy_target[CcInfo]
114114

115115
# Merge providers
116-
objc_provider_fields = {
117-
"providers": [old_objc_provider],
118-
# Adding the module_map to the headers.
119-
# This "hack" is just a way to propagate the module map. swift_rules has a field in its provider
120-
# called swiftc_inputs where you can pass extra dependencies to the compiler. Unfortunately
121-
# the objc provider has no such field. The "hack" is to pass the module map as a header so that
122-
# it makes it to the list of dependencies. Since it doesn't end in .h it gets ignored but it's
123-
# still propagated as a dependency. This "hack" is based on:
124-
# a) https://github.com/bazelbuild/rules_apple/blob/313eeb838497e230f01a7367ae4555aaf0cac62e/apple/internal/apple_framework_import.bzl#L98
125-
# b) https://github.com/bazel-ios/rules_ios/blob/1755c694f8d5cc1ed256bba7ccf122a3fbc4addf/rules/framework.bzl#L247
126-
"header": old_objc_provider.module_map,
127-
}
128-
new_objc_provider = apple_common.new_objc_provider(**objc_provider_fields)
129116
new_cc_info = cc_common.merge_cc_infos(
130117
cc_infos = [
131118
old_cc_info,
132-
CcInfo(compilation_context = cc_common.create_compilation_context(headers = old_objc_provider.module_map)),
119+
CcInfo(compilation_context = cc_common.create_compilation_context(headers = objc_provider.module_map)),
133120
],
134121
)
135122

136-
additional_providers = _get_framework_info_providers(ctx, old_cc_info, old_objc_provider)
123+
additional_providers = _get_framework_info_providers(ctx, old_cc_info, objc_provider)
137124

138125
# Seems that there is no way to iterate on the existing providers, so what is possible instead
139126
# is to list here the keys to all of them (you can see the keys for the existing providers of a
140127
# target by just printing the target)
141128
# For more information refer to https://groups.google.com/forum/#!topic/bazel-discuss/4KkflTjmUyk
142129
other_provider_keys = [AppleFrameworkImportInfo, SwiftUsageInfo, apple_common.AppleDynamicFramework, OutputGroupInfo, DefaultInfo]
143-
return additional_providers + [new_objc_provider, new_cc_info] + \
130+
return additional_providers + [objc_provider, new_cc_info] + \
144131
[legacy_target[provider_key] for provider_key in other_provider_keys if provider_key in legacy_target]
145132

146133
_apple_framework_import_modulemap = rule(

0 commit comments

Comments
 (0)