Skip to content

Commit

Permalink
Removes unnecessary comments since it appears no one ever reads these.
Browse files Browse the repository at this point in the history
Documentation can be found in https://github.com/bazelbuild/rules_apple/tree/master/doc

RELNOTES: None
PiperOrigin-RevId: 236707736
  • Loading branch information
sergiocampama committed Mar 4, 2019
1 parent cac9773 commit a8f24ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 768 deletions.
283 changes: 7 additions & 276 deletions apple/ios.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,84 +39,7 @@ load(
)

def ios_application(name, **kwargs):
"""Builds and bundles an iOS application.
The named target produced by this macro is an IPA file. This macro also
creates a target named `"{name}.apple_binary"` that represents the linked
binary executable inside the application bundle.
Args:
name: A unique name for the target.
app_icons: Files that comprise the app icons for the application. Each file
must have a containing directory named `*.xcassets/*.appiconset` and
there may be only one such `.appiconset` directory in the list.
bundle_id: The bundle ID (reverse-DNS path followed by app name) of the
application.
entitlements: The entitlements file required for device builds of this
application. If absent, the default entitlements from the provisioning
profile will be used.
The following variables are substituted: `$(CFBundleIdentifier)` with
the bundle ID and `$(AppIdentifierPrefix)` with the value of the
`ApplicationIdentifierPrefix` key from this target's provisioning
profile.
entitlements_validation: An `entitlements_validation_mode` to control the
validation of the requested entitlements against the provisioning
profile to ensure they are supported.
extensions: A list of extensions (see `ios_extension`) to include in the
final application bundle.
families: A list of device families supported by this application. Valid
values are `iphone` and `ipad`; at least one must be specified.
frameworks: A list of framework targets (see `ios_framework`) that this
application depends on.
infoplists: A list of `.plist` files that will be merged to form the
Info.plist that represents the application. At least one file must be
specified. The merge is only at the top level of the plist; so
sub-dictionaries are not merged.
ipa_post_processor: A tool that edits this target's IPA output after it is
assembled but before it is (optionally) signed. The tool is invoked with
a single command-line argument that denotes the path to a directory
containing the unzipped contents of the IPA (that is, the `Payload`
directory will be present in this directory).
Any changes made by the tool must be made in this directory, and the
tool's execution must be hermetic given these inputs to ensure that the
result can be safely cached.
launch_images: Files that comprise the launch images for the application.
Each file must have a containing directory named
`*.xcassets/*.launchimage` and there may be only one such
`.launchimage` directory in the list.
It is recommended that you use a `launch_storyboard` instead if you are
targeting only iOS 8 and later.
launch_storyboard: The `.storyboard` or `.xib` file that should be used as
the launch screen for the application. The provided file will be
compiled into the appropriate format (`.storyboardc` or `.nib`) and
placed in the root of the final bundle. The generated file will also be
registered in the bundle's `Info.plist` under the key
`UILaunchStoryboardName`.
linkopts: A list of strings representing extra flags that the underlying
`apple_binary` target created by this rule should pass to the linker.
provisioning_profile: The provisioning profile (`.mobileprovision` file) to
use when bundling the application. This value is optional (and unused)
for simulator builds but **required** for device builds.
settings_bundle: A resource bundle target that contains the files that make
up the application's settings bundle. These files will be copied into
the root of the final application bundle in a directory named
`Settings.bundle`.
strings: A list of `.strings` files, often localizable.
These files are converted to binary plists (if they are not already)
and placed in the root of the final application bundle, unless a file's
immediate containing directory is named `*.lproj`, in which case it will
be placed under a directory with the same name in the bundle.
watch_application: A `watchos_application` target that represents an Apple
Watch application that should be embedded in the application.
deps: A list of targets that are passed into the `apple_binary` rule to be
linked. Any resources, such as asset catalogs, that are referenced by
those targets will also be transitively included in the final
application.
"""
"""Builds and bundles an iOS application."""
bundling_args = binary_support.create_binary(
name,
str(apple_common.platform_type.ios),
Expand All @@ -130,59 +53,7 @@ def ios_application(name, **kwargs):
)

