-
Notifications
You must be signed in to change notification settings - Fork 273
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
Roadmap: Distributable Dynamic Framework #355
Comments
This looks good. |
Name possibilities:
|
For 1 |
I believe this proposal lines up quite nicely with the announcement of XCFrameworks. Given that this is becoming the official way of distributing binary frameworks, the new rule should be called something like I talked to Harlan (they guy who presented XCFrameworks in the WWDC talk) and he mentioned that this supports static and dynamic frameworks, and with the introduction of the One caveat for Swift is that Swift enforces that the framework bundle name is the same as the Swift module included in the framework, so we'll need to figure out the best way to enforce this restriction, and how to make sure that a mixed Objc/Swift framework is properly configured. For the former, one way would be to enforce that there is a single
|
We're using a custom made rule for distributing a swift framework that can be found here envoyproxy/envoy-mobile#188 |
Hi @keith , thanks for sharing. I'm new to Bazel. Do we have the custom rule for making a Dynamic framework? Or any idea how to do it? |
If you're doing it in the build you can use ios_framework |
I want to make it a bundled framework, can drag and drop to be used for another project. Similar to swift_static_framework custom rule as you mentioned. |
This rule hasn't been added yet. I'm not sure if anyone has tried to make their own custom rule yet. |
We're using https://github.com/fenollp/mediapipe/blob/facial-search/mediapipe/examples/facial_search/ios/BUILD#L58-L76 to build a distributable Obj-C++ iOS Framework. It's not a rule but a hacky script. I'd like to help move this issue forward. Is creating a multiplatform |
I would check out https://github.com/line/rules_apple_line/blob/master/docs/README.md#objc_static_framework , I have had some success with it lately |
You can now use |
I filed #1249 as a tracking issue for supporting producing xcframeworks If there were any other issues I'm missing with these 2 please file a new one! |
Hi Keith, @keith |
There have been multiple requests to expand
ios_framework
into something that can be imported into Xcode, or distributed to a build system outside of Bazel (#81, #112, #301).The intent of the ios_framework rule is described here, but as a short summary, its intent is to automatically gather common code and assets to reduce binary and resource size of ipas that have shared dependencies between the application and extensions within a Bazel build, and not for distribution or dependency management.
I believe that the fact that
ios_framework
produces an output that's similar to a distributable dynamic framework is the main source of confusion here. In hindsight,ios_framework
isn't the best name for its purpose.In order to clear this up and resolve this confusion, I'm proposing the following:
1. Rename
ios_framework
toapple_bundling_framework
/ios_bundling_framework
This rule will perform the duties that
ios_framework
currently performs, which is to reduce the binary and resource size in ipas. Same as today, this rule will only be allowed inframework
attributes of top-level rules, likeios_application
andios_extension
. Whether we can make this rule name platform-type agnostic will depend on how flexible the configuration transitions work in Bazel is to allow this use case.2. Create a new rule
ios_dynamic_framework
This new rule will output a distributable dynamic framework as requested by rules_apple clients. This rule will not be allowed to be a dependency on other rules_apple's rules, or nor
objc_library
orswift_library
. Its sole purpose will be for it to be taken from a Bazel build environment to another build system, and will package modulemaps and headers.Why not allow
ios_dynamic_framework
as dependency toobjc_library
/swift_library
targets?By allowing
ios_dynamic_framework
as dependencies toobjc_library
orswift_library
targets, we introduce a path in which it would be fairly simple to introduce duplicate symbols warnings at runtime.Say for example you have
ios_dynamic_framework(Foo)
andios_dynamic_framework(Bar)
that depends onobjc_library(Base)
. TheBase
library would be linked into both dynamic frameworks, triggering theduplicate symbol
warning messages at runtime, and also duplicating binary size for `Base.You could in theory wrap
Base
inside anotherios_dynamic_framework
to avoid this issue, but this just means that to avoid this problem, you'd need to convert everyobjc_library
target into anios_dynamic_framework
, which might lead to too many dynamic frameworks being loaded at runtime.This approach also removes control from
ios_application
owners into deciding whether they'd like to have their app statically or dynamically linked, especially if they're sensitive todyld
load times.cc: @keith, @steeve
The text was updated successfully, but these errors were encountered: