Chromium Code Reviews| Index: build/android/gyp/javac.py |
| diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py |
| index f51f76c490cce8f24bacda2d8ecdf1a9e8654f82..fa1b4603e0bc581442a0dd094c0ecae9b2fb03eb 100755 |
| --- a/build/android/gyp/javac.py |
| +++ b/build/android/gyp/javac.py |
| @@ -12,27 +12,11 @@ import sys |
| from util import build_utils |
| from util import md5_check |
| - |
| -def DoJavac(options, args): |
| - output_dir = options.output_dir |
| - |
| - src_gendirs = build_utils.ParseGypList(options.src_gendirs) |
| - java_files = args + build_utils.FindInDirectories(src_gendirs, '*.java') |
| - if options.javac_includes: |
| - javac_includes = build_utils.ParseGypList(options.javac_includes) |
| - filtered_java_files = [] |
| - for f in java_files: |
| - for include in javac_includes: |
| - if fnmatch.fnmatch(f, include): |
| - filtered_java_files.append(f) |
| - break |
| - java_files = filtered_java_files |
| - |
| +def Javac(java_files, classpath, output_dir, chromium_code): |
|
Nico
2014/05/05 22:08:10
docstring
|
| # Compiling guava with certain orderings of input files causes a compiler |
| # crash... Sorted order works, so use that. |
| # See https://code.google.com/p/guava-libraries/issues/detail?id=950 |
|
Nico
2014/05/05 22:08:10
Can we merge in a guava version with this fix even
cjhopman
2014/06/25 01:20:03
Added TODO
|
| - java_files.sort() |
| - classpath = build_utils.ParseGypList(options.classpath) |
| + java_files = sorted(java_files) |
| jar_inputs = [] |
| for path in classpath: |
| @@ -47,7 +31,7 @@ def DoJavac(options, args): |
| '-target', '1.5', |
| '-classpath', ':'.join(classpath), |
| '-d', output_dir] |
| - if options.chromium_code: |
| + if chromium_code: |
| javac_args.extend(['-Xlint:unchecked', '-Xlint:deprecation']) |
| else: |
| # XDignore.symbol.file makes javac compile against rt.jar instead of |
| @@ -64,9 +48,9 @@ def DoJavac(options, args): |
| # not contain the corresponding old .class file after running this action. |
| build_utils.DeleteDirectory(output_dir) |
| build_utils.MakeDirectory(output_dir) |
| - build_utils.CheckOutput(javac_cmd, print_stdout=options.chromium_code) |
| + build_utils.CheckOutput(javac_cmd, print_stdout=chromium_code) |
| - record_path = '%s/javac.md5.stamp' % options.output_dir |
| + record_path = '%s/javac.md5.stamp' % output_dir |
| md5_check.CallAndRecordIfStale( |
| Compile, |
| record_path=record_path, |
| @@ -74,7 +58,26 @@ def DoJavac(options, args): |
| input_strings=javac_cmd) |
| -def main(): |
| +def DoJavac(options, args): |
| + output_dir = options.output_dir |
| + |
| + src_gendirs = build_utils.ParseGypList(options.src_gendirs) |
| + java_files = args + build_utils.FindInDirectories(src_gendirs, '*.java') |
| + if options.javac_includes: |
| + javac_includes = build_utils.ParseGypList(options.javac_includes) |
| + filtered_java_files = [] |
| + for f in java_files: |
| + for include in javac_includes: |
| + if fnmatch.fnmatch(f, include): |
| + filtered_java_files.append(f) |
| + break |
| + java_files = filtered_java_files |
| + |
| + classpath = build_utils.ParseGypList(options.classpath) |
| + Javac(java_files, classpath, output_dir, options.chromium_code) |
| + |
| + |
| +def main(argv): |
| parser = optparse.OptionParser() |
| parser.add_option('--src-gendirs', |
| help='Directories containing generated java files.') |
| @@ -97,6 +100,6 @@ def main(): |
| if __name__ == '__main__': |
| - sys.exit(main()) |
| + sys.exit(main(sys.argv)) |