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

Side by Side Diff: build/android/gyp/desugar.py

Issue 2985523002: Update experimental Java 8 support to use Desugar instead of Retrolambda (Closed)
Patch Set: Rebase Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « DEPS ('k') | build/android/gyp/retrolambda.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2017 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 import argparse
8 import os
9 import shutil
10 import sys
11 import tempfile
12
13 from util import build_utils
14
15
16 _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
17 '..', '..', '..'))
18 _DESUGAR_JAR_PATH = os.path.normpath(os.path.join(
19 _SRC_ROOT, 'third_party', 'bazel', 'desugar', 'Desugar.jar'))
20
21
22 def _OnStaleMd5(input_jar, output_jar, classpath, bootclasspath_entry):
23 cmd = [
24 'java',
25 '-jar',
26 _DESUGAR_JAR_PATH,
27 '--input',
28 input_jar,
29 '--bootclasspath_entry',
30 bootclasspath_entry,
31 '--output',
32 output_jar,
33 # Disable try-with-resources due to proguard duplicate zip entry error
34 # TODO(zpeng): Enable try-with-resources with
35 # desugar_try_with_resources_omit_runtime_classes
36 '--desugar_try_with_resources_if_needed=false',
37 ]
38 for path in classpath:
39 cmd += ['--classpath_entry', path]
40 build_utils.CheckOutput(cmd, print_stdout=False)
41
42
43 def main():
44 args = build_utils.ExpandFileArgs(sys.argv[1:])
45 parser = argparse.ArgumentParser()
46 build_utils.AddDepfileOption(parser)
47 parser.add_argument('--input-jar', required=True,
48 help='Jar input path to include .class files from.')
49 parser.add_argument('--output-jar', required=True,
50 help='Jar output path.')
51 parser.add_argument('--classpath', required=True,
52 help='Classpath.')
53 parser.add_argument('--bootclasspath-entry', required=True,
54 help='Path to javac bootclasspath interface jar.')
55 options = parser.parse_args(args)
56
57 options.classpath = build_utils.ParseGnList(options.classpath)
58 input_paths = options.classpath + [
59 options.bootclasspath_entry,
60 options.input_jar,
61 ]
62 output_paths = [options.output_jar]
63 depfile_deps = options.classpath + [_DESUGAR_JAR_PATH]
64
65 build_utils.CallAndWriteDepfileIfStale(
66 lambda: _OnStaleMd5(options.input_jar, options.output_jar,
67 options.classpath, options.bootclasspath_entry),
68 options,
69 input_paths=input_paths,
70 input_strings=[],
71 output_paths=output_paths,
72 depfile_deps=depfile_deps)
73
74
75 if __name__ == '__main__':
76 sys.exit(main())
OLDNEW
« no previous file with comments | « DEPS ('k') | build/android/gyp/retrolambda.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698