def ios_extension(name, **kwargs):
"""Builds and bundles an iOS application extension.
The named target produced by this macro is a ZIP file. This macro also
creates a target named `"{name}.apple_binary"` that represents the linked
binary executable inside the extension bundle.
Args:
name: The name of the target.
app_icons: Files that comprise the app icons for the extension. Each file
must have a containing directory named `"*.xcassets/*.appiconset"` and
there may be only one such `.appiconset` directory in the list.
bundle_id: The bundle ID (reverse-DNS path followed by app name) of the
extension. Required.
entitlements: The entitlements file required for device builds of this
application. If absent, the default entitlements from the provisioning
profile will be used. The following variables are substituted:
`$(CFBundleIdentifier)` with the bundle ID and `$(AppIdentifierPrefix)`
with the value of the `ApplicationIdentifierPrefix` key from this
target's provisioning profile (or the default provisioning profile, if
none is specified).
entitlements_validation: An `entitlements_validation_mode` to control the
validation of the requested entitlements against the provisioning
profile to ensure they are supported.
families: A list of device families supported by this extension. Valid
values are `"iphone"` and `"ipad"`.
frameworks: A list of framework targets (see `ios_framework`) that this
extension depends on.
infoplists: A list of `.plist` files that will be merged to form the
`Info.plist` that represents the extension. The merge is only at the
top level of the plist; so sub-dictionaries are not merged.
ipa_post_processor: A tool that edits this target's archive after it is
assembled but before it is (optionally) signed. The tool is invoked
with a single positional argument that represents the path to a
directory containing the unzipped contents of the archive. The only
entry in this directory will be the `.appex` directory for the
extension. Any changes made by the tool must be made in this directory,
and the tool's execution must be hermetic given these inputs to ensure
that the result can be safely cached.
linkopts: A list of strings representing extra flags that the underlying
`apple_binary` target should pass to the linker.
product_type: An optional string denoting a special type of extension,
such as an iMessages sticker pack in iOS 10 and higher.
strings: A list of files that are plists of strings, often localizable.
These files are converted to binary plists (if they are not already)
and placed in the bundle root of the final package. If this file's
immediate containing directory is named `*.lproj`, it will be placed
under a directory of that name in the final bundle. This allows for
localizable strings.
deps: A list of dependencies, such as libraries, that are passed into the
`apple_binary` rule. Any resources, such as asset catalogs, that are
defined by these targets will also be transitively included in the
final extension.
"""
"""Builds and bundles an iOS application extension."""
bundling_args = binary_support.create_binary(
name,
str(apple_common.platform_type.ios),
Expand All @@ -197,48 +68,7 @@ def ios_extension(name, **kwargs):
)

def ios_framework(name, **kwargs):
"""Builds and bundles an iOS dynamic framework.
The named target produced by this macro is a ZIP file. This macro also
creates a target named "{name}.apple_binary" that represents the
linked binary executable inside the framework bundle.
Args:
name: The name of the target.
bundle_id: The bundle ID (reverse-DNS path followed by app name) of the
framework. If specified, it will override the bundle ID in the plist
file. If no bundle ID is specified by either this attribute or in the
plist file, the build will fail.
extension_safe: If true, compiles and links this framework with
`-application-extension` restricting the binary to use only
extension-safe APIs. False by default.
families: A list of device families supported by this framework. Valid
values are `"iphone"` and `"ipad"`.
frameworks: A list of framework targets that this framework depends on.
infoplists: A list of `.plist` files that will be merged to form the
Info.plist that represents the framework. The merge is only at the
top level of the plist; so sub-dictionaries are not merged.
ipa_post_processor: A tool that edits this target's archive after it is
assembled but before it is (optionally) signed. The tool is invoked
with a single positional argument that represents the path to a
directory containing the unzipped contents of the archive. The only
entry in this directory will be the `.framework` directory for the
framework. Any changes made by the tool must be made in this directory,
and the tool's execution must be hermetic given these inputs to ensure
that the result can be safely cached.
linkopts: A list of strings representing extra flags that the underlying
`apple_binary` target should pass to the linker.
strings: A list of files that are plists of strings, often localizable.
These files are converted to binary plists (if they are not already)
and placed in the bundle root of the final package. If this file's
immediate containing directory is named `*.lproj`, it will be placed
under a directory of that name in the final bundle. This allows for
localizable strings.
deps: A list of dependencies, such as libraries, that are passed into the
`apple_binary` rule. Any resources, such as asset catalogs, that are
defined by these targets will also be transitively included in the
final framework.
"""
"""Builds and bundles an iOS dynamic framework."""
linkopts = kwargs.get("linkopts", [])

# Can't read this from the descriptor, since it requires the bundle name as argument. Once this
Expand Down Expand Up @@ -270,43 +100,7 @@ def ios_framework(name, **kwargs):
)

