android_aar
An android_aar()
rule is used to generate an Android AAR.
Details
See the official Android documentation for details about the .aar
format.
Function Signature
def android_aar(
*,
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 = [],
_android_toolchain: str = "gh_facebook_buck2_shims_meta//:android",
_apple_platforms: dict[str, str] = {},
_cxx_toolchain: str = gh_facebook_buck2_shims_meta//:android-hack,
_is_building_android_binary: bool = True,
_is_force_single_cpu: bool = False,
_is_force_single_default_cpu: bool = False,
_java_toolchain: str = "gh_facebook_buck2_shims_meta//:java_for_android",
abi_generation_mode: None | str = None,
annotation_processing_tool: None | str = None,
annotation_processor_deps: list[str] = [],
annotation_processor_params: list[str] = [],
annotation_processors: list[str] = [],
build_config_values: list[str] = [],
build_config_values_file: None | str = None,
compress_asset_libraries: bool = False,
contacts: list[str] = [],
cpu_filters: list[str] = ["arm64", "armv7", "x86", "x86_64"],
default_host_platform: None | str = None,
deps: list[str] = [],
enable_relinker: bool = False,
excluded_java_deps: list[str] = [],
extra_arguments: list[str] = [],
extra_kotlinc_arguments: list[str] = [],
friend_paths: list[str] = [],
include_build_config_class: bool = False,
java_version: None | str = None,
javac: None | str = None,
labels: list[str] = [],
language: None | str = None,
licenses: list[str] = [],
manifest: None | str = None,
manifest_entries: dict[str, typing.Any] = {},
manifest_file: None | str = None,
manifest_skeleton: str,
maven_coords: None | str = None,
min_sdk_version: None | int = None,
native_library_bolt_args: None | dict[str, list[str]] = None,
native_library_merge_code_generator: None | str = None,
native_library_merge_glue: None | str = None,
native_library_merge_linker_args: None | dict[str, list[str]] = None,
native_library_merge_linker_args_all: list[str] = [],
native_library_merge_map: None | dict[str, list[str]] = None,
native_library_merge_non_asset_libs: bool = False,
native_library_merge_sequence: None | list = None,
native_library_merge_sequence_blocklist: None | list[str] = None,
never_mark_as_unused_dependency: None | bool = None,
non_exec_dep_plugins_deprecated: list[str | (str, list[str])] = [],
on_unused_dependencies: None | str = None,
package_asset_libraries: bool = True,
package_resources: bool = True,
plugins: list[str | (str, list[str])] = [],
proguard_config: None | str = None,
relinker_extra_args: list[str] = [],
relinker_extra_deps: list[str] = [],
relinker_whitelist: list[str] = [],
remove_classes: list[str] = [],
required_for_source_only_abi: bool = False,
resource_union_package: None | str = None,
resources: list[str] = [],
resources_root: None | str = None,
runtime_deps: list[str] = [],
source: None | str = None,
source_abi_verification_mode: None | str = None,
source_only_abi_deps: list[str] = [],
srcs: list[str] = [],
strip_libraries: bool = True,
target: None | str = None,
use_jvm_abi_gen: None | bool = 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
-
build_config_values
: (defaults to:[]
)See the documentation on the values argument for
android_build_config()
. -
include_build_config_class
: (defaults to:False
)Whether to include the
BuildConfig
class files in the final .aar file. Needs to be set toTrue
if any build_config_values are specified. This is normally only needed if the build tool that is consuming the .aar file does not generateBuildConfig
classes. Note: the AAR format does not specify a way to pass defaults that should be injected into the finalBuildConfig
class, therefore that information might need to be replicated manually in the build that's consuming the .aar file. -
javac
: (defaults to:None
)Specifies the Java compiler program to use for this rule. The value is a source path or an execution dep (e.g., //foo/bar:bar). Overrides the value in "javac" in the "tools" section of
.buckconfig
. -
manifest_skeleton
: (required)The skeleton manifest file used to generate the final
AndroidManifest.xml
. May either be a file or anandroid_manifest()
target. -
native_library_merge_linker_args_all
: (defaults to:[]
)Extra linker arguments passed to all merged libraries.
-
non_exec_dep_plugins_deprecated
: (defaults to:[]
)Plugins that do not use the execution platform. This exists for historical reasons, and should not be used. Use
plugins
instead - plugins should be configured for the execution platform since that is where they are used. -
plugins
: (defaults to:[]
)List of plugins that should be run during compilation of the target. A list of strings may additionally be provided in order to pass additional arguments to the plugin.
-
relinker_extra_args
: (defaults to:[]
)Extra arguments passed when relinking all libraries.
-
remove_classes
: (defaults to:[]
)List of classes to remove from the output aar. It removes classes from the target's own sources, and its dependencies.
Examples
android_resource(
name = 'res',
res = 'res',
assets = 'assets',
package = 'com.example',
)
android_library(
name = 'lib',
srcs = glob(['**/*.java']),
)
android_aar(
name = 'app',
manifest_skeleton = 'AndroidManifestSkeleton.xml',
deps = [
':res',
':lib',
],
)