force_load_direct_deps(name, deps, minimum_os_version, platform_type, should_force_load)
A rule to link with -force_load
for directdeps
ld has different behavior when loading members of a static library VS objects
as far as visibility. Under -dynamic
- linked swift object files can have public visibility
- symbols from swift static libraries are omitted unless used, and not visible otherwise
By using -force_load
, we can load static libraries in the attributes of an
application's direct depenencies. These args need go at the front of the
linker invocation otherwise these arguments don't work with lds logic.
Why not put it into rules_apple
? Ideally it could be, and perhaps consider a
PR to there .The underlying java rule, AppleBinary.linkMultiArchBinary
places extraLinkopts
at the end of the linker invocation. At the time of
writing these args need to go into the current rule context where
AppleBinary.linkMultiArchBinary
is called.
One use case of this is that iOS developers want to load above mentioned symbols from applications. Another alternate could be to create an aspect, that actually generates a different application and linker invocation instead of force loading symbols. This could be more complicated from an integration perspective so it isn't used.
ATTRIBUTES
Name | Description | Type | Mandatory | Default |
---|---|---|---|---|
name | A unique name for this target. | Name | required | |
deps | Deps | List of labels | required | |
minimum_os_version | Internal - currently rules_ios the dict platforms |
String | optional | "" |
platform_type | Internal - currently rules_ios uses the dict platforms |
String | optional | "" |
should_force_load | Allows parametrically enabling the functionality in this rule. | Boolean | optional | True |