Remove old YouTube versions

Change-Id: I31145c327f1e9893166fc8e7f5c25ee8241395a8
diff --git a/tools/internal_test.py b/tools/internal_test.py
index e267763..ee7a8323 100755
--- a/tools/internal_test.py
+++ b/tools/internal_test.py
@@ -38,6 +38,8 @@
 import utils
 import run_on_app
 
+import youtube_data
+
 # How often the bot/tester should check state
 PULL_DELAY = 30
 TEST_RESULT_DIR = 'internal'
@@ -74,7 +76,7 @@
     },
     {
         'app': 'youtube',
-        'version': '12.22',
+        'version': youtube_data.LATEST_VERSION,
         'find-xmx-min': 750,
         'find-xmx-max': 1150,
         'find-xmx-range': 32,
diff --git a/tools/run_on_app.py b/tools/run_on_app.py
index 60cd4f1..c775aa0 100755
--- a/tools/run_on_app.py
+++ b/tools/run_on_app.py
@@ -396,7 +396,7 @@
     version = options.version or '20180926'
     data = nest_data
   elif options.app == 'youtube':
-    version = options.version or '12.22'
+    version = options.version or youtube_data.LATEST_VERSION
     data = youtube_data
   elif options.app == 'chrome':
     version = options.version or '180917'
diff --git a/tools/run_proguard_dx_on_app.py b/tools/run_proguard_dx_on_app.py
deleted file mode 100755
index bb1d72a..0000000
--- a/tools/run_proguard_dx_on_app.py
+++ /dev/null
@@ -1,160 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-# Run ProGuard and the DX (= D8) tool on GmsCore V10.
-
-from __future__ import print_function
-from glob import glob
-from os import makedirs
-from os.path import exists, join, splitext
-from subprocess import check_call
-import argparse
-import fnmatch
-import gmscore_data
-import jdk
-import os
-import stat
-import sys
-import time
-
-import gmail_data
-import gmscore_data
-import golem
-import proguard
-import utils
-import youtube_data
-
-APPS = ['gmscore', 'youtube']
-DX_JAR = join(utils.REPO_ROOT, 'tools', 'linux', 'dx', 'framework', 'dx.jar')
-
-def parse_arguments(argv):
-  parser = argparse.ArgumentParser(
-      description = 'Run ProGuard and the DX tool on GmsCore V10.')
-  parser.add_argument('--app', required = True, choices = APPS)
-  parser.add_argument('--out',
-      help = 'Output directory for the DX tool.',
-      default = os.getcwd())
-  parser.add_argument('--golem',
-      help = 'Link in third party dependencies.',
-      default = False,
-      action = 'store_true')
-  parser.add_argument('--print-runtimeraw',
-      metavar = 'BENCHMARKNAME',
-      help = 'Print the line \'<BENCHMARKNAME>(RunTimeRaw): <elapsed>' +
-             ' ms\' at the end where <elapsed> is the elapsed time in' +
-             ' milliseconds.')
-  parser.add_argument('--print-memoryuse',
-      metavar='BENCHMARKNAME',
-      help='Print the line \'<BENCHMARKNAME>(MemoryUse):' +
-           ' <mem>\' at the end where <mem> is the peak' +
-           ' peak resident set size (VmHWM) in bytes.')
-  parser.add_argument('--print-dexsegments',
-      metavar = 'BENCHMARKNAME',
-      help = 'Print the sizes of individual dex segments as ' +
-          '\'<BENCHMARKNAME>-<segment>(CodeSize): <bytes>\'')
-  return parser.parse_args(argv)
-
-def Main(argv):
-  options = parse_arguments(argv)
-  if options.golem:
-    golem.link_third_party()
-  utils.check_java_version()
-  outdir = options.out
-
-  if options.app == 'gmscore':
-    version = 'v10'
-    data = gmscore_data
-    base = data.V10_BASE
-  elif options.app == 'youtube':
-    version = '12.22'
-    data = youtube_data
-    base = data.V12_22_BASE
-  else:
-    raise Exception('Unexpected')
-
-
-  args = ['-forceprocessing']
-
-  if not outdir.endswith('.zip') and not outdir.endswith('.jar') \
-      and not exists(outdir):
-    makedirs(outdir)
-
-
-  values_deploy = data.VERSIONS[version]['deploy']
-  values_proguarded = data.VERSIONS[version]['proguarded']
-  assert 'pgconf' in values_deploy
-
-  for pgconf in values_deploy['pgconf']:
-    args.extend(['@' + pgconf])
-
-  # find seeds file
-  inputs = data.VERSIONS[version]['proguarded']['inputs']
-  assert len(inputs) == 1
-  basename_wo_ext = splitext(os.path.basename(inputs[0]))[0]
-  seeds_filename = basename_wo_ext + '.seeds'
-
-  seeds_files = []
-  for root, dirnames, filenames in os.walk(join(base, 'blaze-out')):
-    for filename in fnmatch.filter(filenames, seeds_filename):
-        seeds_files.append(os.path.join(root, filename))
-  assert len(seeds_files) == 1
-
-  seeds_path = seeds_files[0]
-  proguarded_jar_path = splitext(seeds_path)[0] + '.jar'
-
-  # Remove write-protection from seeds file. The seeds file is an output of
-  # ProGuard so it aborts if this is not writeable.
-  st = os.stat(seeds_path)
-  os.chmod(seeds_path,
-      st.st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
-
-  t0 = time.time()
-
-  proguard_memoryuse = None
-
-  with utils.TempDir() as temp:
-    track_memory_file = None
-    if options.print_memoryuse:
-      track_memory_file = join(temp, utils.MEMORY_USE_TMP_FILE)
-    proguard.run(
-        args,
-        version='pg_internal',
-        track_memory_file = track_memory_file,
-        stdout=open(os.devnull, 'w'))
-    if options.print_memoryuse:
-      proguard_memoryuse = utils.grep_memoryuse(track_memory_file)
-
-  # run dex on the result
-  jar = DX_JAR
-
-  with utils.TempDir() as temp:
-    track_memory_file = None
-    cmd = []
-    if options.print_memoryuse:
-      track_memory_file = join(temp, utils.MEMORY_USE_TMP_FILE)
-      cmd.extend(['tools/track_memory.sh', track_memory_file])
-    cmd.extend([jdk.GetJavaExecutable(), '-jar', jar, '--multi-dex',
-        '--output=' + outdir])
-    if 'min-api' in values_proguarded:
-      cmd.append('--min-sdk-version=' + values_proguarded['min-api'])
-    cmd.extend(['--dex', proguarded_jar_path])
-    utils.PrintCmd(cmd);
-    check_call(cmd)
-    if options.print_memoryuse:
-      dx_memoryuse = utils.grep_memoryuse(track_memory_file)
-      print('{}(MemoryUse): {}'
-          .format(options.print_memoryuse,
-              max(proguard_memoryuse, dx_memoryuse)))
-
-  if options.print_runtimeraw:
-    print('{}(RunTimeRaw): {} ms'
-        .format(options.print_runtimeraw, 1000.0 * (time.time() - t0)))
-
-  if options.print_dexsegments:
-    dex_files = glob(os.path.join(outdir, '*.dex'))
-    utils.print_dexsegments(options.print_dexsegments, dex_files)
-
-if __name__ == '__main__':
-  sys.exit(Main(sys.argv[1:]))
diff --git a/tools/run_proguard_dx_on_gmscore.py b/tools/run_proguard_dx_on_gmscore.py
deleted file mode 100755
index 5a6e42a..0000000
--- a/tools/run_proguard_dx_on_gmscore.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-# Run ProGuard and the DX or CompatDX (= D8) tool on GmsCore V10.
-
-import sys
-
-import run_proguard_dx_on_app
-
-if __name__ == '__main__':
-  sys.exit(run_proguard_dx_on_app.Main(sys.argv[1:] + ['--app', 'gmscore']))
diff --git a/tools/youtube_data.py b/tools/youtube_data.py
index 04d9e1f..d12cfb6 100644
--- a/tools/youtube_data.py
+++ b/tools/youtube_data.py
@@ -2,7 +2,6 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-import glob
 import os
 import utils
 
@@ -10,256 +9,20 @@
 ANDROID_L_API = '21'
 BASE = os.path.join(utils.THIRD_PARTY, 'youtube')
 
-V12_10_BASE = os.path.join(BASE, 'youtube.android_12.10')
-V12_10_PREFIX = os.path.join(V12_10_BASE, 'YouTubeRelease')
-
-V12_17_BASE = os.path.join(BASE, 'youtube.android_12.17')
-V12_17_PREFIX = os.path.join(V12_17_BASE, 'YouTubeRelease')
-
-V12_22_BASE = os.path.join(BASE, 'youtube.android_12.22')
-V12_22_PREFIX = os.path.join(V12_22_BASE, 'YouTubeRelease')
-
-V13_37_BASE = os.path.join(BASE, 'youtube.android_13.37')
-V13_37_PREFIX = os.path.join(V13_37_BASE, 'YouTubeRelease')
-
-V14_19_BASE = os.path.join(BASE, 'youtube.android_14.19')
-V14_19_PREFIX = os.path.join(V14_19_BASE, 'YouTubeRelease')
-
-V14_44_BASE = os.path.join(BASE, 'youtube.android_14.44')
-V14_44_PREFIX = os.path.join(V14_44_BASE, 'YouTubeRelease')
-
-V15_08_BASE = os.path.join(BASE, 'youtube.android_15.08')
-V15_08_PREFIX = os.path.join(V15_08_BASE, 'YouTubeRelease')
-
-V15_09_BASE = os.path.join(BASE, 'youtube.android_15.09')
-V15_09_PREFIX = os.path.join(V15_09_BASE, 'YouTubeRelease')
-
 V15_33_BASE = os.path.join(BASE, 'youtube.android_15.33')
 V15_33_PREFIX = os.path.join(V15_33_BASE, 'YouTubeRelease')
 
 V16_12_BASE = os.path.join(BASE, 'youtube.android_16.12')
 V16_12_PREFIX = os.path.join(V16_12_BASE, 'YouTubeRelease')
 
-# NOTE: we always use android.jar for SDK v25, later we might want to revise it
-#       to use proper android.jar version for each of youtube version separately.
-ANDROID_JAR = utils.get_android_jar(25)
+LATEST_VERSION = '16.12'
 
 VERSIONS = {
-  '12.10': {
-    'dex' : {
-      'inputs': [os.path.join(V12_10_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V12_10_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      'inputs': ['%s_deploy.jar' % V12_10_PREFIX],
-      'pgconf': ['%s_proguard.config' % V12_10_PREFIX,
-                 '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-                 utils.IGNORE_WARNINGS_RULES],
-      'min-api' : ANDROID_L_API,
-    }
-    # The 'proguarded' version cannot be handled by D8/R8 because there are
-    # parameter annotations for parameters that do not exist, which is not
-    # handled gracefully by ASM (see b/116089492).
-    #'proguarded' : {
-    #  'inputs': ['%s_proguard.jar' % V12_10_PREFIX],
-    #  'pgmap': '%s_proguard.map' % V12_10_PREFIX,
-    #  'min-api' : ANDROID_L_API,
-    #}
-  },
-  '12.17': {
-    'dex' : {
-      'inputs': [os.path.join(V12_17_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V12_17_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      'inputs': ['%s_deploy.jar' % V12_17_PREFIX],
-      'pgconf': ['%s_proguard.config' % V12_17_PREFIX,
-                 '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-                 utils.IGNORE_WARNINGS_RULES],
-      'min-api' : ANDROID_L_API,
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V12_17_PREFIX],
-      'pgmap': '%s_proguard.map' % V12_17_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
-  '12.22': {
-    'dex' : {
-      'inputs': [os.path.join(V12_22_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V12_22_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      'inputs': ['%s_deploy.jar' % V12_22_PREFIX],
-      'pgconf': [
-          '%s_proguard.config' % V12_22_PREFIX,
-          '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-          utils.IGNORE_WARNINGS_RULES],
-      'maindexrules' : [
-          os.path.join(V12_22_BASE, 'mainDexClasses.rules'),
-          os.path.join(V12_22_BASE, 'main-dex-classes-release.cfg'),
-          os.path.join(V12_22_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V12_22_PREFIX],
-      'pgmap': '%s_proguard.map' % V12_22_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
-  '13.37': {
-    'dex' : {
-      'inputs': [os.path.join(V13_37_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V13_37_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      'inputs': ['%s_deploy.jar' % V13_37_PREFIX],
-      'pgconf': [
-          '%s_proguard.config' % V13_37_PREFIX,
-          '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-          utils.IGNORE_WARNINGS_RULES],
-      # Build for native multi dex, as Currently R8 cannot meet the main-dex
-      # constraints.
-      #'maindexrules' : [
-      #    os.path.join(V13_37_BASE, 'mainDexClasses.rules'),
-      #    os.path.join(V13_37_BASE, 'main-dex-classes-release-optimized.cfg'),
-      #    os.path.join(V13_37_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
-      'min-api' : ANDROID_L_API,
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V13_37_PREFIX],
-      'pgmap': '%s_proguard.map' % V13_37_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
-  '14.19': {
-    'dex' : {
-      'inputs': [os.path.join(V14_19_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V14_19_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      'inputs': ['%s_deploy.jar' % V14_19_PREFIX],
-      'pgconf': [
-          '%s_proguard.config' % V14_19_PREFIX,
-          '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-          utils.IGNORE_WARNINGS_RULES],
-      'maindexrules' : [
-          os.path.join(V14_19_BASE, 'mainDexClasses.rules'),
-          os.path.join(V14_19_BASE, 'main-dex-classes-release-optimized.pgcfg'),
-          os.path.join(V14_19_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
-      'min-api' : ANDROID_H_MR2_API,
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V14_19_PREFIX],
-      'pgmap': '%s_proguard.map' % V14_19_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
-  '14.44': {
-    'dex' : {
-      'inputs': [os.path.join(V14_44_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V14_44_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      # When -injars and -libraryjars are used for specifying inputs library
-      # sanitization is on by default. For this version of YouTube -injars and
-      # -libraryjars are not used, but library sanitization is still required.
-      'sanitize_libraries': True,
-      'inputs': ['%s_deploy.jar' % V14_44_PREFIX],
-      'libraries' : [os.path.join(V14_44_BASE, 'legacy_YouTubeRelease_combined_library_jars.jar')],
-      'pgconf': [
-          '%s_proguard.config' % V14_44_PREFIX,
-          '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-          utils.IGNORE_WARNINGS_RULES],
-      'maindexrules' : [
-          os.path.join(V14_44_BASE, 'mainDexClasses.rules'),
-          os.path.join(V14_44_BASE, 'main-dex-classes-release-optimized.pgcfg'),
-          os.path.join(V14_44_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
-      'min-api' : ANDROID_H_MR2_API,
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V14_44_PREFIX],
-      'pgmap': '%s_proguard.map' % V14_44_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
-  '15.08': {
-    'dex' : {
-      'inputs': [os.path.join(V15_08_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V15_08_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      # When -injars and -libraryjars are used for specifying inputs library
-      # sanitization is on by default. For this version of YouTube -injars and
-      # -libraryjars are not used, but library sanitization is still required.
-      'sanitize_libraries': True,
-      'inputs': ['%s_deploy.jar' % V15_08_PREFIX],
-      'libraries' : [os.path.join(V15_08_BASE, 'legacy_YouTubeRelease_combined_library_jars.jar')],
-      'pgconf': [
-          '%s_proguard.config' % V15_08_PREFIX,
-          '%s_proto_safety.pgcfg' % V15_08_PREFIX,
-          '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-          utils.IGNORE_WARNINGS_RULES],
-      'maindexrules' : [
-          os.path.join(V15_08_BASE, 'mainDexClasses.rules'),
-          os.path.join(V15_08_BASE, 'main-dex-classes-release-optimized.pgcfg'),
-          os.path.join(V15_08_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
-      'min-api' : ANDROID_H_MR2_API,
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V15_08_PREFIX],
-      'pgmap': '%s_proguard.map' % V15_08_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
-  '15.09': {
-    'dex' : {
-      'inputs': [os.path.join(V15_09_BASE, 'YouTubeRelease_unsigned.apk')],
-      'pgmap': '%s_proguard.map' % V15_09_PREFIX,
-      'libraries' : [ANDROID_JAR],
-      'min-api' : ANDROID_L_API,
-    },
-    'deploy' : {
-      # When -injars and -libraryjars are used for specifying inputs library
-      # sanitization is on by default. For this version of YouTube -injars and
-      # -libraryjars are not used, but library sanitization is still required.
-      'sanitize_libraries': True,
-      'inputs': ['%s_deploy.jar' % V15_09_PREFIX],
-      'libraries' : [os.path.join(V15_09_BASE, 'legacy_YouTubeRelease_combined_library_jars.jar')],
-      'pgconf': [
-          '%s_proguard.config' % V15_09_PREFIX,
-          '%s/proguardsettings/YouTubeRelease_proguard.config' % utils.THIRD_PARTY,
-          utils.IGNORE_WARNINGS_RULES],
-      'maindexrules' : [
-          os.path.join(V15_09_BASE, 'mainDexClasses.rules'),
-          os.path.join(V15_09_BASE, 'main-dex-classes-release-optimized.pgcfg'),
-          os.path.join(V15_09_BASE, 'main_dex_YouTubeRelease_proguard.cfg')],
-      'min-api' : ANDROID_H_MR2_API,
-    },
-    'proguarded' : {
-      'inputs': ['%s_proguard.jar' % V15_09_PREFIX],
-      'pgmap': '%s_proguard.map' % V15_09_PREFIX,
-      'min-api' : ANDROID_L_API,
-    }
-  },
   '15.33': {
     'dex' : {
       'inputs': [os.path.join(V15_33_BASE, 'YouTubeRelease_unsigned.apk')],
       'pgmap': '%s_proguard.map' % V15_33_PREFIX,
-      'libraries' : [ANDROID_JAR],
+      'libraries' : [utils.get_android_jar(25)],
       'min-api' : ANDROID_L_API,
     },
     'deploy' : {