| 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 optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import shutil | 9 import shutil |
| 10 import re | 10 import re |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 action='append', | 250 action='append', |
| 251 default=[], | 251 default=[], |
| 252 help='List of srcjars to include in compilation.') | 252 help='List of srcjars to include in compilation.') |
| 253 parser.add_option( | 253 parser.add_option( |
| 254 '--bootclasspath', | 254 '--bootclasspath', |
| 255 action='append', | 255 action='append', |
| 256 default=[], | 256 default=[], |
| 257 help='Boot classpath for javac. If this is specified multiple times, ' | 257 help='Boot classpath for javac. If this is specified multiple times, ' |
| 258 'they will all be appended to construct the classpath.') | 258 'they will all be appended to construct the classpath.') |
| 259 parser.add_option( | 259 parser.add_option( |
| 260 '--java-version', |
| 261 help='Java language version to use in -source and -target args to javac.') |
| 262 parser.add_option( |
| 260 '--classpath', | 263 '--classpath', |
| 261 action='append', | 264 action='append', |
| 262 help='Classpath for javac. If this is specified multiple times, they ' | 265 help='Classpath for javac. If this is specified multiple times, they ' |
| 263 'will all be appended to construct the classpath.') | 266 'will all be appended to construct the classpath.') |
| 264 parser.add_option( | 267 parser.add_option( |
| 265 '--incremental', | 268 '--incremental', |
| 266 action='store_true', | 269 action='store_true', |
| 267 help='Whether to re-use .class files rather than recompiling them ' | 270 help='Whether to re-use .class files rather than recompiling them ' |
| 268 '(when possible).') | 271 '(when possible).') |
| 269 parser.add_option( | 272 parser.add_option( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 # javac pulling a default encoding from the user's environment. | 375 # javac pulling a default encoding from the user's environment. |
| 373 '-encoding', 'UTF-8', | 376 '-encoding', 'UTF-8', |
| 374 '-classpath', ':'.join(options.classpath), | 377 '-classpath', ':'.join(options.classpath), |
| 375 # Prevent compiler from compiling .java files not listed as inputs. | 378 # Prevent compiler from compiling .java files not listed as inputs. |
| 376 # See: http://blog.ltgt.net/most-build-tools-misuse-javac/ | 379 # See: http://blog.ltgt.net/most-build-tools-misuse-javac/ |
| 377 '-sourcepath', '' | 380 '-sourcepath', '' |
| 378 )) | 381 )) |
| 379 | 382 |
| 380 if options.bootclasspath: | 383 if options.bootclasspath: |
| 381 javac_cmd.extend([ | 384 javac_cmd.extend([ |
| 382 '-bootclasspath', ':'.join(options.bootclasspath), | 385 '-bootclasspath', ':'.join(options.bootclasspath) |
| 383 '-source', '1.7', | 386 ]) |
| 384 '-target', '1.7', | 387 |
| 385 ]) | 388 if options.java_version: |
| 389 javac_cmd.extend([ |
| 390 '-source', options.java_version, |
| 391 '-target', options.java_version, |
| 392 ]) |
| 386 | 393 |
| 387 if options.chromium_code: | 394 if options.chromium_code: |
| 388 javac_cmd.extend(['-Xlint:unchecked', '-Xlint:deprecation']) | 395 javac_cmd.extend(['-Xlint:unchecked', '-Xlint:deprecation']) |
| 389 else: | 396 else: |
| 390 # XDignore.symbol.file makes javac compile against rt.jar instead of | 397 # XDignore.symbol.file makes javac compile against rt.jar instead of |
| 391 # ct.sym. This means that using a java internal package/class will not | 398 # ct.sym. This means that using a java internal package/class will not |
| 392 # trigger a compile warning or error. | 399 # trigger a compile warning or error. |
| 393 javac_cmd.extend(['-XDignore.symbol.file']) | 400 javac_cmd.extend(['-XDignore.symbol.file']) |
| 394 | 401 |
| 395 if options.processors: | 402 if options.processors: |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 options, | 439 options, |
| 433 input_paths=input_paths, | 440 input_paths=input_paths, |
| 434 input_strings=javac_cmd, | 441 input_strings=javac_cmd, |
| 435 output_paths=output_paths, | 442 output_paths=output_paths, |
| 436 force=force, | 443 force=force, |
| 437 pass_changes=True) | 444 pass_changes=True) |
| 438 | 445 |
| 439 | 446 |
| 440 if __name__ == '__main__': | 447 if __name__ == '__main__': |
| 441 sys.exit(main(sys.argv[1:])) | 448 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |