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