Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Producing .xcframeworks #1249

Closed
keith opened this issue Oct 26, 2021 · 7 comments
Closed

Producing .xcframeworks #1249

keith opened this issue Oct 26, 2021 · 7 comments
Labels
P1 We need to fix this right away

Comments

@keith
Copy link
Member

keith commented Oct 26, 2021

This is just a tracking issue for producing xcframeworks, since this is a common use case we should support

@keith keith pinned this issue Oct 26, 2021
@keith keith added the P1 We need to fix this right away label Oct 26, 2021
@mathaeus
Copy link

@keith @brentleyjones

From what I see adding xcframework support was added here? Or am I wrong about that?

Are you planning on releasing this anytime soon?


I gave the whole thing a shot and I think I ran into a bug, or the thing is just not ready yet.
Anyway here's what I tried:

WORKSPACE file

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

... 

git_repository(
    name = "build_bazel_rules_apple",
    remote = "https://github.com/bazelbuild/rules_apple.git",
    branch = "master",
)

BUILD file

load("@build_bazel_rules_apple//apple:apple.bzl", "apple_xcframework")

...

apple_xcframework(
    name = "MyFramework",
    bundle_id = "com.foo.bar",
    deps = [
        ":SomeObjcDep",
        "@ios_opencv//:OpencvFramework",
    ],
    families_required = { "ios": "iphone" },
    infoplists = ["Info.plist"],
    ios = {"device": "arm64"},
    minimum_deployment_os_versions = {"ios": "14.0"},
    minimum_os_versions = {"ios": "14.0"}
)

I then run into that error:

ERROR: /private/var/tmp/_bazel_mathaeus/7daf80b34ca02d70eeaf84c8ae68b14f/external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl:326:19: name 'json' is not defined
ERROR: /private/var/tmp/_bazel_mathaeus/7daf80b34ca02d70eeaf84c8ae68b14f/external/build_bazel_rules_apple/apple/internal/xcframework_rules.bzl:390:19: name 'json' is not defined

Seems like it can't find the json encoder.


Please let me know if I'm on the right track here or how I could try out apple_xcframework (if it's ready).

Thanks!

@brentleyjones
Copy link
Collaborator

Are you using bazel 5.0? The next release will require it (which is why we haven't made a release yet, as it's still in RC).

@mathaeus
Copy link

Thanks for the quick reply @brentleyjones.

No, the project I'm trying to run has 3.7.2 in its .bazelversion, and from what I can see bazelisk was using that version therefore.

So bazel 5.0 is a requirement then for this, if I understand correctly?

@brentleyjones
Copy link
Collaborator

Yes. And Bazel 4.x is required for the latest release (or, that is all we tested it with, it might somehow work with 3.7.2).

@cpsauer
Copy link
Contributor

cpsauer commented Feb 6, 2022

Was this solved by the recent 0.33.0 release?

(Saw "Add rule for producing xcframeworks for iOS" in the release notes)

@thii
Copy link
Member

thii commented Feb 7, 2022

Partially, yes. There's still missing support for producing XCFrameworks bundling static frameworks.

@keith
Copy link
Member Author

keith commented Feb 7, 2022

I think we can close this overarching issue now since it works for many cases, and using libraries over frameworks is probably fine in many cases. We can file a separate tracking issue for that if we want to.

@keith keith closed this as completed Feb 7, 2022
@thii thii unpinned this issue Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 We need to fix this right away
Projects
None yet
Development

No branches or pull requests

5 participants