Cleanup jack infrastructure that we no longer use

Bug: 127882991
Change-Id: Ibb8b93df1cba82cacf11e118f44372fc8ed755f4
diff --git a/build.gradle b/build.gradle
index 54a04a0..92551e2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1730,14 +1730,7 @@
 // 7. Update the manifest file describing the Android repo used:
 //    repo manifest -o <r8-checkout-root>/tools/linux/aosp_master_manifest.xml -r
 
-enum DexTool {
-    JACK,
-    DX
-}
-
 def androidCheckoutDir = file("${System.env.HOME}/android/master")
-def androidCheckoutJack = file("${androidCheckoutDir}/out/host/linux-x86/bin/jack");
-def androidCheckoutJackServer = file("${androidCheckoutDir}/out/host/linux-x86/bin/jack-admin");
 
 def artTestDir = file("${androidCheckoutDir}/art/test")
 
@@ -1818,17 +1811,13 @@
         if (androidCheckoutDir.exists()) {
             dependsOn downloadDeps
             artTestBuildDir.mkdirs()
-            // Ensure Jack server is running.
-            "${androidCheckoutJackServer} start-server".execute()
             artTestDir.eachDir { dir ->
                 def name = dir.getName();
                 def markerFile = dir.toPath().resolve("info.txt").toFile();
                 if (markerFile.exists() && !(name in skippedTests)) {
                     if (!(name in skippedTestsDx)) {
-                        dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir, DexTool.DX);
+                        dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir);
                     }
-                    // After Android O, Jack is no longer alive
-                    //dependsOn buildArtTest(androidCheckoutDir, artTestBuildDir, dir, DexTool.JACK);
                 }
             }
         }
@@ -1836,11 +1825,6 @@
             if (!androidCheckoutDir.exists()) {
                 throw new InvalidUserDataException(
                         "This task requires an Android checkout in ${androidCheckoutDir}");
-            } else if (!androidCheckoutJack.exists() ||
-                    !androidCheckoutJackServer.exists()) {
-                throw new InvalidUserDataException(
-                        "This task requires that tools for host testing have been build in the " +
-                                "Android checkout in ${androidCheckoutDir}");
             }
         }
         doLast {
@@ -1890,57 +1874,35 @@
     }
 }
 
