Skip to content

Commit 7f04410

Browse files
ted-xiecopybara-github
authored andcommitted
Merge #352 by ted-xie: Nerf dx_jar_import and dx_binary
DX has been deprecated for a long time, and is essentially unused in rules_android*. Unfortunately, dx_binary and the only binary that depends on it, main_dex_list_creator, are still used as attributes in the android_sdk() rule, and thus can't be easily deleted. This change nerfs the two aforementioned binaries into simple shell binaries that immediately fail. * There are still _some_ references to DX classpaths that are bundled into the android tools jar, which we hope to untangle incrementally. Fixes #298 Closes #352 COPYBARA_INTEGRATE_REVIEW=#352 from ted-xie:no_dx_jar_import 9eca2de PiperOrigin-RevId: 743692947 Change-Id: I1ddd6d78619e61cc8789f4e5a8f417d6a3c09013
1 parent c016b7a commit 7f04410

1 file changed

Lines changed: 19 additions & 20 deletions

File tree

rules/android_sdk_repository/helper.bzl

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,21 @@ def create_android_sdk_rules(
370370
executable = 1,
371371
)
372372

373+
native.genrule(
374+
name = "dx_binary_source",
375+
srcs = [],
376+
outs = ["dx_binary.sh"],
377+
cmd = "\n".join([
378+
"cat > $@ <<'EOF'",
379+
"#!/bin/bash",
380+
"",
381+
"echo dx_binary should not be used anymore.",
382+
"exit 1",
383+
"",
384+
"EOF\n",
385+
]),
386+
)
387+
373388
native.genrule(
374389
name = "main_dex_list_creator_source",
375390
srcs = [],
@@ -378,13 +393,8 @@ def create_android_sdk_rules(
378393
"cat > $@ <<'EOF'",
379394
"#!/bin/bash",
380395
"",
381-
"MAIN_DEX_LIST=$$1",
382-
"STRIPPED_JAR=$$2",
383-
"JAR=$$3",
384-
"" +
385-
"JAVA_BINARY=$$0.runfiles/%s/main_dex_list_creator_java" % name,
386-
"$$JAVA_BINARY $$STRIPPED_JAR $$JAR > $$MAIN_DEX_LIST",
387-
"exit $$?",
396+
"echo main_dex_list_creator should not be used anymore.",
397+
"exit 1",
388398
"",
389399
"EOF\n",
390400
]),
@@ -393,21 +403,10 @@ def create_android_sdk_rules(
393403
sh_binary(
394404
name = "main_dex_list_creator",
395405
srcs = ["main_dex_list_creator.sh"],
396-
data = [":main_dex_list_creator_java"],
397-
)
398-
java_binary(
399-
name = "main_dex_list_creator_java",
400-
main_class = "com.android.multidex.ClassReferenceListBuilder",
401-
runtime_deps = [":dx_jar_import"],
402406
)
403-
java_binary(
407+
sh_binary(
404408
name = "dx_binary",
405-
main_class = "com.android.dx.command.Main",
406-
runtime_deps = [":dx_jar_import"],
407-
)
408-
java_import(
409-
name = "dx_jar_import",
410-
jars = ["build-tools/%s/lib/dx.jar" % build_tools_directory],
409+
srcs = [":dx_binary_source"],
411410
)
412411
java_binary(
413412
name = "generate_main_dex_list",

0 commit comments

Comments
 (0)