Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Unified Diff: build/android/gyp/desugar.py

Issue 2985523002: Update experimental Java 8 support to use Desugar instead of Retrolambda (Closed)
Patch Set: Desugar :) Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/gyp/retrolambda.py » ('j') | build/config/android/internal_rules.gni » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/desugar.py
diff --git a/build/android/gyp/retrolambda.py b/build/android/gyp/desugar.py
similarity index 58%
copy from build/android/gyp/retrolambda.py
copy to build/android/gyp/desugar.py
index 90e189a5a52679aa92db65a493c642e11ca0d718..8d04a52dcf40ffe63cc58b3aef1dcce0d028d986 100755
--- a/build/android/gyp/retrolambda.py
+++ b/build/android/gyp/desugar.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -15,26 +15,27 @@ from util import build_utils
_SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..', '..'))
-_RETROLAMBDA_JAR_PATH = os.path.normpath(os.path.join(
- _SRC_ROOT, 'third_party', 'retrolambda', 'retrolambda-2.5.1.jar'))
+_DESUGAR_JAR_PATH = os.path.normpath(os.path.join(
+ _SRC_ROOT, 'third_party', 'desugar', 'Desugar.jar'))
-def _OnStaleMd5(input_jar, output_jar, classpath, android_sdk_jar):
- with build_utils.TempDir() as temp_dir:
- build_utils.ExtractAll(input_jar, path=temp_dir)
- cmd = [
- 'java',
- '-Dretrolambda.inputDir=' + temp_dir,
- '-Dretrolambda.classpath=' +
- ':'.join([temp_dir] + classpath + [android_sdk_jar]),
- '-javaagent:' + _RETROLAMBDA_JAR_PATH,
- '-jar',
- _RETROLAMBDA_JAR_PATH,
- ]
-
- build_utils.CheckOutput(cmd, print_stdout=False)
- build_utils.ZipDir(output_jar + '.tmp', temp_dir)
- shutil.move(output_jar + '.tmp', output_jar)
+def _OnStaleMd5(input_jar, output_jar, classpath, android_sdk_jar,
+ bootclasspath):
+ cmd = [
+ 'java',
+ '-jar',
+ _DESUGAR_JAR_PATH,
+ '--input',
+ input_jar,
+ '--bootclasspath_entry',
+ bootclasspath,
+ '--output',
+ output_jar,
+ '--desugar_try_with_resources_if_needed=false',
+ ]
+ for path in sorted(classpath) + [android_sdk_jar]:
agrieve 2017/07/20 00:26:51 shouldn't sort the classpath. Order could matter.
F 2017/07/20 17:30:56 Done. Thanks! I misunderstood "ordered" in the par
+ cmd += ['--classpath_entry', path]
+ build_utils.CheckOutput(cmd, print_stdout=False)
def main():
@@ -49,19 +50,25 @@ def main():
help='Classpath.')
parser.add_argument('--android-sdk-jar', required=True,
help='Android sdk jar path.')
+ parser.add_argument('--bootclasspath', required=True,
+ help='Javac bootclasspath.')
options = parser.parse_args(args)
options.classpath = build_utils.ParseGnList(options.classpath)
- input_paths = options.classpath + [options.input_jar]
+ input_paths = options.classpath + [options.input_jar,
+ options.android_sdk_jar,
+ options.bootclasspath]
agrieve 2017/07/20 00:26:51 I don't think this is quite right. There's no reas
F 2017/07/20 17:30:56 Done.
output_paths = [options.output_jar]
build_utils.CallAndWriteDepfileIfStale(
lambda: _OnStaleMd5(options.input_jar, options.output_jar,
- options.classpath, options.android_sdk_jar),
+ options.classpath, options.android_sdk_jar,
+ options.bootclasspath),
options,
input_paths=input_paths,
input_strings=[],
- output_paths=output_paths)
+ output_paths=output_paths,
+ depfile_deps=input_paths)
if __name__ == '__main__':
« no previous file with comments | « no previous file | build/android/gyp/retrolambda.py » ('j') | build/config/android/internal_rules.gni » ('J')

Powered by Google App Engine
This is Rietveld 408576698