Remove build and release tasks for retrace-only jars

Bug: b/304992619
Change-Id: Ie084e3254f48f9415686a99ea761929b44583dac
diff --git a/d8_r8/test/build.gradle.kts b/d8_r8/test/build.gradle.kts
index ad8543e..4a1de06 100644
--- a/d8_r8/test/build.gradle.kts
+++ b/d8_r8/test/build.gradle.kts
@@ -179,45 +179,6 @@
             "r8lib.jar")
   }
 
-  val assembleRetraceLibNoDeps by registering(Exec::class) {
-    dependsOn(assembleR8LibNoDeps, mainDepsJarTask, r8WithRelocatedDepsTask)
-    val mainDepsJar = mainDepsJarTask.getSingleOutputFile()
-    val r8LibNoDepsJar = assembleR8LibNoDeps.getSingleOutputFile()
-    val r8WithRelocatedDepsJar = r8WithRelocatedDepsTask.getSingleOutputFile()
-    inputs.files(mainDepsJar, r8LibNoDepsJar, r8WithRelocatedDepsJar)
-    val inputMap = file("$r8LibNoDepsJar.map")
-    val outputJar = getRoot().resolveAll("build", "libs", "r8retrace-exclude-deps.jar")
-    outputs.file(outputJar)
-    commandLine = createR8LibCommandLine(
-            r8WithRelocatedDepsJar,
-            r8LibNoDepsJar,
-            outputJar,
-            listOf(getRoot().resolveAll("src", "main", "keep_retrace.txt")),
-            excludingDepsVariant = true,
-            debugVariant = true,
-            lib = listOf(mainDepsJar),
-            pgInputMap = inputMap)
-  }
-
-  val assembleRetraceLibWithRelocatedDeps by registering(Exec::class) {
-    dependsOn(assembleR8LibWithRelocatedDeps, mainDepsJarTask, r8WithRelocatedDepsTask)
-    val mainDepsJar = mainDepsJarTask.getSingleOutputFile()
-    val r8LibWithRelocatedDepsJar = assembleR8LibWithRelocatedDeps.getSingleOutputFile()
-    val r8WithRelocatedDepsJar = r8WithRelocatedDepsTask.getSingleOutputFile()
-    inputs.files(mainDepsJar, r8LibWithRelocatedDepsJar, r8WithRelocatedDepsJar)
-    val inputMap = file("$r8LibWithRelocatedDepsJar.map")
-    val outputJar = getRoot().resolveAll("build", "libs", "r8retrace.jar")
-    outputs.file(outputJar)
-    commandLine = createR8LibCommandLine(
-      r8WithRelocatedDepsJar,
-      r8LibWithRelocatedDepsJar,
-      outputJar,
-      listOf(getRoot().resolveAll("src", "main", "keep_retrace.txt")),
-      excludingDepsVariant = false,
-      debugVariant = true,
-      pgInputMap = inputMap)
-  }
-
   val resourceshrinkercli by registering(Exec::class) {
     dependsOn(r8WithRelocatedDepsTask)
     val r8 = r8WithRelocatedDepsTask.getSingleOutputFile()
@@ -393,7 +354,6 @@
     systemProperty("EXAMPLES_JAVA_11_JAVAC_BUILD_DIR",
             getRoot().resolveAll("build", "test", "examplesJava11", "classes"))
     systemProperty("R8_RUNTIME_PATH", r8LibJar)
-    // TODO(b/270105162): This should change if running with retrace lib/r8lib.
     systemProperty("RETRACE_RUNTIME_PATH", r8LibJar)
     systemProperty("R8_DEPS", mainDepsJarTask.getSingleOutputFile())
     systemProperty("com.android.tools.r8.artprofilerewritingcompletenesscheck", "true")
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index a044f68..c03fadc 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -248,7 +248,6 @@
   public static final Path RETRACE_MAPS_DIR = Paths.get(THIRD_PARTY_DIR, "r8mappings");
 
   // TODO(b/270105162): These should be removed when finished transitioning.
-  public static final Path R8_JAR_OLD = Paths.get(LIBS_DIR, "r8.jar");
   public static final Path R8_WITH_RELOCATED_DEPS_17_JAR =
       Paths.get(LIBS_DIR, "r8_with_relocated_deps_17.jar");
   public static final Path R8LIB_JAR = Paths.get(LIBS_DIR, "r8lib.jar");
@@ -257,7 +256,6 @@
   public static final Path R8LIB_EXCLUDE_DEPS_JAR = Paths.get(LIBS_DIR, "r8lib-exclude-deps.jar");
   public static final Path R8LIB_EXCLUDE_DEPS_MAP =
       Paths.get(LIBS_DIR, "r8lib-exclude-deps.jar.map");
-  public static final Path R8_RETRACE_JAR = Paths.get(LIBS_DIR, "r8retrace.jar");
 
   public static Path getDeps() {
     assert System.getProperty("R8_DEPS") != null;
diff --git a/tools/archive.py b/tools/archive.py
index eb4ab98..fd250dd 100755
--- a/tools/archive.py
+++ b/tools/archive.py
@@ -175,7 +175,6 @@
                 utils.GRADLE_TASK_R8LIB, utils.GRADLE_TASK_R8LIB_NO_DEPS,
                 utils.GRADLE_TASK_THREADING_MODULE_BLOCKING,
                 utils.GRADLE_TASK_THREADING_MODULE_SINGLE_THREADED,
-                utils.GRADLE_TASK_RETRACE, utils.GRADLE_TASK_RETRACE_NO_DEPS,
                 utils.GRADLE_TASK_SOURCE_JAR,
                 utils.GRADLE_TASK_SWISS_ARMY_KNIFE, '-Pno_internal'
             ])