def ios_static_framework(name, **kwargs):
"""Builds and bundles an iOS static framework for third-party distribution.
A static framework is bundled like a dynamic framework except that the
embedded binary is a static library rather than a dynamic library. It is
intended to create distributable static SDKs or artifacts that can be easily
imported into other Xcode projects; it is specifically **not** intended to be
used as a dependency of other Bazel targets. For that use case, use the
corresponding `objc_library` targets directly.
Unlike other iOS bundles, the fat binary in an `ios_static_framework` may
simultaneously contain simulator and device architectures (that is, you can
build a single framework artifact that works for all architectures by
specifying `--ios_multi_cpus=i386,x86_64,armv7,arm64` when you build).
Args:
name: The name of the target.
bundle_name: The name to give to the framework bundle, without the
".framework" extension. If omitted, the target's name will be used.
hdrs: A list of `.h` files that will be publicly exposed by this framework.
These headers should have framework-relative imports, and if non-empty,
an umbrella header named `%{bundle_name}.h` will also be generated that
imports all of the headers listed here.
exclude_resources: Indicates whether resources should be excluded from the
bundle. This can be used to avoid unnecessarily bundling resources if
the static framework is being distributed in a different fashion, such
as a Cocoapod.
deps: The `objc_library` rules whose transitive closure should be linked
into this framework. The libraries compiled into this framework will be
all `objc_library` targets in the transitive closure of `deps`, minus
those that are in the transitive closure of `avoid_deps`. Any resources,
such as asset catalogs, that are referenced by those targets will also
be transitively included in the final framework (unless
`exclude_resources` is True).
avoid_deps: A list of `objc_library` targets on which this framework
depends, but the transitive closure of which should *not* be compiled
into the framework's binary.
"""
"""Builds and bundles an iOS static framework for third-party distribution."""
avoid_deps = kwargs.get("avoid_deps")
deps = kwargs.get("deps")
apple_static_library_name = "%s.apple_static_library" % name
Expand All @@ -333,29 +127,7 @@ def ios_static_framework(name, **kwargs):
)

def ios_ui_test(name, **kwargs):
"""Builds an XCUITest test bundle and tests it using the provided runner.
The named target produced by this macro is an test target that can be executed
with the `bazel test` command.
Args:
name: The name of the target.
test_host: The ios_application target that contains the code to be
tested. Required.
bundle_id: The bundle ID (reverse-DNS path followed by app name) of the
test bundle. Optional. Defaults to the test_host's postfixed with
"Tests".
infoplists: A list of plist files that will be merged to form the
Info.plist that represents the test bundle. The merge is only at the
top level of the plist; so sub-dictionaries are not merged.
minimum_os_version: The minimum OS version that this target and its
dependencies should be built for. Optional.
runner: The runner target that contains the logic of how the tests should
be executed. This target needs to provide an AppleTestRunnerInfo
provider. Optional.
deps: A list of dependencies that contain the test code and dependencies
needed to run the tests.
"""
"""Builds an XCUITest test bundle and tests it using the provided runner."""
_ios_ui_test(name = name, **kwargs)

def ios_ui_test_suite(name, runners = [], tags = [], **kwargs):
Expand Down Expand Up @@ -386,52 +158,11 @@ def ios_ui_test_suite(name, runners = [], tags = [], **kwargs):
)

def ios_unit_test(name, **kwargs):
"""Builds an XCTest unit test bundle and tests it using the provided runner.
The named target produced by this macro is a test target that can be executed
with the `bazel test` command.
Args:
name: The name of the target.
test_host: The ios_application target that contains the code to be
tested. Optional.
bundle_id: The bundle ID (reverse-DNS path followed by app name) of the
test bundle. Optional. Defaults to the test_host's postfixed with
"Tests".
infoplists: A list of plist files that will be merged to form the
Info.plist that represents the test bundle. The merge is only at the
top level of the plist; so sub-dictionaries are not merged.
minimum_os_version: The minimum OS version that this target and its
dependencies should be built for. Optional.
runner: The runner target that contains the logic of how the tests should
be executed. This target needs to provide an AppleTestRunnerInfo
provider. Optional.
deps: A list of dependencies that contain the test code and dependencies
needed to run the tests.
"""
"""Builds an XCTest unit test bundle and tests it using the provided runner."""
_ios_unit_test(name = name, **kwargs)

def ios_unit_test_suite(name, runners = [], tags = [], **kwargs):
"""Builds an XCTest unit test suite with the given runners.
Args:
name: The name of the target.
test_host: The ios_application target that contains the code to be
tested. Optional.
bundle_id: The bundle ID (reverse-DNS path followed by app name) of the
test bundle. Optional. Defaults to the test_host's postfixed with
"Tests".
infoplists: A list of plist files that will be merged to form the
Info.plist that represents the test bundle. The merge is only at the
top level of the plist; so sub-dictionaries are not merged.
runners: The list of runner targets that contain the logic of how the tests
should be executed. This target needs to provide an AppleTestRunnerInfo
provider. Required (minimum of 2 runners).
deps: A list of dependencies that contain the test code and dependencies
needed to run the tests.
tags: List of arbitrary text tags to be added to the test_suite. Tags may be
any valid string. Optional. Defaults to an empty list.
"""
"""Builds an XCTest unit test suite with the given runners."""
if len(runners) < 2:
fail("You need to specify at least 2 runners to create a test suite.")
tests = []
Expand Down
Loading

0 comments on commit a8f24ae

Please sign in to comment.