bazel-xcode / PodToBUILD

An easy way to integrate CocoaPods into Bazel
Apache License 2.0
323 stars 69 forks source link

ComScore Pod: apple_static_framework_import misconfigured #196

Open mcarrillowz opened 2 years ago

mcarrillowz commented 2 years ago

Hi, I'm trying to use https://cocoapods.org/pods/ComScore, the pod is installed successfully but when I try to use it as a dependency, it fails when building:

ERROR: Vendor/ComScore/BUILD.bazel:306:30: in apple_static_framework_import rule //Vendor/ComScore:Dynamic_VendoredFrameworks:
Traceback (most recent call last):
    File "/private/var/tmp/_bazel_mario/5305db3be187c80548e71a802cd37527/external/build_bazel_rules_apple/apple/internal/apple_framework_import.bzl", line 394, column 48, in _apple_static_framework_import_impl
        framework_groups = _grouped_framework_files(framework_imports)
    File "/private/var/tmp/_bazel_mario/5305db3be187c80548e71a802cd37527/external/build_bazel_rules_apple/apple/internal/apple_framework_import.bzl", line 158, column 48, in _grouped_framework_files
        framework_groups = group_files_by_directory(
    File "/private/var/tmp/_bazel_mario/5305db3be187c80548e71a802cd37527/external/build_bazel_rules_apple/apple/utils.bzl", line 117, column 13, in group_files_by_directory
        fail("Expected only files inside directories named with the extensions " +
Error in fail: Expected only files inside directories named with the extensions ["framework"], but found: [
  Vendor/ComScore/ComScore/dynamic/ComScore.xcframework/Info.plist
] framework_imports

Taking a look at the error it fails in the following:

apple_static_framework_import(
  name = "Dynamic_VendoredFrameworks",
  framework_imports = select(
    {
      "//conditions:default": glob(
        [
          "ComScore/dynamic/ComScore.xcframework/**"
        ]
      ),
      ":tvosCase": glob(
        [
          "ComScore/dynamic/ComScore.xcframework/**"
        ]
      )
    }
  ),
  visibility = [
    "//visibility:public"
  ]
)

The folder structure is as follows:

- ComScore/
  - dynamic/
    - ComScore.xcframework/
      - ios-arm64_armv7/ComScore.framework/
      - ios-arm64_i386_x86_64-simulator/ComScore.framework/
      - tvos-arm64/ComScore.framework
      - tvos-arm64_x86_64-simulator/ComScore.framework/

I can fix it if I set the framework_imports as ComScore/dynamic/ComScore.xcframework/*/*.framework/**.

Here is the new_pod_repository that I'm using:

new_pod_repository(
  name = "ComScore",
  url = "https://github.com/comScore/ComScore-iOS-watchOS-tvOS/archive/6.8.1.zip",
)