blob: bedb6cd0fe29b14bfc822494d5d7fa3227006e1e [file] [log] [blame]
package(default_visibility = ["//visibility:public"])
alias(
name = "sdk",
actual = "//external:android/sdk",
)
android_tools_defaults_jar(name = "android_jar")
android_library(
name = "incremental_stub_application",
exports = ["//src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_stub_application"],
)
android_library(
name = "incremental_split_stub_application",
exports = ["//src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_split_stub_application"],
)
alias(
name = "busybox",
actual = "//src/tools/android/java/com/google/devtools/build/android:ResourceProcessorBusyBox",
)
alias(
name = "merge_dexzips",
actual = "//src/tools/android/java/com/google/devtools/build/android/ziputils:reducer",
)
alias(
name = "shuffle_jars",
actual = "//src/tools/android/java/com/google/devtools/build/android/ziputils:mapper",
)
alias(
name = "dexbuilder",
actual = "//src/tools/android/java/com/google/devtools/build/android/dexer:DexBuilder",
)
alias(
name = "dexbuilder_after_proguard",
actual = "//src/tools/android/java/com/google/devtools/build/android/dexer:DexBuilder",
)
alias(
name = "dexmerger",
actual = "//src/tools/android/java/com/google/devtools/build/android/dexer:DexFileMerger",
)
alias(
name = "dexsharder",
actual = "//src/tools/android/java/com/google/devtools/build/android/dexer:DexFileSplitter",
)
sh_binary(
name = "desugar_java8",
srcs = ["desugar.sh"],
data = ["//src/tools/android/java/com/google/devtools/build/android/desugar:Desugar"],
)
alias(
name = "aar_import_deps_checker",
actual = "//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:ImportDepsChecker_embedded",
visibility = ["//visibility:public"]
)
alias(
name = "zip_filter",
actual = "//src/tools/android/java/com/google/devtools/build/android:ZipFilterAction",
)
# Bazel puts this on the bootclasspath of android_* targets to support Java 8
# if requested.
filegroup(
name = "desugar_java8_extra_bootclasspath",
srcs = ["java_lang_extras.jar"],
visibility = ["//visibility:public"],
)
java_import(
name = "singlejar_deploy",
jars = select({
"//src/conditions:windows": ["@bazel_tools//tools/jdk:singlejar"],
"//conditions:default": [],
}),
visibility = ["//visibility:private"],
)
java_binary(
name = "singlejar_javabin",
main_class = "com.google.devtools.build.singlejar.SingleJar",
runtime_deps = select({
"//src/conditions:windows": [":singlejar_deploy"],
"//conditions:default": [],
}),
visibility = ["//visibility:private"],
)
gen_java_lang_extras_jar_cmd = """
$(location %s) \
--exclude_build_data \
--dont_change_compression \
--sources $(location @bazel_tools//tools/jdk:platformclasspath8) \
--include_prefixes "java/lang/invoke/" \
--include_prefixes "java/lang/annotation/" \
--output $@
"""
# javac needs this Jar to compile lambdas, method references, and type annotations.
# These classes are not part of the android.jar.
genrule(
name = "gen_java_lang_extras_jar",
srcs = [
"@bazel_tools//tools/jdk:platformclasspath8"
],
tools = select({
"//src/conditions:windows": [":singlejar_javabin"],
"//conditions:default": ["@bazel_tools//tools/jdk:singlejar"],
}),
outs = ["java_lang_extras.jar"],
cmd = select({
"//src/conditions:windows": gen_java_lang_extras_jar_cmd % ":singlejar_javabin",
"//conditions:default": gen_java_lang_extras_jar_cmd % "@bazel_tools//tools/jdk:singlejar",
}),
visibility = ["//visibility:private"],
)
java_import(
name = "desugared_java8_legacy_apis",
jars = [":ijar_desugared_java8_legacy_libs"],
neverlink = 1,
visibility = ["//visibility:public"],
)
genrule(
name = "ijar_desugared_java8_legacy_libs",
srcs = ["desugared_java8_legacy_libs"],
outs = ["desugared_java8_legacy_libs-ijar.jar"],
cmd = "$(location //third_party/ijar) $< $@",
tools = ["//third_party/ijar"],
visibility = ["//visibility:private"],
)
sh_binary(
name = "build_java8_legacy_dex",
srcs = ["build_java8_legacy_dex.sh"],
data = [
"minify_java8_legacy_libs.cfg",
":desugared_java8_legacy_libs",
":dexer",
"@bazel_tools//src/tools/android/java/com/google/devtools/build/android/desugar/scan:KeepScanner",
"@bazel_tools//third_party/java/proguard",
],
visibility = ["//visibility:public"],
)
genrule(
name = "java8_legacy_dex",
outs = ["java8_legacy.dex.zip"],
cmd = """$(location :build_java8_legacy_dex) --output $@""",
tools = [":build_java8_legacy_dex"],
visibility = ["//visibility:public"],
)
filegroup(
name = "desugared_java8_legacy_libs",
srcs = ["desugared_java8_legacy_libs.jar"],
visibility = ["//visibility:private"],
)
genrule(
name = "desugar_java8_legacy_libs",
srcs = ["desugar_jdk_libs.jar"],
outs = ["desugared_java8_legacy_libs.jar"],
cmd = """
$(location :desugar_java8) \
--input $< \
--output $@ \
--classpath_entry "$(location @bazel_tools//tools/jdk:platformclasspath8)" \
--core_library --allow_empty_bootclasspath \
--nobest_effort_tolerate_missing_deps \
--noemit_dependency_metadata_as_needed \
--nodesugar_try_with_resources_if_needed \
--desugar_supported_core_libs \
--rewrite_core_library_prefix java/lang/Double8 \
--rewrite_core_library_prefix java/lang/Integer8 \
--rewrite_core_library_prefix java/lang/Long8 \
--rewrite_core_library_prefix java/lang/Math8 \
--rewrite_core_library_prefix java/time/ \
--rewrite_core_library_prefix java/util/stream/ \
--rewrite_core_library_prefix java/util/function/ \
--rewrite_core_library_prefix java/util/Comparators \
--rewrite_core_library_prefix java/util/Desugar \
--rewrite_core_library_prefix java/util/DoubleSummaryStatistics \
--rewrite_core_library_prefix java/util/IntSummaryStatistics \
--rewrite_core_library_prefix java/util/LongSummaryStatistics \
--rewrite_core_library_prefix java/util/Objects \
--rewrite_core_library_prefix java/util/Optional \
--rewrite_core_library_prefix java/util/PrimitiveIterator \
--rewrite_core_library_prefix java/util/SortedSet\$$1 \
--rewrite_core_library_prefix java/util/Spliterator \
--rewrite_core_library_prefix java/util/StringJoiner \
--rewrite_core_library_prefix java/util/Tripwire \
--rewrite_core_library_prefix java/util/concurrent/atomic/DesugarAtomic \
--retarget_core_library_member "java/util/Arrays#stream->java/util/DesugarArrays" \
--retarget_core_library_member "java/util/Arrays#spliterator->java/util/DesugarArrays" \
--retarget_core_library_member "java/util/LinkedHashSet#spliterator->java/util/DesugarLinkedHashSet" \
--emulate_core_library_interface java/util/Collection \
--emulate_core_library_interface java/util/Map \
--emulate_core_library_interface java/util/Map\$$Entry \
--emulate_core_library_interface java/util/Iterator \
--emulate_core_library_interface java/util/Comparator \
--dont_rewrite_core_library_invocation "java/util/Iterator#remove" """,
tools = [
":desugar_java8",
"@bazel_tools//tools/jdk:platformclasspath8",
],
visibility = ["//visibility:private"],
)
# No-one should depend on this but :desugared_java8_legacy_libs above
exports_files(["desugar_jdk_libs.jar"],
visibility = ["//visibility:private"],
)
# Mirrors @<repo>//:dx_binary generated by android_sdk_repository rule without
# needing the SDK repo's name (typically @androidsdk but not required).
java_binary(
name = "dexer",
main_class = "com.android.dx.command.Main",
runtime_deps = ["//external:android/dx_jar_import"],
visibility = ["//visibility:private"],
)
alias(
name = "IdlClass",
actual = "//src/tools/android/java/com/google/devtools/build/android/idlclass:IdlClass",
)
py_binary(
name = "instrumentation_test_check",
srcs = ["instrumentation_test_check.py"],
deps = ["//third_party/py/gflags"],
)
py_binary(
name = "build_incremental_dexmanifest",
srcs = [":build_incremental_dexmanifest.py"],
deps = [],
)
py_binary(
name = "build_split_manifest",
srcs = ["build_split_manifest.py"],
deps = [
"//third_party/py/gflags",
],
)
py_binary(
name = "incremental_install",
srcs = ["incremental_install.py"],
deps = [
"//third_party/py/concurrent:futures",
"//third_party/py/gflags",
],
)
py_binary(
name = "strip_resources",
srcs = ["strip_resources.py"],
deps = [
"//third_party/py/gflags",
],
)
py_binary(
name = "aar_native_libs_zip_creator",
srcs = [
"aar_native_libs_zip_creator.py",
],
deps = [
":junction_lib",
"//third_party/py/gflags",
],
)
py_binary(
name = "stubify_manifest",
srcs = ["stubify_manifest.py"],
deps = [
"//third_party/py/gflags",
],
)
py_binary(
name = "aar_embedded_jars_extractor",
srcs = ["aar_embedded_jars_extractor.py"],
deps = [
":junction_lib",
"//third_party/py/gflags",
],
)
py_binary(
name = "aar_resources_extractor",
srcs = ["aar_resources_extractor.py"],
deps = [
":junction_lib",
"//third_party/py/gflags",
],
)
py_binary(
name = "resource_extractor",
srcs = ["resource_extractor.py"],
)
py_library(
name = "junction_lib",
srcs = ["junction.py"],
visibility = ["//visibility:private"],
)
alias(
name = "android_runtest",
actual = "fail.sh",
)
alias(
name = "adb_static",
actual = "fail.sh",
)
alias(
name = "adb",
actual = "@androidsdk//:adb",
)
# If needed, this file can be regenerated by (validity is 30 * 365 days):
# keytool -genkeypair \
# -alias androiddebugkey \
# -dname "CN=Android Debug, O=Android, C=US" \
# -keystore cica \
# -sigalg SHA256withDSA \
# -validity 10950
filegroup(
name = "debug_keystore",
srcs = ["bazel_debug.keystore"],
)
alias(
name = "databinding_annotation_processor",
actual = "//external:databinding_annotation_processor",
)
# This is the default value of databinding_annotation_processor if the user does
# not provide one.
filegroup(name = "empty")
alias(
name = "jarjar_bin",
actual = "//third_party/java/jarjar:jarjar_bin",
)
alias(
name = "instrumentation_test_entry_point",
actual = "@android_test_support//:instrumentation_test_runner",
)
# This is the default binding of //external:android/sdk. If someone attempts to
# build a rule that depends on //external:android/sdk without setting up
# android_sdk_repository in their WORKSPACE, the genrule will fail with a
# helpful error message.
android_sdk(
name = "poison_pill_android_sdk",
proguard = ":error_message",
aapt = ":error_message",
dx = ":error_message",
main_dex_list_creator = ":error_message",
adb = ":error_message",
framework_aidl = ":error_message",
aidl = ":error_message",
android_jar = ":error_message.jar",
shrinked_android_jar = ":error_message.jar",
main_dex_classes = ":error_message",
apksigner = ":error_message",
zipalign = ":error_message",
)
genrule(
name = "no_android_sdk_repository_error",
outs = ["error_message", "error_message.jar"],
cmd = """echo \
This build requires an Android SDK. Please add the android_sdk_repository \
rule to your WORKSPACE. ; \
exit 1 """,
)
# //external:has_androidsdk is bound to either
# @bazel_tools//tools/android:always_true or
# @bazel_tools//tools/android:always_false depending on whether
# android_sdk_repository has run. This allows targets to depend on targets from
# @androidsdk if and only if the user has an android_sdk_repository set up.
config_feature_flag(
name = "true",
default_value = "true",
allowed_values = ["true", "false"],
)
config_setting(
name = "always_true",
flag_values = {
":true": "true"
},
)
config_setting(
name = "always_false",
flag_values = {
":true": "false",
},
)
package_group(
name = "android_device_whitelist",
packages = ["//..."],
)
package_group(
name = "export_deps_whitelist",
packages = ["//..."],
)
package_group(
name = "allow_android_library_deps_without_srcs_whitelist",
packages = ["//..."],
)
sh_binary(
name = "dex_list_obfuscator",
srcs = ["dex_list_obfuscator.sh"],
visibility = ["//visibility:public"],
)