Switch golem over to use new gradle except test benchmark target

Bug: b/302999071
Bug: b/300387869
Change-Id: I9e1791a4430d2f076419ebcb89cf76e6a962e7d1
diff --git a/tools/golem_build.py b/tools/golem_build.py
index 4f668d6..1cbf39f 100755
--- a/tools/golem_build.py
+++ b/tools/golem_build.py
@@ -17,11 +17,17 @@
   return [ item.lower() for item in items ]
 
 def Main():
+  # TODO(b/302999071): Move java based benchmarking to new gradle
   targets = set()
-  targets.update(lower(run_benchmark.GOLEM_BUILD_TARGETS))
-  targets.update(lower(run_on_app_dump.GOLEM_BUILD_TARGETS))
+  targets.update(lower(run_benchmark.GOLEM_BUILD_TARGETS_OLD))
   cmd = GRADLE_ARGS + [target for target in targets]
   gradle.RunGradle(cmd)
 
+  targets = set()
+  targets.update(lower(run_benchmark.GOLEM_BUILD_TARGETS_NEW))
+  targets.update(lower(run_on_app_dump.GOLEM_BUILD_TARGETS))
+  cmd = GRADLE_ARGS + [target for target in targets]
+  gradle.RunGradle(cmd, new_gradle=True)
+
 if __name__ == '__main__':
   sys.exit(Main())
diff --git a/tools/run_benchmark.py b/tools/run_benchmark.py
index 41da451..c066678 100755
--- a/tools/run_benchmark.py
+++ b/tools/run_benchmark.py
@@ -16,11 +16,13 @@
 NONLIB_BUILD_TARGET = 'R8WithRelocatedDeps'
 NONLIB_TEST_BUILD_TARGETS = [utils.R8_TESTS_TARGET, utils.R8_TESTS_DEPS_TARGET]
 
-R8LIB_BUILD_TARGET = utils.R8LIB
+# TODO(b/300387869): Cleanup targets
+R8LIB_BUILD_TARGET = ':test:r8LibWithRelocatedDeps'
 R8LIB_TEST_BUILD_TARGETS = [utils.R8LIB_TESTS_TARGET, utils.R8LIB_TESTS_DEPS_TARGET]
 
 # The r8lib target is always the golem target.
-GOLEM_BUILD_TARGETS = [R8LIB_BUILD_TARGET] + R8LIB_TEST_BUILD_TARGETS
+GOLEM_BUILD_TARGETS_OLD = R8LIB_TEST_BUILD_TARGETS
+GOLEM_BUILD_TARGETS_NEW = [R8LIB_BUILD_TARGET]
 
 def get_golem_resource_path(benchmark):
   return os.path.join('benchmarks', benchmark)
@@ -87,7 +89,7 @@
     testjars = [utils.R8_TESTS_DEPS_JAR, utils.R8_TESTS_JAR]
   else:
     testBuildTargets = R8LIB_TEST_BUILD_TARGETS
-    buildTargets = GOLEM_BUILD_TARGETS
+    buildTargets = GOLEM_BUILD_TARGETS_OLD + GOLEM_BUILD_TARGETS_NEW
     r8jar = utils.R8LIB_JAR
     testjars = [utils.R8LIB_TESTS_DEPS_JAR, utils.R8LIB_TESTS_JAR]
 
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py
index 88bc1a9..8602ea9 100755
--- a/tools/run_on_app_dump.py
+++ b/tools/run_on_app_dump.py
@@ -23,7 +23,9 @@
 import update_prebuilds_in_android
 import utils
 
-GOLEM_BUILD_TARGETS = ['R8Lib', 'R8Retrace']
+# TODO(b/300387869): Cleanup targets
+GOLEM_BUILD_TARGETS = [':test:r8LibWithRelocatedDeps',
+                       ':test:retraceWithRelocatedDeps']
 SHRINKERS = ['r8', 'r8-full', 'r8-nolib', 'r8-nolib-full']
 
 class AttrDict(dict):