apple_bundle
An apple_bundle()
rule takes an Apple binary and all of the resources and asset catalogs in the rule's transitive dependencies and generates a bundle containing all of those files. Optionally the generated bundle can also be signed using specified provisioning profiles.
Details
Code signing will embed entitlements pointed to by the entitlements_file
arg in
the bundle's apple_binary
. This is the preferred way to specify entitlements
when building with Buck.
If the entitlements file is not present, it falls back to the CODE_SIGN_ENTITLEMENTS
entry in
info_plist_substitutions
.
If after these checks, an entitlements file is still not specified, it will be derived based
on the entitlements of the selected provisioning profile. Provisioning profiles will be selected
from profiles pointed to by apple.provisioning_profile_search_path
, based on a
non-expired profile that matches the bundle id and entitlements.
Code signing will embed entitlements pointed to by the CODE_SIGN_ENTITLEMENTS
entry in
info_plist_substitutions
. If an entitlements file is omitted, it will be derived based
on the entitlements of the selected provisioning profile. Provisioning profiles will be selected
from profiles pointed to by apple.provisioning_profile_search_path
, based on a
non-expired profile that matches the bundle id and entitlements.
Function Signature
def apple_bundle(
*,
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] = {},
_apple_toolchain: str = "gh_facebook_buck2_shims_meta//:apple-bundle",
_apple_tools: str = "prelude//apple/tools:apple-tools",
_apple_xctoolchain: str = "gh_facebook_buck2_shims_meta//:apple-xctoolchain",
_apple_xctoolchain_bundle_id: str = "gh_facebook_buck2_shims_meta//:apple-xctoolchain-bundle-id",
_bundling_cache_buster: None | str = None,
_bundling_log_file_enabled: bool = False,
_bundling_log_file_level: None | str = None,
_code_signing_configuration: None | str = None,
_codesign_command_override: None | str = None,
_codesign_entitlements: None | str = None,
_codesign_identities_command_override: None | str = None,
_codesign_type: None | str = None,
_compile_resources_locally_override: None | bool = None,
_dsymutil_extra_flags: list[str],
_dsymutil_verify_dwarf: str,
_embed_provisioning_profile_when_adhoc_code_signing: None | bool = None,
_fast_adhoc_signing_enabled_default: bool = select({"prelude//features/apple:fast_adhoc_signing_disabled": False, "prelude//features/apple:fast_adhoc_signing_enabled": True, "DEFAULT": True}),
_fast_provisioning_profile_parsing_enabled: bool = False,
_incremental_bundling_enabled: bool = False,
_info_plist_identify_build_system_default: bool = False,
_profile_bundling_enabled: bool = False,
_provisioning_profiles: str = "gh_facebook_buck2_shims_meta//xplat/buck2/platform/apple:provisioning_profiles",
_resource_bundle: None | str = None,
_skip_adhoc_resigning_scrubbed_frameworks_default: bool = select({"prelude//features/apple/constraints:skip_adhoc_resigning_scrubbed_frameworks_disabled": False, "prelude//features/apple/constraints:skip_adhoc_resigning_scrubbed_frameworks_enabled": True, "DEFAULT": False}),
_skip_adhoc_resigning_scrubbed_frameworks_override: None | bool = None,
_strict_provisioning_profile_search_default: bool = select({"prelude//features/apple:strict_provisioning_profile_search_enabled": True, "DEFAULT": True}),
_use_entitlements_when_adhoc_code_signing: None | bool = None,
asset_catalogs_compilation_options: dict[str, typing.Any] = {},
binary: None | str = None,
bundle_type: None | str = None,
code_signing_configuration: None | str = None,
codesign_flags: list[str] = [],
codesign_identity: None | str = None,
codesign_type: None | str = None,
contacts: list[str] = [],
copy_public_framework_headers: None | bool = None,
debug_artifacts_validators: dict[str, (str, str)] = {},
default_host_platform: None | str = None,
default_platform: None | str = None,
deps: list[str] = [],
dsym_uses_parallel_linker: bool = select({"prelude//features/apple:dsym_uses_parallel_linker_enabled": True, "DEFAULT": False}),
embed_provisioning_profile_when_adhoc_code_signing: bool = False,
embed_xctest_frameworks: bool = select({"prelude//marker/apple/constraints:embed_xctest_frameworks_enabled": True, "DEFAULT": False}),
extension: str,
fast_adhoc_signing_enabled: None | bool = None,
ibtool_flags: None | list[str] = None,
incremental_bundling_enabled: None | bool = None,
info_plist: str,
info_plist_identify_build_system: None | bool = None,
info_plist_substitutions: dict[str, str] = {},
labels: list[str] = [],
licenses: list[str] = [],
module_map: None | str = None,
platform_binary: None | list[(str, str)] = None,
privacy_manifest: None | str = None,
product_name: None | str = None,
product_name_from_module_name: bool = False,
propagated_target_sdk_version: None | str = None,
provisioning_profile_filter: None | str = None,
resource_group: None | str = None,
resource_group_map: None | str = None,
selective_debugging: None | str = None,
skip_adhoc_resigning_scrubbed_frameworks: None | bool = None,
skip_copying_swift_stdlib: None | bool = None,
split_arch_dsym: bool = False,
strict_provisioning_profile_search: None | bool = None,
try_skip_code_signing: None | bool = None,
universal: None | bool = None,
use_entitlements_when_adhoc_code_signing: bool = False,
validation_deps: list[str] = [],
versioned_macos_bundle: bool = select({"prelude//features/apple/constraints:versioned_macos_bundle_false": False, "prelude//features/apple/constraints:versioned_macos_bundle_true": True, "DEFAULT": False}),
xcode_product_type: None | str = None,
xcode_scheme_settings: None | str = None,
) -> 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
-
asset_catalogs_compilation_options
: (defaults to:{}
)A dict holding parameters for asset catalogs compiler (actool). Its options include:
notices
(defaults toTrue
)warnings
(defaults toTrue
)errors
(defaults toTrue
)compress_pngs
(defaults toTrue
)optimization
(defaults to'space'
)output_format
(defaults to'human-readable-text'
)extra_flags
(defaults to[]
)
-
deps
: (defaults to:[]
)A list of dependencies of this bundle as build targets. You can embed application extensions by specifying the extension's bundle target. To include a WatchKit app, append the flavor
#watch
to the target specification. Buck will automatically substitute the appropriate platform flavor (eitherwatchsimulator
orwatchos
) based on the parent. -
extension
: (required)The extension of the generated bundle. For example
'app'
for an application bundle or'appex'
for an application extension bundle. -
ibtool_flags
: (defaults to:None
)List of flags to be passed to ibtool during interface builder file compilation.
-
info_plist
: (required)A path to an
Info.plist
file that will be placed in the bundle. The specified file will be processed by substituting variable names with their values (seeinfo_plist_substitutions
for more information). -
info_plist_substitutions
: (defaults to:{}
)A dictionary that assigns variable names to their values. It is used for variable substitution when processing the file specified in
info_plist
. For example if this argument is set to{'VAR': 'MyValue'}
, then each occurrence of$(VAR)
or${VAR}
in the file will be replaced byMyValue
. -
privacy_manifest
: (defaults to:None
)A path to an
.xcprivacy
file that will be placed in the bundle. -
product_name
: (defaults to:None
)The name of the resulting bundle and binary. The setting behaves like PRODUCT_NAME Xcode build setting. For example, if your rule is named "MyApp" and extension is "app", by default buck will generate MyApp.app bundle. But if you will set product name to "SuperApp", bundle will get "SuperApp.app" name.
-
xcode_scheme_settings
: (defaults to:None
)Optional settings to set on schemes when this target is represented in Xcode.
Examples
apple_bundle(
name = 'AppBundle',
binary = ':MyBinary',
extension = 'app',
info_plist = 'Info.plist',
)
# iOS app with embedded WatchOS 2.0 app/extension
apple_bundle(
name = 'DemoWatchAppExtension',
binary = ':DemoWatchAppExtensionBinary',
extension = 'appex',
info_plist = 'WatchExtension/Resources/Info.plist',
)
apple_bundle(
name = 'DemoWatchApp',
binary = ':DemoWatchAppBinary',
deps = [':DemoWatchAppResources', ':DemoWatchAppExtension'],
extension = 'app',
info_plist = 'WatchApplication/Info.plist',
)
apple_bundle(
name = 'DemoApp',
binary = ':DemoAppBinary',
deps = [':DemoWatchApp#watch'],
extension = 'app',
info_plist = 'Info.plist',
)
# iOS app using safeAreaInsets delivering to iOS 9.x
apple_bundle(
name = 'DemoIBApp',
binary = ':DemoIBAppBinary',
deps = [':DemoIBAppResources'],
extension = 'app',
ibtool_flags = ["--minimum-deployment-target", "9.0"],
info_plist = 'Info.plist',
)