You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an app that consists of a single Swift/ObjC module, specified using an ObjC and a Swift rule, and a similar unit test module using an ObjC and a Swift rule. However, when running bazel build MyAppUnitTests --apple_platform_type=ios, I get a mysterious set of errors:
Sources/MyHeader.h:34:5: error: redefinition of enumerator 'MyEnumerator'
<many more similar redefinition errors>
a.swift:1:18: warning: implicit import of bridging header 'MyApp-Bridging-Header.h' via module 'MyApp' is deprecated and will be removed in a later version of Swift
a.swift is the one file in the unit test module's Swift rule, and it simply consists of @testable import MyApp, which imports the bridging header from the MyApp module. It also imports the bridging header for unit tests via copts = ["-import-objc-header", TEST_BRIDGING_HEADER], which itself imports the MyApp bridging header too (#import "MyApp-Bridging-Header.h"). These two seem to be fine together, i.e. no double-importing. However, that last import is overlooked by swiftc, because the warning it gives in the bottom of that error message implies that that import isn't occurring, though we can see it is. So then it implicitly imports the bridging header itself, and we end up with lots of duplicate definitions from this double importing.
What's weird is that certain seemingly innocuous changes will fix it. Adding or removing certain files, or removing module_name = MyAppHeaders below (even though that module name is never used anywhere in code), can cause it to reliably work again. As well, it works regardless when using rules_swift prior to 410d8ed ("Only read output_file_map if it's going to be written").
Below is a minimal example with placeholder files like a.m that contain very little. However, I wasn't able to get it down to an example trivial enough to share (you can see some globs in there). This is because removing certain files suddenly makes it work again.
I believe I am seeing a similar error (seen here bazel-ios/rules_ios#157), I am able to build my module successfully, but I cannot test that module without seeing duplication errors
I have an app that consists of a single Swift/ObjC module, specified using an ObjC and a Swift rule, and a similar unit test module using an ObjC and a Swift rule. However, when running
bazel build MyAppUnitTests --apple_platform_type=ios
, I get a mysterious set of errors:a.swift
is the one file in the unit test module's Swift rule, and it simply consists of@testable import MyApp
, which imports the bridging header from the MyApp module. It also imports the bridging header for unit tests viacopts = ["-import-objc-header", TEST_BRIDGING_HEADER]
, which itself imports the MyApp bridging header too (#import "MyApp-Bridging-Header.h"
). These two seem to be fine together, i.e. no double-importing. However, that last import is overlooked by swiftc, because the warning it gives in the bottom of that error message implies that that import isn't occurring, though we can see it is. So then it implicitly imports the bridging header itself, and we end up with lots of duplicate definitions from this double importing.What's weird is that certain seemingly innocuous changes will fix it. Adding or removing certain files, or removing
module_name = MyAppHeaders
below (even though that module name is never used anywhere in code), can cause it to reliably work again. As well, it works regardless when using rules_swift prior to 410d8ed ("Only read output_file_map if it's going to be written").Below is a minimal example with placeholder files like
a.m
that contain very little. However, I wasn't able to get it down to an example trivial enough to share (you can see some globs in there). This is because removing certain files suddenly makes it work again.The text was updated successfully, but these errors were encountered: