| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 # Make sure output exists. | 222 # Make sure output exists. |
| 223 build_utils.Touch(pdb_path) | 223 build_utils.Touch(pdb_path) |
| 224 | 224 |
| 225 glob = options.jar_excluded_classes | 225 glob = options.jar_excluded_classes |
| 226 inclusion_predicate = lambda f: not build_utils.MatchesGlob(f, glob) | 226 inclusion_predicate = lambda f: not build_utils.MatchesGlob(f, glob) |
| 227 exclusion_predicate = lambda f: not inclusion_predicate(f) | 227 exclusion_predicate = lambda f: not inclusion_predicate(f) |
| 228 | 228 |
| 229 jar.JarDirectory(classes_dir, | 229 jar.JarDirectory(classes_dir, |
| 230 options.jar_path, | 230 options.jar_path, |
| 231 predicate=inclusion_predicate, | 231 predicate=inclusion_predicate, |
| 232 provider_configurations=options.provider_configurations) | 232 provider_configurations=options.provider_configurations, |
| 233 additional_files=options.additional_jar_files) |
| 233 jar.JarDirectory(classes_dir, | 234 jar.JarDirectory(classes_dir, |
| 234 excluded_jar_path, | 235 excluded_jar_path, |
| 235 predicate=exclusion_predicate, | 236 predicate=exclusion_predicate, |
| 236 provider_configurations=options.provider_configurations) | 237 provider_configurations=options.provider_configurations, |
| 238 additional_files=options.additional_jar_files) |
| 237 | 239 |
| 238 | 240 |
| 239 def _ParseOptions(argv): | 241 def _ParseOptions(argv): |
| 240 parser = optparse.OptionParser() | 242 parser = optparse.OptionParser() |
| 241 build_utils.AddDepfileOption(parser) | 243 build_utils.AddDepfileOption(parser) |
| 242 | 244 |
| 243 parser.add_option( | 245 parser.add_option( |
| 244 '--src-gendirs', | 246 '--src-gendirs', |
| 245 help='Directories containing generated java files.') | 247 help='Directories containing generated java files.') |
| 246 parser.add_option( | 248 parser.add_option( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 dest='processor_args', | 285 dest='processor_args', |
| 284 action='append', | 286 action='append', |
| 285 help='key=value arguments for the annotation processors.') | 287 help='key=value arguments for the annotation processors.') |
| 286 parser.add_option( | 288 parser.add_option( |
| 287 '--provider-configuration', | 289 '--provider-configuration', |
| 288 dest='provider_configurations', | 290 dest='provider_configurations', |
| 289 action='append', | 291 action='append', |
| 290 help='File to specify a service provider. Will be included ' | 292 help='File to specify a service provider. Will be included ' |
| 291 'in the jar under META-INF/services.') | 293 'in the jar under META-INF/services.') |
| 292 parser.add_option( | 294 parser.add_option( |
| 295 '--additional-jar-file', |
| 296 dest='additional_jar_files', |
| 297 action='append', |
| 298 help='Additional files to package into jar. By default, only Java .class ' |
| 299 'files are packaged into the jar. Files should be specified in ' |
| 300 'format <filename>:<path to be placed in jar>.') |
| 301 parser.add_option( |
| 293 '--chromium-code', | 302 '--chromium-code', |
| 294 type='int', | 303 type='int', |
| 295 help='Whether code being compiled should be built with stricter ' | 304 help='Whether code being compiled should be built with stricter ' |
| 296 'warnings for chromium code.') | 305 'warnings for chromium code.') |
| 297 parser.add_option( | 306 parser.add_option( |
| 298 '--use-errorprone-path', | 307 '--use-errorprone-path', |
| 299 help='Use the Errorprone compiler at this path.') | 308 help='Use the Errorprone compiler at this path.') |
| 300 parser.add_option('--jar-path', help='Jar output path.') | 309 parser.add_option('--jar-path', help='Jar output path.') |
| 301 parser.add_option('--stamp', help='Path to touch on success.') | 310 parser.add_option('--stamp', help='Path to touch on success.') |
| 302 | 311 |
| 303 options, args = parser.parse_args(argv) | 312 options, args = parser.parse_args(argv) |
| 304 build_utils.CheckOptions(options, parser, required=('jar_path',)) | 313 build_utils.CheckOptions(options, parser, required=('jar_path',)) |
| 305 | 314 |
| 306 bootclasspath = [] | 315 bootclasspath = [] |
| 307 for arg in options.bootclasspath: | 316 for arg in options.bootclasspath: |
| 308 bootclasspath += build_utils.ParseGypList(arg) | 317 bootclasspath += build_utils.ParseGypList(arg) |
| 309 options.bootclasspath = bootclasspath | 318 options.bootclasspath = bootclasspath |
| 310 | 319 |
| 311 classpath = [] | 320 classpath = [] |
| 312 for arg in options.classpath: | 321 for arg in options.classpath: |
| 313 classpath += build_utils.ParseGypList(arg) | 322 classpath += build_utils.ParseGypList(arg) |
| 314 options.classpath = classpath | 323 options.classpath = classpath |
| 315 | 324 |
| 316 java_srcjars = [] | 325 java_srcjars = [] |
| 317 for arg in options.java_srcjars: | 326 for arg in options.java_srcjars: |
| 318 java_srcjars += build_utils.ParseGypList(arg) | 327 java_srcjars += build_utils.ParseGypList(arg) |
| 319 options.java_srcjars = java_srcjars | 328 options.java_srcjars = java_srcjars |
| 320 | 329 |
| 330 additional_jar_files = [] |
| 331 for arg in options.additional_jar_files or []: |
| 332 filepath, jar_filepath = arg.split(':') |
| 333 additional_jar_files.append((filepath, jar_filepath)) |
| 334 options.additional_jar_files = additional_jar_files |
| 335 |
| 321 if options.src_gendirs: | 336 if options.src_gendirs: |
| 322 options.src_gendirs = build_utils.ParseGypList(options.src_gendirs) | 337 options.src_gendirs = build_utils.ParseGypList(options.src_gendirs) |
| 323 | 338 |
| 324 options.javac_includes = build_utils.ParseGypList(options.javac_includes) | 339 options.javac_includes = build_utils.ParseGypList(options.javac_includes) |
| 325 options.jar_excluded_classes = ( | 340 options.jar_excluded_classes = ( |
| 326 build_utils.ParseGypList(options.jar_excluded_classes)) | 341 build_utils.ParseGypList(options.jar_excluded_classes)) |
| 327 | 342 |
| 328 java_files = [] | 343 java_files = [] |
| 329 for arg in args: | 344 for arg in args: |
| 330 # Interpret a path prefixed with @ as a file containing a list of sources. | 345 # Interpret a path prefixed with @ as a file containing a list of sources. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 options, | 433 options, |
| 419 input_paths=input_paths, | 434 input_paths=input_paths, |
| 420 input_strings=javac_cmd, | 435 input_strings=javac_cmd, |
| 421 output_paths=output_paths, | 436 output_paths=output_paths, |
| 422 force=force, | 437 force=force, |
| 423 pass_changes=True) | 438 pass_changes=True) |
| 424 | 439 |
| 425 | 440 |
| 426 if __name__ == '__main__': | 441 if __name__ == '__main__': |
| 427 sys.exit(main(sys.argv[1:])) | 442 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |