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

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

Issue 2014983003: [Android] Build changes needed for Robolectric 3.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 elif options.incremental: 221 elif options.incremental:
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 jar.JarDirectory(classes_dir, 233 jar.JarDirectory(classes_dir,
233 excluded_jar_path, 234 excluded_jar_path,
234 predicate=exclusion_predicate) 235 predicate=exclusion_predicate,
236 provider_configurations=options.provider_configurations)
235 237
236 238
237 def _ParseOptions(argv): 239 def _ParseOptions(argv):
238 parser = optparse.OptionParser() 240 parser = optparse.OptionParser()
239 build_utils.AddDepfileOption(parser) 241 build_utils.AddDepfileOption(parser)
240 242
241 parser.add_option( 243 parser.add_option(
242 '--src-gendirs', 244 '--src-gendirs',
243 help='Directories containing generated java files.') 245 help='Directories containing generated java files.')
244 parser.add_option( 246 parser.add_option(
(...skipping 20 matching lines...) Expand all
265 parser.add_option( 267 parser.add_option(
266 '--javac-includes', 268 '--javac-includes',
267 default='', 269 default='',
268 help='A list of file patterns. If provided, only java files that match' 270 help='A list of file patterns. If provided, only java files that match'
269 'one of the patterns will be compiled.') 271 'one of the patterns will be compiled.')
270 parser.add_option( 272 parser.add_option(
271 '--jar-excluded-classes', 273 '--jar-excluded-classes',
272 default='', 274 default='',
273 help='List of .class file patterns to exclude from the jar.') 275 help='List of .class file patterns to exclude from the jar.')
274 parser.add_option( 276 parser.add_option(
277 '--processor',
278 dest='processors',
279 action='append',
280 help='Annotation processor to use.')
281 parser.add_option(
282 '--processor-arg',
283 dest='processor_args',
284 action='append',
285 help='key=value arguments for the annotation processors.')
286 parser.add_option(
287 '--provider-configuration',
288 dest='provider_configurations',
289 action='append',
290 help='File to specify a service provider. Will be included '
291 'in the jar under META-INF/services.')
292 parser.add_option(
275 '--chromium-code', 293 '--chromium-code',
276 type='int', 294 type='int',
277 help='Whether code being compiled should be built with stricter ' 295 help='Whether code being compiled should be built with stricter '
278 'warnings for chromium code.') 296 'warnings for chromium code.')
279 parser.add_option( 297 parser.add_option(
280 '--use-errorprone-path', 298 '--use-errorprone-path',
281 help='Use the Errorprone compiler at this path.') 299 help='Use the Errorprone compiler at this path.')
282 parser.add_option('--jar-path', help='Jar output path.') 300 parser.add_option('--jar-path', help='Jar output path.')
283 parser.add_option('--stamp', help='Path to touch on success.') 301 parser.add_option('--stamp', help='Path to touch on success.')
284 302
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 ]) 361 ])
344 362
345 if options.chromium_code: 363 if options.chromium_code:
346 javac_cmd.extend(['-Xlint:unchecked', '-Xlint:deprecation']) 364 javac_cmd.extend(['-Xlint:unchecked', '-Xlint:deprecation'])
347 else: 365 else:
348 # XDignore.symbol.file makes javac compile against rt.jar instead of 366 # XDignore.symbol.file makes javac compile against rt.jar instead of
349 # ct.sym. This means that using a java internal package/class will not 367 # ct.sym. This means that using a java internal package/class will not
350 # trigger a compile warning or error. 368 # trigger a compile warning or error.
351 javac_cmd.extend(['-XDignore.symbol.file']) 369 javac_cmd.extend(['-XDignore.symbol.file'])
352 370
371 if options.processors:
372 javac_cmd.extend(['-processor', ','.join(options.processors)])
373 if options.processor_args:
374 for arg in options.processor_args:
375 javac_cmd.extend(['-A%s' % arg])
376
353 classpath_inputs = options.bootclasspath 377 classpath_inputs = options.bootclasspath
354 if options.classpath: 378 if options.classpath:
355 if options.classpath[0].endswith('.interface.jar'): 379 if options.classpath[0].endswith('.interface.jar'):
356 classpath_inputs.extend(options.classpath) 380 classpath_inputs.extend(options.classpath)
357 else: 381 else:
358 # TODO(agrieve): Remove this .TOC heuristic once GYP is no more. 382 # TODO(agrieve): Remove this .TOC heuristic once GYP is no more.
359 for path in options.classpath: 383 for path in options.classpath:
360 if os.path.exists(path + '.TOC'): 384 if os.path.exists(path + '.TOC'):
361 classpath_inputs.append(path + '.TOC') 385 classpath_inputs.append(path + '.TOC')
362 else: 386 else:
(...skipping 21 matching lines...) Expand all
384 options, 408 options,
385 input_paths=input_paths, 409 input_paths=input_paths,
386 input_strings=javac_cmd, 410 input_strings=javac_cmd,
387 output_paths=output_paths, 411 output_paths=output_paths,
388 force=force, 412 force=force,
389 pass_changes=True) 413 pass_changes=True)
390 414
391 415
392 if __name__ == '__main__': 416 if __name__ == '__main__':
393 sys.exit(main(sys.argv[1:])) 417 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698