-def buildArtTest(androidCheckoutDir, artTestBuildDir, dir, dexTool) {
+def buildArtTest(androidCheckoutDir, artTestBuildDir, dir) {
     def artTestDir = file("${androidCheckoutDir}/art/test")
     def artRunTestScript = file("${artTestDir}/run-test")
     def dxExecutable = new File("tools/linux/dx/bin/dx");
     def dexMergerExecutable = Utils.dexMergerExecutable()
-    def dexToolName = dexTool == DexTool.DX ? "dx" : "jack"
 
     def name = dir.getName()
-    def buildTask = "build_art_test_${dexToolName}_${name}"
-    def sanitizeTask = "sanitize_art_test_${dexToolName}_${name}"
-    def copyCheckTask = "copy_check_art_test_${dexToolName}_${name}"
-    def smaliToDexTask = "smali_to_dex_${dexToolName}_${name}"
+    def buildTask = "build_art_test_dx_${name}"
+    def sanitizeTask = "sanitize_art_test_dx_${name}"
+    def copyCheckTask = "copy_check_art_test_dx_${name}"
+    def smaliToDexTask = "smali_to_dex_dx_${name}"
 
     def buildInputs = fileTree(dir: dir, include: '**/*')
-    def testDir = file("${artTestBuildDir}/${dexToolName}/${name}")
+    def testDir = file("${artTestBuildDir}/dx/${name}")
     def outputJar = testDir.toPath().resolve("${name}.jar").toFile()
     testDir.mkdirs()
-    if (dexTool == DexTool.DX) {
-        task "$buildTask"(type: Exec) {
-            outputs.upToDateWhen { false }
-            inputs.file buildInputs
-            executable "${artRunTestScript}"
-            args "--host"
-            args "--build-only"
-            args "--build-with-javac-dx"
-            args "--output-path", "${testDir}"
-            args "${name}"
-            environment DX: "${dxExecutable.absolutePath}"
-            environment DXMERGER: "${dexMergerExecutable.absolutePath}"
-            environment ANDROID_BUILD_TOP: "${androidCheckoutDir}"
-            outputs.file outputJar
-        }
-    } else {
-        assert dexTool == DexTool.JACK
-        def javaLibs = "${androidCheckoutDir}/out/host/common/obj/JAVA_LIBRARIES"
-        def jackClasspath = "${javaLibs}/core-libart-hostdex_intermediates/classes.jack:" +
-                "${javaLibs}/core-oj-hostdex_intermediates/classes.jack"
-        task "$buildTask"(type: Exec) {
-            outputs.upToDateWhen { false }
-            inputs.file buildInputs
-            executable "${artRunTestScript}"
-            args "--host"
-            args "--build-only"
-            args "--output-path", "${testDir}"
-            args "${name}"
-            environment JACK: "${androidCheckoutDir}/out/host/linux-x86/bin/jack"
-            environment JACK_CLASSPATH: jackClasspath
-            environment DXMERGER: "${dexMergerExecutable.absolutePath}"
-            environment ANDROID_BUILD_TOP: "${androidCheckoutDir}"
-            outputs.file outputJar
-        }
+    task "$buildTask"(type: Exec) {
+        outputs.upToDateWhen { false }
+        inputs.file buildInputs
+        executable "${artRunTestScript}"
+        args "--host"
+        args "--build-only"
+        args "--build-with-javac-dx"
+        args "--output-path", "${testDir}"
+        args "${name}"
+        environment DX: "${dxExecutable.absolutePath}"
+        environment DXMERGER: "${dexMergerExecutable.absolutePath}"
+        environment ANDROID_BUILD_TOP: "${androidCheckoutDir}"
+        outputs.file outputJar
     }
     task "${sanitizeTask}"(type: Exec, dependsOn: buildTask) {
         outputs.upToDateWhen { false }
@@ -1969,7 +1931,7 @@
     task "${copyCheckTask}"(type: Copy, dependsOn: sanitizeTask) {
         def smali_dir = file("${dir}/smali")
         outputs.upToDateWhen { false }
-        if (smali_dir.exists() && dexTool == DexTool.DX) {
+        if (smali_dir.exists()) {
             dependsOn smaliToDexTask
         }
         from("${artTestDir}/${name}") {
diff --git a/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java b/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
index 2af0c69..71d2101 100644
--- a/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
+++ b/src/test/java/com/android/tools/r8/R8RunArtTestsTest.java
@@ -76,7 +76,6 @@
   private boolean expectedException = false;
 
   public enum DexTool {
-    JACK,
     DX,
     NONE // Working directly on .class files.
   }
@@ -608,7 +607,7 @@
           // "unneeded" const store. The following reflective call to the VM's GC will then see the
           // large array as still live and the subsequent allocations will fail to reach the desired
           // size before an out-of-memory error occurs. See:
-          // tests/art/{dx,jack}/104-growth-limit/src/Main.java:40
+          // tests/art/dx/104-growth-limit/src/Main.java:40
           .put(
               "104-growth-limit",
               TestCondition.match(TestCondition.R8_COMPILER, TestCondition.RELEASE_MODE))
@@ -737,7 +736,7 @@
                   TestCondition.runtimesUpTo(DexVm.Version.V4_4_4)))
           .put("072-precise-gc",
               TestCondition.match(
-                  TestCondition.tools(DexTool.JACK, DexTool.NONE),
+                  TestCondition.tools(DexTool.NONE),
                   TestCondition.D8_COMPILER,
                   TestCondition.runtimesUpTo(DexVm.Version.V4_4_4)))
           // This one is expected to have different output. It counts instances, but the list that
@@ -753,7 +752,7 @@
           // Triggers regression test in 6.0.1 when using R8/D8 in debug mode.
           .put("474-fp-sub-neg",
               TestCondition.match(
-                  TestCondition.tools(DexTool.NONE, DexTool.JACK),
+                  TestCondition.tools(DexTool.NONE),
                   TestCondition.D8_NOT_AFTER_R8CF_COMPILER,
                   TestCondition.runtimes(DexVm.Version.V6_0_1)))
           .build();
@@ -794,7 +793,7 @@
           .put(
               "370-dex-v37",
               TestCondition.match(
-                  TestCondition.tools(DexTool.JACK, DexTool.DX),
+                  TestCondition.tools(DexTool.DX),
                   TestCondition.compilers(CompilerUnderTest.D8),
                   TestCondition.runtimes(
                       DexVm.Version.V4_0_4,
@@ -884,7 +883,7 @@
           .put(
               "972-iface-super-multidex",
               TestCondition.match(
-                  TestCondition.tools(DexTool.JACK, DexTool.DX),
+                  TestCondition.tools(DexTool.DX),
                   TestCondition.runtimes(
                       DexVm.Version.V4_0_4,
                       DexVm.Version.V4_4_4,
@@ -895,7 +894,7 @@
               "978-virtual-interface",
               TestCondition.or(
                   TestCondition.match(
-                      TestCondition.tools(DexTool.JACK, DexTool.DX),
+                      TestCondition.tools(DexTool.DX),
                       TestCondition.compilers(CompilerUnderTest.D8),
                       TestCondition.runtimes(
                           DexVm.Version.V4_0_4,
@@ -904,7 +903,7 @@
                           DexVm.Version.V6_0_1)),
                   // On V4_0_4 and V4_4_4 the test will throw a verification error.
                   TestCondition.match(
-                      TestCondition.tools(DexTool.JACK, DexTool.DX),
+                      TestCondition.tools(DexTool.DX),
                       TestCondition.compilers(
                           CompilerUnderTest.R8,
                           CompilerUnderTest.R8_AFTER_D8,
@@ -923,9 +922,6 @@
           .put("600-verifier-fails", TestCondition.match(TestCondition.R8DEX_COMPILER))
           // Contains a method that falls off the end without a return.
           .put("606-erroneous-class", TestCondition.match(
-              TestCondition.tools(DexTool.JACK),
-              TestCondition.R8_NOT_AFTER_D8_COMPILER))
-          .put("606-erroneous-class", TestCondition.match(
               TestCondition.tools(DexTool.DX),
               TestCondition.R8_NOT_AFTER_D8_COMPILER,
               LEGACY_RUNTIME))
@@ -1022,7 +1018,7 @@
               TestCondition.match(TestCondition.tools(DexTool.DX)))
           .build();
 
-  // Tests that does not have valid input for us to be compatible with jack/dx running.
+  // Tests that does not have valid input for us to be compatible with dx running.
   private static List<String> noInputJar = ImmutableList.of(
       "097-duplicate-method", // No input class files.
       "630-safecast-array", // No input class files.
@@ -1064,12 +1060,12 @@
   // Tests to skip on some conditions
   private static final Multimap<String, TestCondition> testToSkip =
       new ImmutableListMultimap.Builder<String, TestCondition>()
-          // When running R8 on dex input (D8, DX or JACK) this test non-deterministically fails
+          // When running R8 on dex input (D8, DX) this test non-deterministically fails
           // with a compiler exception, due to invoke-virtual on an interface, or it completes but
           // the output when run on Art is not as expected. b/65233869
           .put("162-method-resolution",
               TestCondition.match(
-                  TestCondition.tools(DexTool.DX, DexTool.JACK, DexTool.NONE),
+                  TestCondition.tools(DexTool.DX, DexTool.NONE),
                   TestCondition.R8_COMPILER))
           // Produces wrong output when compiled in release mode, which we cannot express.
           .put("015-switch",
@@ -1184,7 +1180,7 @@
     private final String name;
     // Directory of the test files (containing prebuild dex/jar files and expected output).
     private final File directory;
-    // Compiler that these expectations are for dx or Jack, or none if running on class files.
+    // Compiler that these expectations are for dx, or none if running on class files.
     private final DexTool dexTool;
     // Native library to use for running this test - if any.
     private final String nativeLibrary;
@@ -1384,7 +1380,7 @@
       skipTest.addAll(failuresToTriage);
 
       File artTestDir =
-          dexTool == DexTool.JACK || LEGACY_RUNTIME.contains(Runtime.fromDexVmVersion(version))
+          LEGACY_RUNTIME.contains(Runtime.fromDexVmVersion(version))
               ? legacyArtTestDir
               : defaultArtTestDir;
       // Collect the tests failing code generation.
@@ -1450,10 +1446,7 @@
       assert testDirs != null;
       for (File testDir : testDirs) {
         String name = testDir.getName();
-        // Skip all tests compiled to dex with jack on Dalvik. They have a too high dex
-        // version number in the generated output.
-        boolean skip = skipTest.contains(name) ||
-            (dexTool == DexTool.JACK && version.isOlderThanOrEqual(DexVm.Version.V4_4_4));
+        boolean skip = skipTest.contains(name);
         // All the native code for all Art tests is currently linked into the
         // libarttest.so file.
         data.put(
@@ -1501,7 +1494,7 @@
 
   private static String dexToolDirectory(DexTool tool) {
     // DexTool.NONE uses class files in the dx directory.
-    return tool == DexTool.JACK ? "jack" : "dx";
+    return "dx";
   }
 
   @Rule