bazelbuild / rules_apple

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

`apple_dynamic_xcframework_import` unnecessarily bundles `.abi.json` files #2510

Closed vakhidbetrakhmadov closed 2 months ago

vakhidbetrakhmadov commented 3 months ago

Hi,

I am using apple_dynamic_xcframework_import with a pre-built dynamic xcframework

apple_dynamic_xcframework_import(
    name = "PhoneNumberKit",
    xcframework_imports = glob(["PhoneNumberKit.xcframework/**"]),
)

The xcframework in contains .abi.json files

$ find PhoneNumberKit.xcframework -name '*.abi.json'
PhoneNumberKit.xcframework/ios-arm64_x86_64-simulator/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/arm64-apple-ios-simulator.abi.json
PhoneNumberKit.xcframework/ios-arm64_x86_64-simulator/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/x86_64-apple-ios-simulator.abi.json
PhoneNumberKit.xcframework/ios-arm64/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/arm64-apple-ios.abi.json

When i build an app that depends on the xcframework and examine the app bundle, i can see that it contains .abi.json files

ios_application(
    name = "MyApp",
    ...
    deps = [
        ":PhoneNumberKit",
        ...
    ],
)
$ bazelisk build MyApp
...
$ mv bazel-bin/MyApp.ipa bazel-bin/MyApp.zip 
$ unzip -qq bazel-bin/MyApp.zip
$ find Payload/MyApp.app -name '*.abi.json'
Payload/MyApp.app/Frameworks/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/arm64-apple-ios-simulator.abi.json
Payload/MyApp.app/Frameworks/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/x86_64-apple-ios-simulator.abi.json

I have created a minimal repro example: https://github.com/vakhidbetrakhmadov/repro/tree/main

vakhidbetrakhmadov commented 3 months ago

.abi.json files are added to bundling_imports over here. Would it make sense to add a condition and ignore them ?