Remove release script support for releasing to AOSP and Studio

Change-Id: I48c8caf94b5483fd9995e59a941dd7fab333bdae
diff --git a/tools/r8_release.py b/tools/r8_release.py
index c288c96..9c9165f 100755
--- a/tools/r8_release.py
+++ b/tools/r8_release.py
@@ -187,78 +187,6 @@
     subprocess.check_call(cmd)
 
 
-def release_studio_or_aosp(r8_checkout,
-                           path,
-                           options,
-                           git_message,
-                           keepanno=False):
-    with utils.ChangedWorkingDirectory(path):
-        if not options.use_existing_work_branch:
-            subprocess.call(['repo', 'abandon', 'update-r8'])
-        if not options.no_sync:
-            subprocess.check_call(['repo', 'sync', '-cq', '-j', '16'])
-
-        prebuilts_r8 = os.path.join(path, 'prebuilts', 'r8')
-
-        if not options.use_existing_work_branch:
-            with utils.ChangedWorkingDirectory(prebuilts_r8):
-                subprocess.check_call(['repo', 'start', 'update-r8'])
-
-        update_prebuilds(r8_checkout, options.version, path, keepanno)
-
-        with utils.ChangedWorkingDirectory(prebuilts_r8):
-            if not options.use_existing_work_branch:
-                subprocess.check_call(
-                    ['git', 'commit', '-a', '-m', git_message])
-            else:
-                print('Not committing when --use-existing-work-branch. ' +
-                      'Commit message should be:\n\n' + git_message + '\n')
-            # Don't upload if requested not to, or if changes are not committed due
-            # to --use-existing-work-branch
-            if not options.no_upload and not options.use_existing_work_branch:
-                process = subprocess.Popen(
-                    ['repo', 'upload', '.', '--verify', '--current-branch'],
-                    stdin=subprocess.PIPE)
-                return process.communicate(input=b'y\n')[0]
-
-
-def prepare_aosp(args):
-    assert args.version
-
-    if (not args.legacy_release):
-        print("Please use the new release process, see go/r8-release-prebuilts. "
-            + "If for some reason the legacy release process is needed "
-            + "pass --legacy-release")
-        sys.exit(1)
-
-    assert os.path.exists(args.aosp), "Could not find AOSP path %s" % args.aosp
-
-    def release_aosp(options):
-        print("Releasing for AOSP")
-        if options.dry_run:
-            return 'DryRun: omitting AOSP release for %s' % options.version
-
-        git_message = ("""Update D8 and R8 to %s
-
-Version: %s
-This build IS NOT suitable for preview or public release.
-
-Built here: go/r8-releases/raw/%s
-
-Test: TARGET_PRODUCT=aosp_arm64 m -j core-oj""" %
-                       (args.version, args.version, args.version))
-        # Fixes to Android U branch is based of 8.2.2-dev where the keepanno library
-        # is not built.
-        keepanno = not args.version.startswith('8.2.2-udc')
-        return release_studio_or_aosp(utils.REPO_ROOT,
-                                      args.aosp,
-                                      options,
-                                      git_message,
-                                      keepanno=keepanno)
-
-    return release_aosp
-
-
 def prepare_maven(args):
     assert args.version
 
@@ -285,64 +213,10 @@
     return release_maven
 
 
-# ------------------------------------------------------ column 70 --v
-def git_message_dev(version, bugs):
-    return """Update D8 R8 to %s
-
-This is a development snapshot, it's fine to use for studio canary
-build, but not for BETA or release, for those we would need a release
-version of R8 binaries. This build IS suitable for preview release
-but IS NOT suitable for public release.
-
-Built here: go/r8-releases/raw/%s
-Test: ./gradlew check
-Bug: %s""" % (version, version, '\nBug: '.join(map(bug_fmt, bugs)))
-
-
-def git_message_release(version, bugs):
-    return """D8 R8 version %s
-
-Built here: go/r8-releases/raw/%s/
-Test: ./gradlew check
-
-Bug: %s""" % (version, version, '\nBug: '.join(map(bug_fmt, bugs)))
-
-
 def bug_fmt(bug):
     return "b/%s" % bug
 
 
