Add archive and release scripts for Google smali fork
The archive script will archive a version built from a specified
hash and archive it in GCS under r8-releases/smali.
The release script will publish the archive from GCS to Google
Maven.
Bug: b/262205084
Change-Id: I48d38d5ef2fd760e3fab24c0e60fbfaa6c5ee489
diff --git a/tools/release_smali.py b/tools/release_smali.py
new file mode 100755
index 0000000..12a9389
--- /dev/null
+++ b/tools/release_smali.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+# Copyright (c) 2023, 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.
+
+import argparse
+import sys
+
+import gmaven
+
+ARCHIVE_BUCKET = 'r8-releases'
+REPO = 'https://github.com/google/smali'
+
+def parse_options():
+ result = argparse.ArgumentParser(description='Release Smali')
+ result.add_argument('--version',
+ required=True,
+ metavar=('<version>'),
+ help='The version of smali to release.')
+ result.add_argument('--dry-run',
+ default=False,
+ action='store_true',
+ help='Only perform non-commiting tasks and print others.')
+ return result.parse_args()
+
+
+def Main():
+ options = parse_options()
+ gfile = ('/bigstore/r8-releases/smali/%s/smali-maven-release-%s.zip'
+ % (options.version, options.version))
+ release_id = gmaven.publisher_stage([gfile], options.dry_run)
+
+ print('Staged Release ID %s.\n' % release_id)
+ gmaven.publisher_stage_redir_test_info(
+ release_id, 'com.android.tools.smali:smali:%s' % options.version, 'smali.jar')
+
+ print()
+ answer = input('Continue with publishing [y/N]:')
+
+ if answer != 'y':
+ print('Aborting release to Google maven')
+ sys.exit(1)
+
+ gmaven.publisher_publish(release_id, options.dry_run)
+
+ print()
+ print('Published. Use the email workflow for approval.')
+
+if __name__ == '__main__':
+ sys.exit(Main())