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

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

Issue 2985523002: Update experimental Java 8 support to use Desugar instead of Retrolambda (Closed)
Patch Set: addressing comments 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/android/gyp/retrolambda.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/desugar.py
diff --git a/build/android/gyp/desugar.py b/build/android/gyp/desugar.py
new file mode 100755
index 0000000000000000000000000000000000000000..a75e2036bf65497408297241d0d0532e3db0d94e
--- /dev/null
+++ b/build/android/gyp/desugar.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+#
+# 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.
+
+import argparse
+import os
+import shutil
+import sys
+import tempfile
+
+from util import build_utils
+
+
+_SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
+ '..', '..', '..'))
+_DESUGAR_JAR_PATH = os.path.normpath(os.path.join(
agrieve 2017/07/20 18:24:09 list this either in depfile_deps or in GN's input
F 2017/07/20 19:40:55 Done.
+ _SRC_ROOT, 'third_party', 'bazel', 'desugar', 'Desugar.jar'))
+
+
+def _OnStaleMd5(input_jar, output_jar, classpath, bootclasspath_entry):
+ cmd = [
+ 'java',
+ '-jar',
+ _DESUGAR_JAR_PATH,
+ '--input',
+ input_jar,
+ '--bootclasspath_entry',
+ bootclasspath_entry,
+ '--output',
+ output_jar,
+ # Disable try-with-resources due to proguard duplicate zip entry error
+ # TODO(zpeng): Enable try-with-resources with
+ # desugar_try_with_resources_omit_runtime_classes
+ '--desugar_try_with_resources_if_needed=false',
+ ]
+ for path in classpath:
+ cmd += ['--classpath_entry', path]
+ build_utils.CheckOutput(cmd, print_stdout=False)
+
+
+def main():
+ args = build_utils.ExpandFileArgs(sys.argv[1:])
+ parser = argparse.ArgumentParser()
+ build_utils.AddDepfileOption(parser)
+ parser.add_argument('--input-jar', required=True,
+ help='Jar input path to include .class files from.')
+ parser.add_argument('--output-jar', required=True,
+ help='Jar output path.')
+ parser.add_argument('--classpath', required=True,
+ help='Classpath.')
+ parser.add_argument('--bootclasspath-entry', required=True,
+ help='Path to javac bootclasspath interface jar.')
+ options = parser.parse_args(args)
+
+ options.classpath = build_utils.ParseGnList(options.classpath)
+ input_paths = options.classpath + [options.input_jar,
+ options.bootclasspath_entry]
+ output_paths = [options.output_jar]
+
+ build_utils.CallAndWriteDepfileIfStale(
+ lambda: _OnStaleMd5(options.input_jar, options.output_jar,
+ options.classpath, options.bootclasspath_entry),
+ options,
+ input_paths=input_paths,
+ input_strings=[],
+ output_paths=output_paths,
+ depfile_deps=input_paths)
agrieve 2017/07/20 18:24:09 nit: don't pass input_jar and bootclasspath_entry
F 2017/07/20 19:40:55 Done.
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « no previous file | build/android/gyp/retrolambda.py » ('j') | build/android/gyp/retrolambda.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698