OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
| 7 import distutils.spawn |
7 import optparse | 8 import optparse |
8 import os | 9 import os |
9 import shutil | 10 import shutil |
10 import re | 11 import re |
11 import sys | 12 import sys |
12 import textwrap | 13 import textwrap |
13 | 14 |
14 from util import build_utils | 15 from util import build_utils |
15 from util import md5_check | 16 from util import md5_check |
16 | 17 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 parser.add_option('--jar-path', help='Jar output path.') | 313 parser.add_option('--jar-path', help='Jar output path.') |
313 parser.add_option('--stamp', help='Path to touch on success.') | 314 parser.add_option('--stamp', help='Path to touch on success.') |
314 | 315 |
315 options, args = parser.parse_args(argv) | 316 options, args = parser.parse_args(argv) |
316 build_utils.CheckOptions(options, parser, required=('jar_path',)) | 317 build_utils.CheckOptions(options, parser, required=('jar_path',)) |
317 | 318 |
318 bootclasspath = [] | 319 bootclasspath = [] |
319 for arg in options.bootclasspath: | 320 for arg in options.bootclasspath: |
320 bootclasspath += build_utils.ParseGnList(arg) | 321 bootclasspath += build_utils.ParseGnList(arg) |
321 options.bootclasspath = bootclasspath | 322 options.bootclasspath = bootclasspath |
| 323 if options.java_version == '1.8' and options.bootclasspath: |
| 324 # Android's boot jar doesn't contain all java 8 classes. |
| 325 # See: https://github.com/evant/gradle-retrolambda/issues/23. |
| 326 javac_path = os.path.realpath(distutils.spawn.find_executable('javac')) |
| 327 jdk_dir = os.path.dirname(os.path.dirname(javac_path)) |
| 328 rt_jar = os.path.join(jdk_dir, 'jre', 'lib', 'rt.jar') |
| 329 options.bootclasspath.append(rt_jar) |
322 | 330 |
323 classpath = [] | 331 classpath = [] |
324 for arg in options.classpath: | 332 for arg in options.classpath: |
325 classpath += build_utils.ParseGnList(arg) | 333 classpath += build_utils.ParseGnList(arg) |
326 options.classpath = classpath | 334 options.classpath = classpath |
327 | 335 |
328 java_srcjars = [] | 336 java_srcjars = [] |
329 for arg in options.java_srcjars: | 337 for arg in options.java_srcjars: |
330 java_srcjars += build_utils.ParseGnList(arg) | 338 java_srcjars += build_utils.ParseGnList(arg) |
331 options.java_srcjars = java_srcjars | 339 options.java_srcjars = java_srcjars |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 options, | 447 options, |
440 input_paths=input_paths, | 448 input_paths=input_paths, |
441 input_strings=javac_cmd, | 449 input_strings=javac_cmd, |
442 output_paths=output_paths, | 450 output_paths=output_paths, |
443 force=force, | 451 force=force, |
444 pass_changes=True) | 452 pass_changes=True) |
445 | 453 |
446 | 454 |
447 if __name__ == '__main__': | 455 if __name__ == '__main__': |
448 sys.exit(main(sys.argv[1:])) | 456 sys.exit(main(sys.argv[1:])) |
OLD | NEW |