apple_bundle()
This is liable to change in the future.
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.
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 ininfo_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 ininfo_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.
Arguments
name
(required) #The short name for this build target.
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.product_name
(required) #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.
extension
(required) #The extension of the generated bundle. For example
'app'
for an application bundle or'appex'
for an application extension bundle.binary
(required) #A build target identifying an
apple_binary()
rule or anapple_library()
rule whose output will be used as the main executable binary of the generated bundle. The required rule type depends on the value in theextension
attribute. For example, application bundles expect a binary (e.g.'//Apps/MyApp:MyApp'
), application extension bundles expect a shared library (e.g.'//Libraries/MyLibrary:MyLibrary#shared'
).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
.tests
(defaults to[]
) #List of build targets that identify the test rules that exercise this target. Note that non
apple_test
targets will not be included in generated projects due to Xcode's limitations but will still work withbuck test
.asset_catalogs_compilation_options
(required) #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[]
)
ibtool_flags
(defaults to[]
) #List of flags to be passed to ibtool during interface builder file compilation.
visibility
(defaults to[]
) #List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their
deps
orexported_deps
attributes. For more information, see visibility.licenses
(defaults to[]
) #Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use
buck query
.labels
(defaults to[]
) #Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using
buck query attrfilter()
.
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', )