bazel-ios/rules_ios

Same list of defines passed to `objc_library` and `swift_library` can cause compilation errors and/or undesired behaviour

Closed this issue · 0 comments

Because of the fact that objc_library depends on lib_names and that list contains a swift_library compilation errors and/or undesired behaviour can happen depending on the list of defines passed to rules_ios.

This is due to the fact that the defines attribute is propagated "as is" via **kwargs to both libraries and there's no way in the current API to differentiate Swift macros and Objective-C macros.

See this repo with details and instructions on how to repro a behaviour that can also happen with consumers of the apple_library macro.

Possible solution here is to introduce swift_defines and objc_defines so consumers can explicitly set them independently (from an API perspective this would be consistent with the current split for copts too, i.e. swift_copts and objc_copts).