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

Side by Side Diff: pylib/gyp/__init__.py

Issue 24803004: Add an option to prune unwanted targets (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | pylib/gyp/input.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2012 Google Inc. All rights reserved. 3 # Copyright (c) 2012 Google Inc. 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 copy 7 import copy
8 import gyp.input 8 import gyp.input
9 import optparse 9 import optparse
10 import os.path 10 import os.path
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 'generator_wants_static_library_dependencies_adjusted': 121 'generator_wants_static_library_dependencies_adjusted':
122 getattr(generator, 122 getattr(generator,
123 'generator_wants_static_library_dependencies_adjusted', True), 123 'generator_wants_static_library_dependencies_adjusted', True),
124 'generator_wants_sorted_dependencies': 124 'generator_wants_sorted_dependencies':
125 getattr(generator, 'generator_wants_sorted_dependencies', False), 125 getattr(generator, 'generator_wants_sorted_dependencies', False),
126 } 126 }
127 127
128 # Process the input specific to this generator. 128 # Process the input specific to this generator.
129 result = gyp.input.Load(build_files, default_variables, includes[:], 129 result = gyp.input.Load(build_files, default_variables, includes[:],
130 depth, generator_input_info, check, circular_check, 130 depth, generator_input_info, check, circular_check,
131 params['parallel']) 131 params['parallel'], params['prune_targets'])
132 return [generator] + result 132 return [generator] + result
133 133
134 def NameValueListToDict(name_value_list): 134 def NameValueListToDict(name_value_list):
135 """ 135 """
136 Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary 136 Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary
137 of the pairs. If a string is simply NAME, then the value in the dictionary 137 of the pairs. If a string is simply NAME, then the value in the dictionary
138 is set to True. If VALUE can be converted to an integer, it is. 138 is set to True. If VALUE can be converted to an integer, it is.
139 """ 139 """
140 result = { } 140 result = { }
141 for item in name_value_list: 141 for item in name_value_list:
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 action='store_false', default=True, regenerate=False, 330 action='store_false', default=True, regenerate=False,
331 help="don't check for circular relationships between files") 331 help="don't check for circular relationships between files")
332 parser.add_option('--parallel', action='store_true', 332 parser.add_option('--parallel', action='store_true',
333 env_name='GYP_PARALLEL', 333 env_name='GYP_PARALLEL',
334 help='Use multiprocessing for speed (experimental)') 334 help='Use multiprocessing for speed (experimental)')
335 parser.add_option('-S', '--suffix', dest='suffix', default='', 335 parser.add_option('-S', '--suffix', dest='suffix', default='',
336 help='suffix to add to generated files') 336 help='suffix to add to generated files')
337 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', 337 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store',
338 default=None, metavar='DIR', type='path', 338 default=None, metavar='DIR', type='path',
339 help='directory to use as the root of the source tree') 339 help='directory to use as the root of the source tree')
340 parser.add_option('--prune-targets', dest='prune_targets', default=False,
341 action='store_true',
342 help='Prune out targets that are not deep dependencies '
343 'of targets in the specified gyp files')
340 344
341 options, build_files_arg = parser.parse_args(args) 345 options, build_files_arg = parser.parse_args(args)
342 build_files = build_files_arg 346 build_files = build_files_arg
343 347
344 # Set up the configuration directory (defaults to ~/.gyp) 348 # Set up the configuration directory (defaults to ~/.gyp)
345 if not options.config_dir: 349 if not options.config_dir:
346 home = None 350 home = None
347 home_dot_gyp = None 351 home_dot_gyp = None
348 if options.use_environment: 352 if options.use_environment:
349 home_dot_gyp = os.environ.get('GYP_CONFIG_DIR', None) 353 home_dot_gyp = os.environ.get('GYP_CONFIG_DIR', None)
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 # Generate all requested formats (use a set in case we got one format request 503 # Generate all requested formats (use a set in case we got one format request
500 # twice) 504 # twice)
501 for format in set(options.formats): 505 for format in set(options.formats):
502 params = {'options': options, 506 params = {'options': options,
503 'build_files': build_files, 507 'build_files': build_files,
504 'generator_flags': generator_flags, 508 'generator_flags': generator_flags,
505 'cwd': os.getcwd(), 509 'cwd': os.getcwd(),
506 'build_files_arg': build_files_arg, 510 'build_files_arg': build_files_arg,
507 'gyp_binary': sys.argv[0], 511 'gyp_binary': sys.argv[0],
508 'home_dot_gyp': home_dot_gyp, 512 'home_dot_gyp': home_dot_gyp,
509 'parallel': options.parallel} 513 'parallel': options.parallel,
514 'prune_targets': options.prune_targets}
510 515
511 # Start with the default variables from the command line. 516 # Start with the default variables from the command line.
512 [generator, flat_list, targets, data] = Load(build_files, format, 517 [generator, flat_list, targets, data] = Load(build_files, format,
513 cmdline_default_variables, 518 cmdline_default_variables,
514 includes, options.depth, 519 includes, options.depth,
515 params, options.check, 520 params, options.check,
516 options.circular_check) 521 options.circular_check)
517 522
518 # TODO(mark): Pass |data| for now because the generator needs a list of 523 # TODO(mark): Pass |data| for now because the generator needs a list of
519 # build files that came in. In the future, maybe it should just accept 524 # build files that came in. In the future, maybe it should just accept
(...skipping 21 matching lines...) Expand all
541 except GypError, e: 546 except GypError, e:
542 sys.stderr.write("gyp: %s\n" % e) 547 sys.stderr.write("gyp: %s\n" % e)
543 return 1 548 return 1
544 549
545 # NOTE: setuptools generated console_scripts calls function with no arguments 550 # NOTE: setuptools generated console_scripts calls function with no arguments
546 def script_main(): 551 def script_main():
547 return main(sys.argv[1:]) 552 return main(sys.argv[1:])
548 553
549 if __name__ == '__main__': 554 if __name__ == '__main__':
550 sys.exit(script_main()) 555 sys.exit(script_main())
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | pylib/gyp/input.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698