Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 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 | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 import fnmatch | |
| 8 import optparse | |
| 9 import os | |
| 10 import subprocess | |
| 11 import sys | |
| 12 | |
| 13 from pylib import build_utils | |
| 14 | |
| 15 def DoJavac(options): | |
| 16 intermediate_dir = options.intermediate_dir | |
| 17 | |
| 18 srcdirs = build_utils.ParseGypList(options.src_dirs) | |
|
Yaron
2013/03/14 23:03:51
nit:src_dirs
cjhopman
2013/03/15 22:44:39
Done.
| |
| 19 java_files = build_utils.FindInDirectories(srcdirs, '*.java') | |
| 20 if len(options.javac_includes) > 0: | |
|
Yaron
2013/03/14 23:03:51
nit: omit "> 0"
newt (away)
2013/03/15 03:25:04
nit: omit "len()"
cjhopman
2013/03/15 22:44:39
Done.
cjhopman
2013/03/15 22:44:39
Done.
| |
| 21 javac_includes = build_utils.ParseGypList(options.javac_includes) | |
| 22 filtered_java_files = [] | |
| 23 for f in java_files: | |
| 24 for include in javac_includes: | |
| 25 if fnmatch.fnmatch(f, include): | |
| 26 filtered_java_files.append(f) | |
|
newt (away)
2013/03/15 03:25:04
break (so you don't end up with the same file incl
cjhopman
2013/03/15 22:44:39
Done.
| |
| 27 java_files = filtered_java_files | |
| 28 | |
| 29 # Compiling guava with certain orderings of input files causes a compiler | |
| 30 # crash... Sorted order works, so use that. | |
|
Yaron
2013/03/14 23:03:51
nice
cjhopman
2013/03/15 22:44:39
Yeah, isn't it...
| |
| 31 # See https://code.google.com/p/guava-libraries/issues/detail?id=950 | |
| 32 java_files = sorted(java_files) | |
|
newt (away)
2013/03/15 03:25:04
or java_files.sort()
cjhopman
2013/03/15 22:44:39
Done.
| |
| 33 | |
| 34 classpath = build_utils.ParseGypList(options.input_jars_paths) | |
| 35 | |
| 36 build_utils.DeleteDirectory(intermediate_dir) | |
|
Yaron
2013/03/14 23:03:51
Add comment about deleting .class files (similar t
cjhopman
2013/03/15 22:44:39
Done.
| |
| 37 build_utils.EnsureDirectoryExists(intermediate_dir) | |
| 38 | |
| 39 subprocess.check_call( | |
| 40 ['javac', | |
| 41 '-g', | |
|
Yaron
2013/03/14 23:03:51
Shouldn't this indet match the ' above?
cjhopman
2013/03/15 22:44:39
Actually, I think it should match the 'j' or the '
Yaron
2013/03/15 23:13:46
My vi says it should match the quote, but this is
| |
| 42 '-Xlint:unchecked', | |
| 43 '-source', '1.5', | |
|
newt (away)
2013/03/15 03:25:04
I thought we used 1.6, but I trust you here
cjhopman
2013/03/15 22:44:39
So, currrently, we use 1.6 for libraries and 1.5 f
| |
| 44 '-target', '1.5', | |
| 45 '-classpath', ':'.join(classpath), | |
| 46 '-d', intermediate_dir] | |
| 47 + java_files) | |
| 48 | |
| 49 | |
| 50 def main(argv): | |
| 51 parser = optparse.OptionParser() | |
| 52 parser.add_option('--intermediate-dir') | |
|
Yaron
2013/03/14 23:03:51
Can you add the description fields to each of thes
cjhopman
2013/03/15 22:44:39
Done.
| |
| 53 parser.add_option('--input-jars-paths') | |
|
Yaron
2013/03/14 23:03:51
Any reason not to rename this classpath?
cjhopman
2013/03/15 22:44:39
Done.
| |
| 54 parser.add_option('--javac-includes') | |
| 55 parser.add_option('--src-dirs') | |
| 56 parser.add_option('--stamp') | |
| 57 | |
| 58 # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. | |
| 59 parser.add_option('--ignore') | |
| 60 | |
| 61 options, _ = parser.parse_args() | |
| 62 | |
| 63 DoJavac(options) | |
| 64 | |
| 65 if options.stamp: | |
| 66 build_utils.Touch(options.stamp) | |
| 67 | |
| 68 | |
| 69 if __name__ == '__main__': | |
| 70 sys.exit(main(sys.argv)) | |
| 71 | |
| 72 | |
| OLD | NEW |