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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 files = os.listdir(os.getcwd()) | 42 files = os.listdir(os.getcwd()) |
43 build_files = [] | 43 build_files = [] |
44 for file in files: | 44 for file in files: |
45 if file.endswith(extension): | 45 if file.endswith(extension): |
46 build_files.append(file) | 46 build_files.append(file) |
47 return build_files | 47 return build_files |
48 | 48 |
49 | 49 |
50 def Load(build_files, format, default_variables={}, | 50 def Load(build_files, format, default_variables={}, |
51 includes=[], depth='.', params=None, check=False, | 51 includes=[], depth='.', params=None, check=False, |
52 circular_check=True): | 52 circular_check=True, duplicate_basename_check=True): |
53 """ | 53 """ |
54 Loads one or more specified build files. | 54 Loads one or more specified build files. |
55 default_variables and includes will be copied before use. | 55 default_variables and includes will be copied before use. |
56 Returns the generator for the specified format and the | 56 Returns the generator for the specified format and the |
57 data returned by loading the specified build files. | 57 data returned by loading the specified build files. |
58 """ | 58 """ |
59 if params is None: | 59 if params is None: |
60 params = {} | 60 params = {} |
61 | 61 |
62 if '-' in format: | 62 if '-' in format: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 'generator_wants_static_library_dependencies_adjusted', True), | 119 'generator_wants_static_library_dependencies_adjusted', True), |
120 'generator_wants_sorted_dependencies': | 120 'generator_wants_sorted_dependencies': |
121 getattr(generator, 'generator_wants_sorted_dependencies', False), | 121 getattr(generator, 'generator_wants_sorted_dependencies', False), |
122 'generator_filelist_paths': | 122 'generator_filelist_paths': |
123 getattr(generator, 'generator_filelist_paths', None), | 123 getattr(generator, 'generator_filelist_paths', None), |
124 } | 124 } |
125 | 125 |
126 # Process the input specific to this generator. | 126 # Process the input specific to this generator. |
127 result = gyp.input.Load(build_files, default_variables, includes[:], | 127 result = gyp.input.Load(build_files, default_variables, includes[:], |
128 depth, generator_input_info, check, circular_check, | 128 depth, generator_input_info, check, circular_check, |
| 129 duplicate_basename_check, |
129 params['parallel'], params['root_targets']) | 130 params['parallel'], params['root_targets']) |
130 return [generator] + result | 131 return [generator] + result |
131 | 132 |
132 def NameValueListToDict(name_value_list): | 133 def NameValueListToDict(name_value_list): |
133 """ | 134 """ |
134 Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary | 135 Takes an array of strings of the form 'NAME=VALUE' and creates a dictionary |
135 of the pairs. If a string is simply NAME, then the value in the dictionary | 136 of the pairs. If a string is simply NAME, then the value in the dictionary |
136 is set to True. If VALUE can be converted to an integer, it is. | 137 is set to True. If VALUE can be converted to an integer, it is. |
137 """ | 138 """ |
138 result = { } | 139 result = { } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 # --no-circular-check disables the check for circular relationships between | 318 # --no-circular-check disables the check for circular relationships between |
318 # .gyp files. These relationships should not exist, but they've only been | 319 # .gyp files. These relationships should not exist, but they've only been |
319 # observed to be harmful with the Xcode generator. Chromium's .gyp files | 320 # observed to be harmful with the Xcode generator. Chromium's .gyp files |
320 # currently have some circular relationships on non-Mac platforms, so this | 321 # currently have some circular relationships on non-Mac platforms, so this |
321 # option allows the strict behavior to be used on Macs and the lenient | 322 # option allows the strict behavior to be used on Macs and the lenient |
322 # behavior to be used elsewhere. | 323 # behavior to be used elsewhere. |
323 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. | 324 # TODO(mark): Remove this option when http://crbug.com/35878 is fixed. |
324 parser.add_option('--no-circular-check', dest='circular_check', | 325 parser.add_option('--no-circular-check', dest='circular_check', |
325 action='store_false', default=True, regenerate=False, | 326 action='store_false', default=True, regenerate=False, |
326 help="don't check for circular relationships between files") | 327 help="don't check for circular relationships between files") |
| 328 # --no-duplicate-basename-check disables the check for duplicate basenames |
| 329 # in a static_library/shared_library project. Visual C++ 2008 generator |
| 330 # doesn't support this configuration. Libtool on Mac also generates warnings |
| 331 # when duplicate basenames are passed into Make generator on Mac. |
| 332 # TODO(yukawa): Remove this option when these legacy generators are |
| 333 # deprecated. |
| 334 parser.add_option('--no-duplicate-basename-check', |
| 335 dest='duplicate_basename_check', action='store_false', |
| 336 default=True, regenerate=False, |
| 337 help="don't check for duplicate basenames") |
327 parser.add_option('--no-parallel', action='store_true', default=False, | 338 parser.add_option('--no-parallel', action='store_true', default=False, |
328 help='Disable multiprocessing') | 339 help='Disable multiprocessing') |
329 parser.add_option('-S', '--suffix', dest='suffix', default='', | 340 parser.add_option('-S', '--suffix', dest='suffix', default='', |
330 help='suffix to add to generated files') | 341 help='suffix to add to generated files') |
331 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', | 342 parser.add_option('--toplevel-dir', dest='toplevel_dir', action='store', |
332 default=None, metavar='DIR', type='path', | 343 default=None, metavar='DIR', type='path', |
333 help='directory to use as the root of the source tree') | 344 help='directory to use as the root of the source tree') |
334 parser.add_option('-R', '--root-target', dest='root_targets', | 345 parser.add_option('-R', '--root-target', dest='root_targets', |
335 action='append', metavar='TARGET', | 346 action='append', metavar='TARGET', |
336 help='include only TARGET and its deep dependencies') | 347 help='include only TARGET and its deep dependencies') |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 'build_files_arg': build_files_arg, | 503 'build_files_arg': build_files_arg, |
493 'gyp_binary': sys.argv[0], | 504 'gyp_binary': sys.argv[0], |
494 'home_dot_gyp': home_dot_gyp, | 505 'home_dot_gyp': home_dot_gyp, |
495 'parallel': options.parallel, | 506 'parallel': options.parallel, |
496 'root_targets': options.root_targets, | 507 'root_targets': options.root_targets, |
497 'target_arch': cmdline_default_variables.get('target_arch', '')} | 508 'target_arch': cmdline_default_variables.get('target_arch', '')} |
498 | 509 |
499 # Start with the default variables from the command line. | 510 # Start with the default variables from the command line. |
500 [generator, flat_list, targets, data] = Load( | 511 [generator, flat_list, targets, data] = Load( |
501 build_files, format, cmdline_default_variables, includes, options.depth, | 512 build_files, format, cmdline_default_variables, includes, options.depth, |
502 params, options.check, options.circular_check) | 513 params, options.check, options.circular_check, |
| 514 options.duplicate_basename_check) |
503 | 515 |
504 # TODO(mark): Pass |data| for now because the generator needs a list of | 516 # TODO(mark): Pass |data| for now because the generator needs a list of |
505 # build files that came in. In the future, maybe it should just accept | 517 # build files that came in. In the future, maybe it should just accept |
506 # a list, and not the whole data dict. | 518 # a list, and not the whole data dict. |
507 # NOTE: flat_list is the flattened dependency graph specifying the order | 519 # NOTE: flat_list is the flattened dependency graph specifying the order |
508 # that targets may be built. Build systems that operate serially or that | 520 # that targets may be built. Build systems that operate serially or that |
509 # need to have dependencies defined before dependents reference them should | 521 # need to have dependencies defined before dependents reference them should |
510 # generate targets in the order specified in flat_list. | 522 # generate targets in the order specified in flat_list. |
511 generator.GenerateOutput(flat_list, targets, data, params) | 523 generator.GenerateOutput(flat_list, targets, data, params) |
512 | 524 |
(...skipping 14 matching lines...) Expand all Loading... |
527 except GypError, e: | 539 except GypError, e: |
528 sys.stderr.write("gyp: %s\n" % e) | 540 sys.stderr.write("gyp: %s\n" % e) |
529 return 1 | 541 return 1 |
530 | 542 |
531 # NOTE: setuptools generated console_scripts calls function with no arguments | 543 # NOTE: setuptools generated console_scripts calls function with no arguments |
532 def script_main(): | 544 def script_main(): |
533 return main(sys.argv[1:]) | 545 return main(sys.argv[1:]) |
534 | 546 |
535 if __name__ == '__main__': | 547 if __name__ == '__main__': |
536 sys.exit(script_main()) | 548 sys.exit(script_main()) |
OLD | NEW |