-def prepare_studio(args):
-    assert args.version
-    assert os.path.exists(args.studio), ("Could not find STUDIO path %s" %
-                                         args.studio)
-    if (not args.legacy_release):
-        print("Please use the new release process, see go/r8-release-prebuilts. "
-            + "If for some reason the legacy release process is needed "
-            + "pass --legacy-release")
-        sys.exit(1)
-
-    def release_studio(options):
-        print("Releasing for STUDIO")
-        if options.dry_run:
-            return 'DryRun: omitting studio release for %s' % options.version
-
-        if 'dev' in options.version:
-            git_message = git_message_dev(options.version, options.bug)
-            r8_checkout = utils.REPO_ROOT
-            return release_studio_or_aosp(r8_checkout, args.studio, options,
-                                          git_message)
-        else:
-            with utils.TempDir() as temp:
-                checkout_r8(temp,
-                            options.version[0:options.version.rindex('.')])
-                git_message = git_message_release(options.version, options.bug)
-                return release_studio_or_aosp(temp, args.studio, options,
-                                              git_message)
-
-    return release_studio
-
-
 def g4_cp(old, new, file):
     subprocess.check_call('g4 cp {%s,%s}/%s' % (old, new, file), shell=True)
 
@@ -1076,23 +950,6 @@
                         default=[],
                         action='append',
                         help='List of bugs for release version')
-    result.add_argument('--no-bugs',
-                        default=False,
-                        action='store_true',
-                        help='Allow Studio release without specifying any bugs')
-    result.add_argument(
-        '--studio',
-        metavar=('<path>'),
-        help='Release for studio by setting the path to a studio '
-        'checkout')
-    result.add_argument('--legacy-release',
-                        default=False,
-                        action='store_true',
-                        help='Allow Studio/AOSP release using the legacy process')
-    result.add_argument('--aosp',
-                        metavar=('<path>'),
-                        help='Release for aosp by setting the path to the '
-                        'checkout')
     result.add_argument('--maven',
                         default=False,
                         action='store_true',
@@ -1110,17 +967,12 @@
         '--use_existing_work_branch',
         default=False,
         action='store_true',
-        help='Use existing work branch/CL in aosp/studio/google3')
+        help='Use existing work CL in google3')
     result.add_argument('--delete-work-branch',
                         '--delete_work_branch',
                         default=False,
                         action='store_true',
                         help='Delete CL in google3')
-    result.add_argument('--bypass-hooks',
-                        '--bypass_hooks',
-                        default=False,
-                        action='store_true',
-                        help="Bypass hooks when uploading")
     result.add_argument('--no-upload',
                         '--no_upload',
                         default=False,
@@ -1137,15 +989,6 @@
                         metavar=('<path>'),
                         help='Location for dry run output.')
     args = result.parse_args()
-    if (len(args.bug) > 0 and args.no_bugs):
-        print("Use of '--bug' and '--no-bugs' are mutually exclusive")
-        sys.exit(1)
-
-    if (args.studio and args.version and not 'dev' in args.version and
-            args.bug == [] and not args.no_bugs):
-        print("When releasing a release version to Android Studio add the " +
-              "list of bugs by using '--bug'")
-        sys.exit(1)
 
     if args.version and not 'dev' in args.version and args.google3:
         print("WARNING: You should not roll a release version into google 3")
@@ -1158,13 +1001,13 @@
     targets_to_run = []
 
     if args.new_dev_branch:
-        if args.google3 or args.studio or args.aosp:
+        if args.google3 or args.maven:
             print('Cannot create a branch and roll at the same time.')
             sys.exit(1)
         targets_to_run.append(prepare_branch(args))
 
     if args.dev_release:
-        if args.google3 or args.studio or args.aosp:
+        if args.google3 or args.maven:
             print('Cannot create a dev release and roll at the same time.')
             sys.exit(1)
         targets_to_run.append(prepare_release(args))
@@ -1173,10 +1016,6 @@
 
     if args.google3:
         targets_to_run.append(prepare_google3(args))
-    if args.studio and not args.update_desugar_library_in_studio:
-        targets_to_run.append(prepare_studio(args))
-    if args.aosp:
-        targets_to_run.append(prepare_aosp(args))
     if args.maven:
         targets_to_run.append(prepare_maven(args))