bazelbuild / rules_apple

Bazel rules to build apps for Apple platforms.
Apache License 2.0
510 stars 267 forks source link

`implementation_deps` could cause an unexpected dynamic framework loss #2406

Open xiemotongye opened 8 months ago

xiemotongye commented 8 months ago

Bazel 6.3 supported implementation_deps in objc_library.

We use bazel to organize & build our iOS application. All works fine while using deps. But when I tring to replace deps to implementation_deps, I found implementation_deps could cause an unexpected dynamic framework loss.

Here is an example:

load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_apple//apple:apple.bzl", "apple_dynamic_xcframework_import")

ios_application(
    name = "MyApp",
    deps = ":MyLib",
    ...
)

objc_library(
    name = "MyLib",
    srcs = [
        "MyLib.m",
    ],
    implementation_deps = [
        ":FBSDKCoreKit_framework",
        ...
    ],
)

apple_dynamic_xcframework_import(
    name = "FBSDKCoreKit_framework",
    xcframework_imports = glob(["FacebookSDK/FBSDKCoreKit.xcframework/**"]),
)

The FBSDKCoreKit.framework would be lost in the final payload.

xiemotongye commented 8 months ago

I've sent a PR to fix this. @keith Can you have a look?

https://github.com/bazelbuild/rules_apple/pull/2407

This issue may not cause compilation failures, but rather cause runtime crashes. This makes the problem more difficult to detect, and may cause serious online crashes.