Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: build/android/gyp/javac.py

Issue 2044223005: [Android] Add option to add additional files to built jars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [Android] Add option to add additional files to built jars. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 if options.additional_jar_files:
jbudorick 2016/07/21 00:12:41 optional nit: same
mikecase (-- gone --) 2016/07/21 16:32:37 ooh, I like this style. Done
332 for arg in options.additional_jar_files:
333 filepath, jar_filepath = arg.split(':')
334 additional_jar_files.append((filepath, jar_filepath))
335 options.additional_jar_files = additional_jar_files
336
321 if options.src_gendirs: 337 if options.src_gendirs:
322 options.src_gendirs = build_utils.ParseGypList(options.src_gendirs) 338 options.src_gendirs = build_utils.ParseGypList(options.src_gendirs)
323 339
324 options.javac_includes = build_utils.ParseGypList(options.javac_includes) 340 options.javac_includes = build_utils.ParseGypList(options.javac_includes)
325 options.jar_excluded_classes = ( 341 options.jar_excluded_classes = (
326 build_utils.ParseGypList(options.jar_excluded_classes)) 342 build_utils.ParseGypList(options.jar_excluded_classes))
327 343
328 java_files = [] 344 java_files = []
329 for arg in args: 345 for arg in args:
330 # Interpret a path prefixed with @ as a file containing a list of sources. 346 # 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
418 options, 434 options,
419 input_paths=input_paths, 435 input_paths=input_paths,
420 input_strings=javac_cmd, 436 input_strings=javac_cmd,
421 output_paths=output_paths, 437 output_paths=output_paths,
422 force=force, 438 force=force,
423 pass_changes=True) 439 pass_changes=True)
424 440
425 441
426 if __name__ == '__main__': 442 if __name__ == '__main__':
427 sys.exit(main(sys.argv[1:])) 443 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698