bazelbuild / bazelbuild/rules_apple

Importing macOS prebuilt dynamic framework error.

Open
#1,040 12 comments 2 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
593
Forks
334
Avg merge
16h 48m
Merged PRs (30d)
9

Description

Hello!

I am trying to import CouchbaseLite/Swift macOS framework to no avail.

## carthage BUILD

```
load("@build_bazel_rules_apple//apple:apple.bzl",
"apple_dynamic_framework_import",
"apple_static_framework_import")

apple_dynamic_framework_import(
name = "CouchbaseLiteSwift",
framework_imports = glob(["Build/Mac/CouchbaseLiteSwift.framework/**"]),
visibility = ["//visibility:public"]
)
```

### macapp BUILD

```
swift_library(
name = "MYAPPmacOSLib",
module_name = "MYAPPmacOSLib",
srcs = glob(["**/*.swift"]),
copts = swift_library_compiler_flags(),
data = glob([
"**/*.storyboard",
"**/*.xib",
"**/*.xcassets/**",
"**/*.plist",
"**/*.json",
]) + ["//Fonts"],
deps = [
"//Carthage:CouchbaseLiteSwift",
],
)

macos_application(
name = "MYAPPmacOS",
bundle_id = "com.muiz.idn.MYAPP.mac",
entitlements = "MYAPPmacOS.entitlements",
app_icons = [":AppIcon"],
resources = [":Assets"],
minimum_os_version = "10.14",
infoplists = [
"Plist_Info.plist",
"Plist_Keychain.plist"
],
visibility = ["//visibility:public"],
provisioning_profile = mac_provisioning_profile(),
deps = [
":MYAPPmacOSLib",
],
)
```

## Error

```
/usr/bin/codesign -v --sign AAC104FA2D53A5AF92BBF4556539B752E50D9B4F --force bazel-out/darwin_x86_64-dbg/bin/MYAPP/MYAPPmacOS/MYAPPmacOS-intermediates/_imported_frameworks/CouchbaseLiteSwift.framework
```

```
bazel-out/darwin_x86_64-dbg/bin/MYAPP/MYAPPmacOS/MYAPPmacOS-intermediates/_imported_frameworks/CouchbaseLiteSwift.framework: bundle format is ambiguous (could be app or framework)
```

## Success

```
/usr/bin/codesign -v --sign AAC104FA2D53A5AF92BBF4556539B752E50D9B4F --force bazel-out/darwin_x86_64-dbg/bin/MYAPP/MYAPPmacOS/MYAPPmacOS-intermediates/_imported_frameworks/CouchbaseLiteSwift.framework/Versions/A/
```

```
bazel-out/darwin_x86_64-dbg/bin/MYAPP/MYAPPmacOS/MYAPPmacOS-intermediates/_imported_frameworks/CouchbaseLiteSwift.framework/Versions/A/: signed bundle with Mach-O thin (x86_64) [com.couchbase.CouchbaseLiteSwift]
```

Note that the success one point to `Versions/A` rather than root `framework` directory

Contributor guide

Open the contributing guide

Research direction

Start with the `apple_dynamic_framework_import` rule in the `carthage BUILD` file and compare the failing codesign command with the successful command targeting `CouchbaseLiteSwift.framework/Versions/A/`. Reproduce the macOS build using the shown `macos_application` dependency and determine what is needed for the imported framework to sign without the ambiguous bundle-format error.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.