apple_resource
An apple_resource()
rule contains sets of resource directories, files and file variants that can be bundled in an application bundle. This rule does not have any output on its own and can be built only as a dependency (either direct or transitive) of an apple_bundle()
rule.
Function Signature
def apple_resource(
*,
name: str,
default_target_platform: None | str = None,
target_compatible_with: list[str] = [],
compatible_with: list[str] = [],
exec_compatible_with: list[str] = [],
visibility: list[str] = [],
within_view: list[str] = ["PUBLIC"],
metadata: OpaqueMetadata = {},
tests: list[str] = [],
modifiers: OpaqueMetadata = [],
_apple_platforms: dict[str, str] = {},
codesign_entitlements: None | str = None,
codesign_flags_override: None | list[str] = None,
codesign_on_copy: bool = False,
contacts: list[str] = [],
content_dirs: list[str] = [],
default_host_platform: None | str = None,
destination: None | str = None,
dirs: list[str] = [],
files: list[str] = [],
labels: list[str] = [],
licenses: list[str] = [],
named_variants: dict[str, list[str]] = {},
resources_from_deps: list[str] = [],
skip_universal_resource_dedupe: bool = False,
variants: list[str] = [],
) -> None
Parameters
-
name
: (required)name of the target
-
default_target_platform
: (defaults to:None
)specifies the default target platform, used when no platforms are specified on the command line
-
target_compatible_with
: (defaults to:[]
)a list of constraints that are required to be satisfied for this target to be compatible with a configuration
-
compatible_with
: (defaults to:[]
)a list of constraints that are required to be satisfied for this target to be compatible with a configuration
-
exec_compatible_with
: (defaults to:[]
)a list of constraints that are required to be satisfied for this target to be compatible with an execution platform
-
visibility
: (defaults to:[]
)a list of visibility patterns restricting what targets can depend on this one
-
within_view
: (defaults to:["PUBLIC"]
)a list of visibility patterns restricting what this target can depend on
-
metadata
: (defaults to:{}
)a key-value map of metadata associated with this target
-
tests
: (defaults to:[]
)a list of targets that provide tests for this one
-
modifiers
: (defaults to:[]
)an array of modifiers associated with this target
-
codesign_on_copy
: (defaults to:False
)Indicates whether the files specified in the files arg in this resource should be code signed with the identity used to sign the overall bundle. This is useful for e.g. dylibs or other additional binaries copied into the bundle. The caller is responsible to ensure that the file format is valid for codesigning.
-
content_dirs
: (defaults to:[]
)Set of paths of directories containing resource files that should be placed in an application bundle. Unlike
dirs
, the directories themselves are not placed in the bundle. -
destination
: (defaults to:None
)Specifies the destination in the final application bundle where resource will be copied. Possible values: "resources", "frameworks", "executables", "plugins", "xpcservices".
-
dirs
: (defaults to:[]
)Set of paths of resource directories that should be placed in an application bundle.
-
files
: (defaults to:[]
)Set of paths of resource files that should be placed in an application bundle.
-
named_variants
: (defaults to:{}
)Mapping from a variant name to the list of resource file paths which should be placed in an application bundle. Those files will be placed in a directory with name equal to the corresponding key in this mapping. Keys should end with
.lproj
suffix. (e.g.Base.lproj
,en.lproj
). -
resources_from_deps
: (defaults to:[]
)Set of build targets whose transitive
apple_resource
s should be considered as part of the current resource when collecting resources for bundles.Usually, an
apple_bundle
collects allapple_resource
rules transitively reachable through apple_library rules. This field allows for resources which are not reachable using the above traversal strategy to be considered for inclusion in the bundle. -
variants
: (defaults to:[]
)Set of paths of resource file variants that should be placed in an application bundle. The files mentioned here should be placed in a directory named
$VARIANT_NAME.lproj
, where$VARIANT_NAME
is the name of the variant (e.g.Base
,en
). This argument makes it possible to use different resource files based on the active locale.
Examples
apple_resource(
name = 'Images',
files = glob([
'*.png',
]),
dirs = [
'PrettyImages',
],
)