Skip to main content

apple_bundle

name

def name(
*,
name: str,
default_target_platform: None | str = ...,
target_compatible_with: list[str] = ...,
compatible_with: list[str] = ...,
exec_compatible_with: list[str] = ...,
visibility: list[str] = ...,
within_view: list[str] = ...,
metadata: OpaqueMetadata = ...,
tests: list[str] = ...,
modifiers: OpaqueMetadata = ...,
_apple_platforms: dict[str, str] = ...,
_apple_toolchain: str = ...,
_apple_tools: str = ...,
_apple_xctoolchain: str = ...,
_apple_xctoolchain_bundle_id: str = ...,
_bundling_cache_buster: None | str = ...,
_bundling_log_file_enabled: bool = ...,
_bundling_log_file_level: None | str = ...,
_code_signing_configuration: None | str = ...,
_codesign_entitlements: None | str = ...,
_codesign_identities_command_override: None | str = ...,
_codesign_type: None | str = ...,
_compile_resources_locally_override: None | bool = ...,
_dsymutil_extra_flags: list[str],
_dsymutil_verify_dwarf: str,
_embed_provisioning_profile_when_adhoc_code_signing: None | bool = ...,
_fast_adhoc_signing_enabled_default: bool = ...,
_fast_provisioning_profile_parsing_enabled: bool = ...,
_incremental_bundling_enabled: bool = ...,
_info_plist_identify_build_system_default: bool = ...,
_profile_bundling_enabled: bool = ...,
_provisioning_profiles: str = ...,
_resource_bundle: None | str = ...,
_skip_adhoc_resigning_scrubbed_frameworks_default: bool = ...,
_skip_adhoc_resigning_scrubbed_frameworks_override: None | bool = ...,
_strict_provisioning_profile_search_default: bool = ...,
_use_entitlements_when_adhoc_code_signing: None | bool = ...,
asset_catalogs_compilation_options: dict[str, typing.Any] = ...,
binary: None | str = ...,
bundle_type: None | str = ...,
code_signing_configuration: None | str = ...,
codesign_flags: list[str] = ...,
codesign_identity: None | str = ...,
codesign_type: None | str = ...,
contacts: list[str] = ...,
copy_public_framework_headers: None | bool = ...,
debug_artifacts_validators: dict[str, (str, str)] = ...,
default_host_platform: None | str = ...,
default_platform: None | str = ...,
deps: list[str] = ...,
dsym_uses_parallel_linker: bool = ...,
embed_provisioning_profile_when_adhoc_code_signing: bool = ...,
embed_xctest_frameworks: bool = ...,
extension: str,
fast_adhoc_signing_enabled: None | bool = ...,
ibtool_flags: None | list[str] = ...,
incremental_bundling_enabled: None | bool = ...,
info_plist: str,
info_plist_identify_build_system: None | bool = ...,
info_plist_substitutions: dict[str, str] = ...,
labels: list[str] = ...,
licenses: list[str] = ...,
module_map: None | str = ...,
platform_binary: None | list[(str, str)] = ...,
privacy_manifest: None | str = ...,
product_name: None | str = ...,
product_name_from_module_name: bool = ...,
propagated_target_sdk_version: None | str = ...,
provisioning_profile_filter: None | str = ...,
resource_group: None | str = ...,
resource_group_map: None | str = ...,
selective_debugging: None | str = ...,
skip_adhoc_resigning_scrubbed_frameworks: None | bool = ...,
skip_copying_swift_stdlib: None | bool = ...,
split_arch_dsym: bool = ...,
strict_provisioning_profile_search: None | bool = ...,
try_skip_code_signing: None | bool = ...,
universal: None | bool = ...,
use_entitlements_when_adhoc_code_signing: bool = ...,
validation_deps: list[str] = ...,
versioned_macos_bundle: bool = ...,
xcode_product_type: None | str = ...,
xcode_scheme_settings: None | str = ...,
) -> None

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.

Parameters

  • name: name of the target

  • default_target_platform: specifies the default target platform, used when no platforms are specified on the command line

  • target_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration

  • compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with a configuration

  • exec_compatible_with: a list of constraints that are required to be satisfied for this target to be compatible with an execution platform

  • visibility: a list of visibility patterns restricting what targets can depend on this one

  • within_view: a list of visibility patterns restricting what this target can depend on

  • metadata: a key-value map of metadata associated with this target

  • tests: a list of targets that provide tests for this one

  • modifiers: an array of modifiers associated with this target

  • asset_catalogs_compilation_options: A dict holding parameters for asset catalogs compiler (actool). Its options include:

    • notices (defaults to True)
    • warnings (defaults to True)
    • errors (defaults to True)
    • compress_pngs (defaults to True)
    • optimization (defaults to 'space')
    • output_format (defaults to 'human-readable-text')
    • extra_flags (defaults to [])
  • deps: 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 (either watchsimulator or watchos) based on the parent.

  • extension: The extension of the generated bundle. For example 'app' for an application bundle or 'appex' for an application extension bundle.

  • ibtool_flags: List of flags to be passed to ibtool during interface builder file compilation.

  • info_plist: 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 (see info_plist_substitutions for more information).

  • info_plist_substitutions: 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 by MyValue.

  • privacy_manifest: A path to an .xcprivacy file that will be placed in the bundle.

  • product_name: 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: Optional settings to set on schemes when this target is represented in Xcode.

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.

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',
)