@@ -243,10 +242,6 @@
             utils.DESUGAR_CONFIGURATION_JDK11_MINIMAL_MAVEN_ZIP,
             utils.DESUGAR_CONFIGURATION_JDK11_MAVEN_ZIP,
             utils.DESUGAR_CONFIGURATION_JDK11_NIO_MAVEN_ZIP, utils.R8_SRC_JAR,
-            utils.R8RETRACE_JAR, utils.R8RETRACE_JAR + '.map',
-            utils.R8RETRACE_JAR + '_map.zip', utils.R8RETRACE_EXCLUDE_DEPS_JAR,
-            utils.R8RETRACE_EXCLUDE_DEPS_JAR + '.map',
-            utils.R8RETRACE_EXCLUDE_DEPS_JAR + '_map.zip',
             utils.KEEPANNO_ANNOTATIONS_JAR,
             utils.GENERATED_LICENSE,
             'd8_r8/main/build/spdx/r8.spdx.json'
diff --git a/tools/r8_release.py b/tools/r8_release.py
index 4a06135..a5d7a4c 100755
--- a/tools/r8_release.py
+++ b/tools/r8_release.py
@@ -424,9 +424,6 @@
             g4_open('src.jar')
             g4_open('lib.jar')
             g4_open('lib.jar.map')
-            g4_open('retrace_full.jar')
-            g4_open('retrace_lib.jar')
-            g4_open('retrace_lib.jar.map')
             g4_open('desugar_jdk_libs_configuration.jar')
             g4_open('threading-module-blocking.jar')
             g4_open('threading-module-single-threaded.jar')
