rules_apple icon indicating copy to clipboard operation
rules_apple copied to clipboard

Importing macOS prebuilt dynamic framework error.

Open muizidn opened this issue 5 years ago • 12 comments

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

muizidn avatar Jan 15 '21 00:01 muizidn

Specifically what issues are you seeing?

keith avatar Jan 15 '21 00:01 keith

@keith ah, sorry, just updated/edited the issue. Wrongly sent before finish. Thank you!

muizidn avatar Jan 15 '21 00:01 muizidn

Interesting, looks like this was reported before as well https://github.com/bazelbuild/rules_apple/issues/737

To be sure does the framework's plist specify FMWK as the type? (based on some other cases I found of this error on the internet it sounds like it might still be broken even with that, but I'm curious)

keith avatar Jan 15 '21 01:01 keith

Yes it correctly specifies FMWK as in CouchbaseLiteSwift.framework/Resources/Info.plist

	<key>CFBundleName</key>
	<string>CouchbaseLiteSwift</string>
	<key>CFBundlePackageType</key>
	<string>FMWK</string>
	<key>CFBundleShortVersionString</key>
	<string>2.8.0</string>
	<key>CFBundleSupportedPlatforms</key>
	<array>
		<string>MacOSX</string>
	</array>

muizidn avatar Jan 15 '21 01:01 muizidn

looks like that project is a bit too old for me to build in Xcode 12. Do you think you could provide a minimized repro case?

keith avatar Jan 15 '21 01:01 keith

@keith Hope this help to enable issue reproduction https://github.com/muizidn/github.com-bazelbuild-rules_apple-issues-1040

muizidn avatar Jan 15 '21 14:01 muizidn

https://github.com/bazelbuild/rules_apple/blob/master/doc/frameworks.md

muizidn avatar Jan 25 '21 12:01 muizidn

This is still an issue right? Just no one has had a chance to investigate yet?

keith avatar Jan 25 '21 17:01 keith

Yes, this is still an issue. About the documentation, am I misunderstand that macOS framework doesn't supported yet?

muizidn avatar Jan 25 '21 21:01 muizidn

Ah that's what you were referring to. I think those docs are a bit outdated, but the framework import rules are supposed to work with macOS either way. For example here's 1 in a test on macOS:

https://github.com/bazelbuild/rules_apple/blob/8562971108c11931618a220731c335e9fab9fb49/test/starlark_tests/targets_under_test/macos/BUILD#L210-L214

keith avatar Jan 25 '21 22:01 keith

Ah, okay. Didn't see that. Thank you. I'll reopen this issue.

muizidn avatar Jan 25 '21 22:01 muizidn

can we skip internal code sign, and pass custom path here codesign_inputs ? could it solve this issue?

wendyliga avatar Aug 30 '21 11:08 wendyliga