Version 0.1.7.
Test only changes, no need for cherry pick
Merge: Add archive script that the bots can archive release versions
CL: https://r8-review.googlesource.com/#/c/r8/+/5340/
Merge: Fix archiving bucket
CL: https://r8-review.googlesource.com/#/c/r8/+/5441/
Change-Id: Iff958572bf4cfe1b363ed09939e05d14de8ff0bb
diff --git a/src/main/java/com/android/tools/r8/D8.java b/src/main/java/com/android/tools/r8/D8.java
index 790bfc8..c997595 100644
--- a/src/main/java/com/android/tools/r8/D8.java
+++ b/src/main/java/com/android/tools/r8/D8.java
@@ -55,7 +55,7 @@
*/
public final class D8 {
- private static final String VERSION = "v0.1.6";
+ private static final String VERSION = "v0.1.7";
private static final int STATUS_ERROR = 1;
private D8() {}
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index 61567a5..6b127da 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -71,7 +71,7 @@
public class R8 {
- private static final String VERSION = "v0.1.6";
+ private static final String VERSION = "v0.1.7";
private final Timing timing = new Timing("R8");
private final InternalOptions options;
diff --git a/tools/archive.py b/tools/archive.py
new file mode 100755
index 0000000..ee1053d
--- /dev/null
+++ b/tools/archive.py
@@ -0,0 +1,47 @@
+#!/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.
+
+import d8
+import os
+import r8
+import sys
+import utils
+
+ARCHIVE_BUCKET = 'r8-releases'
+
+def GetVersion():
+ r8_version = r8.run(['--version'], build = False).strip()
+ d8_version = d8.run(['--version'], build = False).strip()
+ # The version printed is "D8 vVERSION_NUMBER" and "R8 vVERSION_NUMBER"
+ # Sanity check that versions match.
+ if d8_version.split()[1] != r8_version.split()[1]:
+ raise Exception(
+ 'Version mismatch: \n%s\n%s' % (d8_version, r8_version))
+ return d8_version.split()[1]
+
+def GetStorageDestination(storage_prefix, version, file_name):
+ return '%s%s/raw/%s/%s' % (storage_prefix, ARCHIVE_BUCKET, version, file_name)
+
+def GetUploadDestination(version, file_name):
+ return GetStorageDestination('gs://', version, file_name)
+
+def GetUrl(version, file_name):
+ return GetStorageDestination('http://storage.googleapis.com/',
+ version,
+ file_name)
+
+def Main():
+ if not 'BUILDBOT_BUILDERNAME' in os.environ:
+ raise Exception('You are not a bot, don\'t archive builds')
+ version = GetVersion()
+ for jar in [utils.D8_JAR, utils.R8_JAR]:
+ file_name = os.path.basename(jar)
+ destination = GetUploadDestination(version, file_name)
+ print('Uploading %s to %s' % (jar, destination))
+ utils.upload_file_to_cloud_storage(jar, destination)
+ print('File available at: %s' % GetUrl(version, file_name))
+
+if __name__ == '__main__':
+ sys.exit(Main())
diff --git a/tools/d8.py b/tools/d8.py
index d214cf5..2510b75 100755
--- a/tools/d8.py
+++ b/tools/d8.py
@@ -9,8 +9,6 @@
import sys
import utils
-D8_JAR = os.path.join(utils.REPO_ROOT, 'build', 'libs', 'd8.jar')
-
def run(args, build = True, debug = True, profile = False, track_memory_file=None):
if build:
gradle.RunGradle(['D8'])
@@ -22,10 +20,10 @@
cmd.append('-ea')
if profile:
cmd.append('-agentlib:hprof=cpu=samples,interval=1,depth=8')
- cmd.extend(['-jar', D8_JAR])
+ cmd.extend(['-jar', utils.D8_JAR])
cmd.extend(args)
utils.PrintCmd(cmd)
- subprocess.check_call(cmd)
+ return subprocess.check_output(cmd)
def main():
build = True
diff --git a/tools/r8.py b/tools/r8.py
index b453227..03acd87 100755
--- a/tools/r8.py
+++ b/tools/r8.py
@@ -9,8 +9,6 @@
import sys
import utils
-R8_JAR = os.path.join(utils.REPO_ROOT, 'build', 'libs', 'r8.jar')
-
def run(args, build = True, debug = True, profile = False, track_memory_file=None):
if build:
gradle.RunGradle(['r8'])
@@ -22,10 +20,10 @@
cmd.append('-ea')
if profile:
cmd.append('-agentlib:hprof=cpu=samples,interval=1,depth=8')
- cmd.extend(['-jar', R8_JAR])
+ cmd.extend(['-jar', utils.R8_JAR])
cmd.extend(args)
utils.PrintCmd(cmd)
- subprocess.check_call(cmd)
+ return subprocess.check_output(cmd)
def main():
build = True
diff --git a/tools/test.py b/tools/test.py
index b0255cb..ab4b0d6 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -76,7 +76,7 @@
upload_dir = os.path.join(utils.REPO_ROOT, 'build', 'reports', 'tests')
u_dir = uuid.uuid4()
destination = 'gs://%s/%s' % (BUCKET, u_dir)
- utils.upload_html_to_cloud_storage(upload_dir, destination)
+ utils.upload_dir_to_cloud_storage(upload_dir, destination)
url = 'http://storage.googleapis.com/%s/%s/test/index.html' % (BUCKET, u_dir)
print 'Test results available at: %s' % url
print '@@@STEP_LINK@Test failures@%s@@@' % url
diff --git a/tools/test_android_cts.py b/tools/test_android_cts.py
index 3f66302..887e3ae 100755
--- a/tools/test_android_cts.py
+++ b/tools/test_android_cts.py
@@ -39,7 +39,6 @@
'aosp_manifest.xml')
AOSP_HELPER_SH = join(utils.REPO_ROOT, 'scripts', 'aosp_helper.sh')
-D8_JAR = join(utils.REPO_ROOT, 'build/libs/d8.jar')
D8LOGGER_JAR = join(utils.REPO_ROOT, 'build/libs/d8logger.jar')
AOSP_ROOT = join(utils.REPO_ROOT, 'build/aosp')
@@ -133,7 +132,7 @@
counter = 0
if tool_is_d8 or clean_dex:
if not clean_dex:
- d8jar_mtime = os.path.getmtime(D8_JAR)
+ d8jar_mtime = os.path.getmtime(utils.D8_JAR)
dex_files = (chain.from_iterable(glob(join(x[0], '*.dex'))
for x in os.walk(OUT_IMG)))
for f in dex_files:
diff --git a/tools/test_framework.py b/tools/test_framework.py
index 9e5f63f..483fc5c 100755
--- a/tools/test_framework.py
+++ b/tools/test_framework.py
@@ -30,7 +30,6 @@
DX_JAR = os.path.join(utils.REPO_ROOT, 'tools', 'linux', 'dx', 'framework',
'dx.jar')
-D8_JAR = os.path.join(utils.REPO_ROOT, 'build', 'libs', 'd8.jar')
GOYT_EXE = os.path.join('third_party', 'goyt',
'goyt_164843480')
FRAMEWORK_JAR = os.path.join('third_party', 'framework',
@@ -79,7 +78,7 @@
tool_file = DX_JAR
xmx = '-Xmx1600m'
else:
- tool_file = D8_JAR
+ tool_file = utils.D8_JAR
tool_args = ['--output', temp_dir, '--min-api', MIN_SDK_VERSION]
if args.tool == 'd8-release':
tool_args.append('--release')
diff --git a/tools/utils.py b/tools/utils.py
index e281ccd..44e608d 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -19,6 +19,8 @@
'dexsegments.jar')
DEX_SEGMENTS_RESULT_PATTERN = re.compile('- ([^:]+): ([0-9]+)')
COMPATDX_JAR = os.path.join(REPO_ROOT, 'build', 'libs', 'compatdx.jar')
+D8_JAR = os.path.join(REPO_ROOT, 'build', 'libs', 'd8.jar')
+R8_JAR = os.path.join(REPO_ROOT, 'build', 'libs', 'r8.jar')
def PrintCmd(s):
if type(s) is list:
@@ -55,13 +57,18 @@
if not os.path.isdir(path):
raise
-def upload_html_to_cloud_storage(directory, destination):
+def upload_dir_to_cloud_storage(directory, destination):
# Upload and make the content encoding right for viewing directly
cmd = ['gsutil.py', 'cp', '-z', 'html', '-a',
'public-read', '-R', directory, destination]
PrintCmd(cmd)
subprocess.check_call(cmd)
+def upload_file_to_cloud_storage(source, destination):
+ cmd = ['gsutil.py', 'cp', '-a', 'public-read', source, destination]
+ PrintCmd(cmd)
+ subprocess.check_call(cmd)
+
class TempDir(object):
def __init__(self, prefix=''):
self._temp_dir = None