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

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: incorporate review comments 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/common.py » ('j') | no next file with comments »
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['root_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('-R', '--root-target', dest='root_targets',
341 action='append', metavar='TARGET',
342 help='include only TARGET and its deep dependencies')
340 343
341 options, build_files_arg = parser.parse_args(args) 344 options, build_files_arg = parser.parse_args(args)
342 build_files = build_files_arg 345 build_files = build_files_arg
343 346
344 # Set up the configuration directory (defaults to ~/.gyp) 347 # Set up the configuration directory (defaults to ~/.gyp)
345 if not options.config_dir: 348 if not options.config_dir:
346 home = None 349 home = None
347 home_dot_gyp = None 350 home_dot_gyp = None
348 if options.use_environment: 351 if options.use_environment:
349 home_dot_gyp = os.environ.get('GYP_CONFIG_DIR', None) 352 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 502 # Generate all requested formats (use a set in case we got one format request
500 # twice) 503 # twice)
501 for format in set(options.formats): 504 for format in set(options.formats):
502 params = {'options': options, 505 params = {'options': options,
503 'build_files': build_files, 506 'build_files': build_files,
504 'generator_flags': generator_flags, 507 'generator_flags': generator_flags,
505 'cwd': os.getcwd(), 508 'cwd': os.getcwd(),
506 'build_files_arg': build_files_arg, 509 'build_files_arg': build_files_arg,
507 'gyp_binary': sys.argv[0], 510 'gyp_binary': sys.argv[0],
508 'home_dot_gyp': home_dot_gyp, 511 'home_dot_gyp': home_dot_gyp,
509 'parallel': options.parallel} 512 'parallel': options.parallel,
513 'root_targets': options.root_targets}
510 514
511 # Start with the default variables from the command line. 515 # Start with the default variables from the command line.
512 [generator, flat_list, targets, data] = Load(build_files, format, 516 [generator, flat_list, targets, data] = Load(build_files, format,
513 cmdline_default_variables, 517 cmdline_default_variables,
514 includes, options.depth, 518 includes, options.depth,
515 params, options.check, 519 params, options.check,
516 options.circular_check) 520 options.circular_check)
517 521
518 # TODO(mark): Pass |data| for now because the generator needs a list of 522 # 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 523 # build files that came in. In the future, maybe it should just accept
(...skipping 21 matching lines...) Expand all
541 except GypError, e: 545 except GypError, e:
542 sys.stderr.write("gyp: %s\n" % e) 546 sys.stderr.write("gyp: %s\n" % e)
543 return 1 547 return 1
544 548
545 # NOTE: setuptools generated console_scripts calls function with no arguments 549 # NOTE: setuptools generated console_scripts calls function with no arguments
546 def script_main(): 550 def script_main():
547 return main(sys.argv[1:]) 551 return main(sys.argv[1:])
548 552
549 if __name__ == '__main__': 553 if __name__ == '__main__':
550 sys.exit(script_main()) 554 sys.exit(script_main())
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698