@@ -434,9 +431,6 @@
                           'r8-full-exclude-deps.jar',
                           'full.jar')
             download_file(options.version,
-                          'r8-full-exclude-deps.jar',
-                          'retrace_full.jar')
-            download_file(options.version,
                           'r8-src.jar',
                           'src.jar')
             download_file(options.version,
@@ -449,12 +443,6 @@
                           'desugar_jdk_libs_configuration.jar',
                           'desugar_jdk_libs_configuration.jar')
             download_file(options.version,
-                          'r8retrace-exclude-deps.jar',
-                          'retrace_lib.jar')
-            download_file(options.version,
-                          'r8retrace-exclude-deps.jar.map',
-                          'retrace_lib.jar.map')
-            download_file(options.version,
                           'threading-module-blocking.jar',
                           'threading-module-blocking.jar')
             download_file(options.version,
@@ -464,7 +452,7 @@
                 g4_open('METADATA')
                 metadata_path = os.path.join(third_party_r8, 'METADATA')
                 match_count = 0
-                match_count_expected = 12
+                match_count_expected = 11
                 version_match_regexp = r'[1-9]\.[0-9]{1,2}\.[0-9]{1,3}-dev'
                 for line in open(metadata_path, 'r'):
                     result = re.search(version_match_regexp, line)
@@ -505,74 +493,6 @@
     return release_google3
 
 
-def prepare_google3_retrace(args):
-    assert args.version
-    # Check if an existing client exists.
-    if not args.use_existing_work_branch:
-        check_no_google3_client(args, args.p4_client)
-
-    def release_google3_retrace(options):
-        print("Releasing Retrace for Google 3")
-        if options.dry_run:
-            return 'DryRun: omitting g3 release for %s' % options.version
-
-        google3_base = subprocess.check_output(
-            ['p4', 'g4d', '-f', args.p4_client]).decode('utf-8').rstrip()
-        third_party_r8 = os.path.join(google3_base, 'third_party', 'java', 'r8')
-        with utils.ChangedWorkingDirectory(third_party_r8):
-            # download files
-            g4_open('retrace_full.jar')
-            g4_open('retrace_lib.jar')
-            g4_open('retrace_lib.jar.map')
-            download_file(options.version, 'r8-full-exclude-deps.jar',
-                          'retrace_full.jar')
-            download_file(options.version, 'r8retrace-exclude-deps.jar',
-                          'retrace_lib.jar')
-            download_file(options.version, 'r8lib-exclude-deps.jar.map',
-                          'retrace_lib.jar.map')
-            g4_open('METADATA')
-            metadata_path = os.path.join(third_party_r8, 'METADATA')
-            match_count = 0
-            version_match_regexp = r'[1-9]\.[0-9]{1,2}\.[0-9]{1,3}-dev/r8retrace-exclude-deps.jar'
-            for line in open(metadata_path, 'r'):
-                result = re.search(version_match_regexp, line)
-                if result:
-                    match_count = match_count + 1
-            if match_count != 1:
-                print((
-                    "Could not find the previous retrace release string to replace in "
-                    +
-                    "METADATA. Expected to find is mentioned 1 times. Please update %s "
-                    + "manually and run again with options --google3retrace " +
-                    "--use-existing-work-branch.") % metadata_path)
-                sys.exit(1)
-            sed(version_match_regexp,
-                options.version + "/r8retrace-exclude-deps.jar", metadata_path)
-            subprocess.check_output('chmod u+w *', shell=True)
-
-        with utils.ChangedWorkingDirectory(google3_base):
-            blaze_result = blaze_run(
-                '//third_party/java/r8:retrace -- --version')
-
-            print(blaze_result)
-            assert options.version in blaze_result
-
-            if not options.no_upload:
-                change_result = g4_change(options.version)
-                change_result += 'Run \'(g4d ' + args.p4_client \
-                                 + ' && tap_presubmit -p all --train -c ' \
-                                 + get_cl_id(change_result) + ')\' for running TAP global' \
-                                 + ' presubmit using the train.\n' \
-                                 + 'Run \'(g4d ' + args.p4_client \
-                                 + ' && tap_presubmit -p all --notrain --detach --email' \
-                                 + ' --skip_flaky_targets --skip_already_failing -c ' \
-                                 + get_cl_id(change_result) + ')\' for running an isolated' \
-                                 + ' TAP global presubmit.'
-                return change_result
-
-    return release_google3_retrace
-
-
 def update_desugar_library_in_studio(args):
     assert os.path.exists(args.studio), ("Could not find STUDIO path %s" %
                                          args.studio)
@@ -1059,10 +979,6 @@
                         default=False,
                         action='store_true',
                         help='Release for google 3')
