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

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

Issue 344573002: Introduce '--no-duplicate-basename-check' option to disable the check of duplicate basenames (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Rebase with r1946 Created 6 years, 5 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/generator/make.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 flavor = None 62 flavor = None
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 'build_files': build_files, 500 'build_files': build_files,
490 'generator_flags': generator_flags, 501 'generator_flags': generator_flags,
491 'cwd': os.getcwd(), 502 'cwd': os.getcwd(),
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 508
498 # Start with the default variables from the command line. 509 # Start with the default variables from the command line.
499 [generator, flat_list, targets, data] = Load(build_files, format, 510 [generator, flat_list, targets, data] = Load(
500 cmdline_default_variables, 511 build_files, format, cmdline_default_variables, includes, options.depth,
501 includes, options.depth, 512 params, options.check, options.circular_check,
502 params, options.check, 513 options.duplicate_basename_check)
503 options.circular_check)
504 514
505 # TODO(mark): Pass |data| for now because the generator needs a list of 515 # TODO(mark): Pass |data| for now because the generator needs a list of
506 # build files that came in. In the future, maybe it should just accept 516 # build files that came in. In the future, maybe it should just accept
507 # a list, and not the whole data dict. 517 # a list, and not the whole data dict.
508 # NOTE: flat_list is the flattened dependency graph specifying the order 518 # NOTE: flat_list is the flattened dependency graph specifying the order
509 # that targets may be built. Build systems that operate serially or that 519 # that targets may be built. Build systems that operate serially or that
510 # need to have dependencies defined before dependents reference them should 520 # need to have dependencies defined before dependents reference them should
511 # generate targets in the order specified in flat_list. 521 # generate targets in the order specified in flat_list.
512 generator.GenerateOutput(flat_list, targets, data, params) 522 generator.GenerateOutput(flat_list, targets, data, params)
513 523
(...skipping 14 matching lines...) Expand all
528 except GypError, e: 538 except GypError, e:
529 sys.stderr.write("gyp: %s\n" % e) 539 sys.stderr.write("gyp: %s\n" % e)
530 return 1 540 return 1
531 541
532 # NOTE: setuptools generated console_scripts calls function with no arguments 542 # NOTE: setuptools generated console_scripts calls function with no arguments
533 def script_main(): 543 def script_main():
534 return main(sys.argv[1:]) 544 return main(sys.argv[1:])
535 545
536 if __name__ == '__main__': 546 if __name__ == '__main__':
537 sys.exit(script_main()) 547 sys.exit(script_main())
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/make.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698