@@ -189,31 +189,31 @@ def _generate_module_map(
189
189
return module_map_file
190
190
191
191
def _objc_library_module_info (aspect_ctx ):
192
- """Returns the `module_name` and `module_map` attrs for an `objc_library`.
192
+ """Returns the `module_name` attribute for an `objc_library`.
193
193
194
194
Args:
195
195
aspect_ctx: The aspect context.
196
196
197
197
Returns:
198
- A tuple containing the module name (a string) and the module map file (a
199
- `File`) specified as attributes on the `objc_library`. These values may
200
- be `None`.
198
+ The module name (a string) specified as an attribute on the
199
+ `objc_library`. This may be `None`.
201
200
"""
202
201
attr = aspect_ctx .rule .attr
203
202
204
203
# TODO(b/195019413): Deprecate the use of these attributes and use
205
204
# `swift_interop_hint` to customize `objc_*` targets' module names and
206
205
# module maps.
207
206
module_name = getattr (attr , "module_name" , None )
208
- module_map_file = None
209
207
210
- module_map_target = getattr (attr , "module_map" , None )
211
- if module_map_target :
212
- module_map_files = module_map_target .files .to_list ()
213
- if module_map_files :
214
- module_map_file = module_map_files [0 ]
208
+ # TODO(b/195019413): Remove this when the `module_map` attribute is deleted.
209
+ if getattr (attr , "module_map" , None ):
210
+ fail (
211
+ "The `module_map` attribute on `objc_library` is no longer " +
212
+ "supported. Use `swift_interop_hint` instead to customize the " +
213
+ "module map for a target." ,
214
+ )
215
215
216
- return module_name , module_map_file
216
+ return module_name
217
217
218
218
def _module_info_for_target (
219
219
target ,
@@ -253,33 +253,30 @@ def _module_info_for_target(
253
253
):
254
254
return None , None
255
255
256
- module_map_file = None
257
-
258
256
if not module_name :
259
257
if apple_common .Objc not in target :
260
258
return None , None
261
259
262
260
if aspect_ctx .rule .kind == "objc_library" :
263
- module_name , module_map_file = _objc_library_module_info (aspect_ctx )
261
+ module_name = _objc_library_module_info (aspect_ctx )
264
262
265
263
# If it was an `objc_library` without an explicit module name, or it
266
264
# was some other `Objc`-providing target, derive the module name
267
265
# now.
268
266
if not module_name :
269
267
module_name = derive_swift_module_name (target .label )
270
268
271
- # If we didn't get a module map above, generate it now.
272
- if not module_map_file :
273
- module_map_file = _generate_module_map (
274
- actions = aspect_ctx .actions ,
275
- aspect_ctx = aspect_ctx ,
276
- compilation_context = compilation_context ,
277
- dependent_module_names = dependent_module_names ,
278
- exclude_headers = exclude_headers ,
279
- feature_configuration = feature_configuration ,
280
- module_name = module_name ,
281
- target = target ,
282
- )
269
+ module_map_file = _generate_module_map (
270
+ actions = aspect_ctx .actions ,
271
+ aspect_ctx = aspect_ctx ,
272
+ compilation_context = compilation_context ,
273
+ dependent_module_names = dependent_module_names ,
274
+ exclude_headers = exclude_headers ,
275
+ feature_configuration = feature_configuration ,
276
+ module_name = module_name ,
277
+ target = target ,
278
+ )
279
+
283
280
return module_name , module_map_file
284
281
285
282
def _handle_module (
0 commit comments