Defines a binary target and a config setting for d8_dexmerger.
RELNOTES: Experimental support for d8 merger is now available for use using --define=android_dexmerger_tool=d8_dexmerger.
@@ -74,9 +74,36 @@ alias(
actual = "//src/tools/android/java/com/google/devtools/build/android/dexer:DexBuilder",
)
+# Defines d8_dexmerger using @<repo>//:d8_jar_import generated by android_sdk_repository rule
+# without needing the SDK repo's name (typically @androidsdk but not required).
+java_binary(
+ name = "d8_dexmerger",
+ main_class = "com.android.tools.r8.dexfilemerger.DexFileMerger",
+ visibility = ["//visibility:private"],
+ runtime_deps = ["//external:android/d8_jar_import"],
+)
+
+config_setting(
+ name = "use_dx_dexmerger",
+ values = {
+ "define": "android_dexmerger_tool=dx_dexmerger",
+ },
+)
+
+config_setting(
+ name = "use_d8_dexmerger",
+ values = {
+ "define": "android_dexmerger_tool=d8_dexmerger",
+ },
+)
+
alias(
name = "dexmerger",
- actual = "//src/tools/android/java/com/google/devtools/build/android/dexer:DexFileMerger",
+ actual = select({
+ "use_d8_dexmerger": ":d8_dexmerger",
+ "use_dx_dexmerger": "//src/tools/android/java/com/google/devtools/build/android/dexer:DexFileMerger",
+ "//conditions:default": "//src/tools/android/java/com/google/devtools/build/android/dexer:DexFileMerger",
+ })
)
alias(
