Set jdkhome for golem runners

This is extracted into benchmarks/app.name
and our tarball has the linux version under a linux directory

Bug: 173189095
Change-Id: I07b9082b695cf8afc584c1e2dea30acf498d9a1c
diff --git a/tools/compiledump.py b/tools/compiledump.py
index bce5d75..1e336c1 100755
--- a/tools/compiledump.py
+++ b/tools/compiledump.py
@@ -246,12 +246,12 @@
   utils.download_file_from_cloud_storage(source, dest)
   return dest
 
-def prepare_wrapper(dist, temp):
+def prepare_wrapper(dist, temp, jdkhome):
   wrapper_file = os.path.join(
       utils.REPO_ROOT,
       'src/main/java/com/android/tools/r8/utils/CompileDumpCompatR8.java')
   cmd = [
-    jdk.GetJavacExecutable(),
+    jdk.GetJavacExecutable(jdkhome),
     wrapper_file,
     '-d', temp,
     '-cp', dist,
@@ -263,7 +263,7 @@
 def is_hash(version):
   return len(version) == 40
 
-def run1(out, args, otherargs):
+def run1(out, args, otherargs, jdkhome=None):
   with utils.TempDir() as temp:
     if out:
       temp = out
@@ -283,8 +283,8 @@
     jar = args.r8_jar if args.r8_jar else download_distribution(args, version, temp)
     if ':' not in jar and not os.path.exists(jar):
       error("Distribution does not exist: " + jar)
-    wrapper_dir = prepare_wrapper(jar, temp)
-    cmd = [jdk.GetJavaExecutable()]
+    wrapper_dir = prepare_wrapper(jar, temp, jdkhome)
+    cmd = [jdk.GetJavaExecutable(jdkhome)]
     if args.debug_agent:
       if not args.nolib:
         print("WARNING: Running debugging agent on r8lib is questionable...")
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py
index 779af1d..7aacfa6 100755
--- a/tools/run_on_app_dump.py
+++ b/tools/run_on_app_dump.py
@@ -642,11 +642,14 @@
     if result.get('recompilation_status') != 'success':
       break
 
+def get_jdk_home(options, app):
+  if options.golem or True:
+    return os.path.join('benchmarks', app.name, 'linux')
+  return None
 
 def build_app_with_shrinker(app, options, temp_dir, app_dir, shrinker,
                             compilation_step_index, compilation_steps,
                             prev_recomp_jar):
-
   args = AttrDict({
     'dump': dump_for_app(app_dir, app),
     'r8_jar': get_r8_jar(options, temp_dir, shrinker),
@@ -668,9 +671,9 @@
     temp_dir, '{}_{}_{}_dex_out.jar.map'.format(
       app.name, shrinker, compilation_step_index))
   recomp_jar = None
-
+  jdkhome = get_jdk_home(options, app)
   with utils.TempDir() as compile_temp_dir:
-    compile_result = compiledump.run1(compile_temp_dir, args, [])
+    compile_result = compiledump.run1(compile_temp_dir, args, [], jdkhome)
     out_jar = os.path.join(compile_temp_dir, "out.jar")
     out_mapping = os.path.join(compile_temp_dir, "out.jar.map")
 
@@ -683,7 +686,7 @@
       args['classfile'] = True
       args['min_api'] = "10000"
       args['disable_desugared_lib'] = True
-      compile_result = compiledump.run1(compile_temp_dir, args, [])
+      compile_result = compiledump.run1(compile_temp_dir, args, [], jdkhome)
       if compile_result == 0:
         recomp_jar = os.path.join(
           temp_dir, '{}_{}_{}_cf_out.jar'.format(
@@ -724,7 +727,8 @@
       app.name, shrinker, compilation_step_index))
 
   with utils.TempDir() as compile_temp_dir:
-    compile_result = compiledump.run1(compile_temp_dir, args, [])
+    jdkhome = get_jdk_home(options, app)
+    compile_result = compiledump.run1(compile_temp_dir, args, [], jdkhome)
     out_jar = os.path.join(compile_temp_dir, "out.jar")
     if compile_result != 0 or not os.path.isfile(out_jar):
       return None