Created by: robbertvanginkel
This PR proposes a way to embed prebuilt dynamic frameworks into apple_bundle
s, linking that framework against the binary for the apple bundle. This is a start to solving #440 (closed), in buck it (mostly) works, the project generation still has to be done. The rule syntax for this would be:
prebuilt_apple_framework(
name = 'BuckTest',
framework = 'BuckTest.framework',
)
You can add this rule to an apple_library or apple_binary, this should do the following:
- Symlink the
Headers
folder inside the framework as the exposed headers for the rule. - Export linkerflag
-rpath @loader_path/Frameworks
/-rpath @executable_path/Frameworks
- Export the linkerflag
-framework <frameworkname>
, and-F path/to/framework/
- Embed the framework in the bundle's "Frameworks" folder
I'm however encountering the following problem when trying to embed the framework: the INCLUDE_FRAMEWORKS
flavor is tied to apple_library
's FRAMEWORK
flavor, and I don't want that. This happens in AppleDescriptions.java. I have the following situation: an apple_binary (wrapped in apple_bundle) with two dependencies: a prebuilt_apple_framework
and an apple_libary
. I want to statically link the apple_library
, and embed and dynamically link the prebuilt_apple_framework
. The probelm is, when I build the apple_binary
with #INCLUDE_FRAMEWORKS
, the mentioned code in AppleDescriptions goes through the deps and requires them with the FRAMEWORK_FLAVOR
, which tries to embed the apple_library as a framework which is broken.
I sort of avoided this by making apple_binary not require the framework flavor, but this is inconsistent and will cause headaches. Suggestions on how to move forward with this?