bazel-ios/rules_ios

Transitive framework import causes release build fail

qyang-nj opened this issue · 5 comments

If we have an apple_framework transitively depends on framework_import, the build will fail with --compilation_mode=opt. In the following code, Module2 is not able to build. The same error will occur with --features=swift.cacheable_swiftmodules.

apple_dynamic_framework_import(
    name = "PrebuiltFramework",
)

apple_framework(
    name = "Module1",
    deps = [":PrebuiltFramework"],
)

apple_framework(
    name = "Module2",
    deps = [":Module1"],
)

With either --compilation_mode=opt or --features=swift.cacheable_swiftmodules, swift_library will stop passing -serialize-debugging-options to swiftc. Unfortunately, it seems we are relying on the search paths embedded in .swiftmodule for transitive framework imports. We should explicitly provide those search paths to the compiler.

I have sample repro code and steps here.

I have a fix in mind and will validate it and submit a PR.

I guess we should re-open this give #715? Or should we track in a diff issue instead?

cc @mattrobmattrob @qyang-nj

I guess we should re-open this give #715? Or should we track in a diff issue instead?

cc @mattrobmattrob @qyang-nj

Was going to reach out to @qyang-nj once I confirmed/merged the fix and better test case for validation. But I'm okay with whatever. Reopening this probably makes sense.

I'm adding a proper test to catch this regression via #713.

Thanks for adding the tests. I'll take a look at this again.