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