cabal-buck2-0.6.0.0: buck2/prelude/decls/android_common.bzl
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is dual-licensed under either the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree or the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree. You may select, at your option, one of the
# above-listed licenses.
# TODO(cjhopman): This was generated by scripts/hacks/rules_shim_with_docs.py,
# but should be manually edited going forward. There may be some errors in
# the generated docs, and so those should be verified to be accurate and
# well-formatted (and then delete this TODO)
def _manifest_apk_arg():
return {
"manifest": attrs.option(
attrs.source(),
default = None,
doc = """
Relative path to the Android manifest for the APK. The common
case is that the manifest will be in the same directory as the
rule, in which case this will simply be
`'AndroidManifest.xml'`, but it can also reference
an `android_manifest()` rule.
Prefer using `manifest_skeleton`, which performs merging automatically.
Exactly one of `manifest` and `manifest_skeleton` must be set.
""",
),
"manifest_skeleton": attrs.option(
attrs.source(),
default = None,
doc = """
Relative path to the skeleton Android manifest for the APK.
An `android_manifest()` will be created automatically to merge
all manifests from libraries and resources going into the app.
The common case is that the manifest will be in the same directory as the
rule, in which case this will simply be
`'AndroidManifest.xml'`.
Exactly one of `manifest` and `manifest_skeleton` must be set.
""",
),
}
def _deps_apk_arg():
return {
"deps": attrs.list(
attrs.dep(),
default = [],
doc = """
List of build targets whose corresponding compiled Java code,
Android resources, and native libraries will be included in the APK.
From the transitive closure of these dependencies, the outputs of rules of the following type will be included in the APK:
* `android_library()`* `android_resource()`* `cxx_library()`* `groovy_library()`* `java_library()`* `java_binary()`* `prebuilt_jar()`* `prebuilt_native_library()`
""",
),
}
def _manifest_arg():
return {
"manifest": attrs.option(
attrs.source(),
default = None,
doc = """
An optional [Android Manifest](http://developer.android.com/guide/topics/manifest/manifest-intro.html) for the to declare any permissions or intents it may need or want to handle. May either be a file or an `android_manifest()` target.
""",
),
}
def _patches_system_module_arg():
return {
"patches_system_module": attrs.bool(
default = False,
doc = """
Allow this target's sources to (re)declare packages that already exist
in the `--system` module image (`java.base`). Needed under the JDK 9+
module system when compiling stub sources for such packages (e.g.
Android's `dalvik.system`), which otherwise fail with "package exists
in another module: java.base". When set, the compiler is invoked with
`--patch-module java.base=.`, folding this target's sources into that
module. All sources in the compilation are patched in, so a target
using this should only contain sources whose packages belong in the
system module.
""",
),
}
android_common = struct(
manifest_apk_arg = _manifest_apk_arg,
deps_apk_arg = _deps_apk_arg,
manifest_arg = _manifest_arg,
patches_system_module_arg = _patches_system_module_arg,
)