-    result.add_argument('--google3retrace',
-                        default=False,
-                        action='store_true',
-                        help='Release retrace for google 3')
     result.add_argument('--p4-client',
                         default='update-r8',
                         metavar=('<client name>'),
@@ -1137,8 +1053,6 @@
 
     if args.google3:
         targets_to_run.append(prepare_google3(args))
-    if args.google3retrace:
-        targets_to_run.append(prepare_google3_retrace(args))
     if args.studio and not args.update_desugar_library_in_studio:
         targets_to_run.append(prepare_studio(args))
     if args.aosp:
diff --git a/tools/retrace.py b/tools/retrace.py
index 6642224..911c646 100755
--- a/tools/retrace.py
+++ b/tools/retrace.py
@@ -188,7 +188,7 @@
         )
 
     if not r8jar:
-        r8jar = utils.R8_JAR if no_r8lib else utils.R8RETRACE_JAR
+        r8jar = utils.R8_JAR if no_r8lib else utils.R8LIB
 
     retrace_args += [
         '-cp', r8jar, 'com.android.tools.r8.retrace.Retrace', map_path
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py
index 902c675..c06e878 100755
--- a/tools/run_on_app_dump.py
+++ b/tools/run_on_app_dump.py
@@ -23,7 +23,7 @@
 import update_prebuilds_in_android
 import utils
 
-GOLEM_BUILD_TARGETS = [utils.GRADLE_TASK_R8LIB, utils.GRADLE_TASK_RETRACE]
+GOLEM_BUILD_TARGETS = [utils.GRADLE_TASK_R8LIB]
 SHRINKERS = ['r8', 'r8-full', 'r8-nolib', 'r8-nolib-full']
 
 
@@ -1287,7 +1287,7 @@
         elif options.version == 'main':
             if not options.no_build:
                 gradle.RunGradle([
-                    utils.GRADLE_TASK_RETRACE, utils.GRADLE_TASK_R8,
+                    utils.GRADLE_TASK_R8,
                     '-Pno_internal'
                 ])
                 build_r8lib = False
diff --git a/tools/utils.py b/tools/utils.py
index 252be60..597f8b1 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -48,8 +48,6 @@
 GRADLE_TASK_R8LIB_NO_DEPS = ':test:assembleR8LibNoDeps'
 GRADLE_TASK_THREADING_MODULE_BLOCKING = ':main:threadingModuleBlockingJar'
 GRADLE_TASK_THREADING_MODULE_SINGLE_THREADED = ':main:threadingModuleSingleThreadedJar'
-GRADLE_TASK_RETRACE = ':test:assembleRetraceLibWithRelocatedDeps'
-GRADLE_TASK_RETRACE_NO_DEPS = ':test:assembleRetraceLibNoDeps'
 GRADLE_TASK_SOURCE_JAR = ':test:packageSources'
 GRADLE_TASK_SWISS_ARMY_KNIFE = ':main:swissArmyKnife'
 GRADLE_TASK_TEST = ':test:test'
@@ -69,8 +67,6 @@
 R8_FULL_EXCLUDE_DEPS_JAR = os.path.join(LIBS, 'r8-full-exclude-deps.jar')
 THREADING_MODULE_BLOCKING_JAR = os.path.join(LIBS, 'threading-module-blocking.jar')
 THREADING_MODULE_SINGLE_THREADED_JAR = os.path.join(LIBS, 'threading-module-single-threaded.jar')
-R8RETRACE_JAR = os.path.join(LIBS, 'r8retrace.jar')
-R8RETRACE_EXCLUDE_DEPS_JAR = os.path.join(LIBS, 'r8retrace-exclude-deps.jar')
 R8_TESTS_JAR = os.path.join(LIBS, 'r8tests.jar')
 R8LIB_TESTS_JAR = os.path.join(LIBS, 'r8libtestdeps-cf.jar')
 R8_TESTS_DEPS_JAR = os.path.join(LIBS, 'test_deps_all.jar')