Update release scripts to distribute the keep annotations library

Bug: b/248408342
Change-Id: I7f74b1f5c038cb6d47047a7de12d7e4ab1ec7700
diff --git a/tools/r8_release.py b/tools/r8_release.py
index b60c2de..dc47fa2 100755
--- a/tools/r8_release.py
+++ b/tools/r8_release.py
@@ -161,13 +161,16 @@
     return subprocess.check_call(cmd)
 
 
-def update_prebuilds(r8_checkout, version, checkout):
+def update_prebuilds(r8_checkout, version, checkout, keepanno=False):
   path = os.path.join(r8_checkout, 'tools', 'update_prebuilds_in_android.py')
   commit_arg = '--commit_hash=' if len(version) == 40 else '--version='
-  subprocess.check_call([path, '--targets=lib', '--maps', commit_arg + version, checkout])
+  cmd = [path, '--targets=lib', '--maps', commit_arg + version, checkout]
+  if keepanno:
+    cmd.append("--keepanno")
+  subprocess.check_call(cmd)
 
 
-def release_studio_or_aosp(r8_checkout, path, options, git_message):
+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'])
@@ -180,7 +183,7 @@
       with utils.ChangedWorkingDirectory(prebuilts_r8):
         subprocess.check_call(['repo', 'start', 'update-r8'])
 
-    update_prebuilds(r8_checkout, options.version, path)
+    update_prebuilds(r8_checkout, options.version, path, keepanno)
 
     with utils.ChangedWorkingDirectory(prebuilts_r8):
       if not options.use_existing_work_branch:
@@ -218,7 +221,7 @@
 Test: TARGET_PRODUCT=aosp_arm64 m -j core-oj"""
                    % (args.version, args.version, args.version))
     return release_studio_or_aosp(
-      utils.REPO_ROOT, args.aosp, options, git_message)
+      utils.REPO_ROOT, args.aosp, options, git_message, keepanno=True)
 
   return release_aosp