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

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

Issue 12381003: Allow files with the same basename to exist within the same project. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from compiler.ast import Const 5 from compiler.ast import Const
6 from compiler.ast import Dict 6 from compiler.ast import Dict
7 from compiler.ast import Discard 7 from compiler.ast import Discard
8 from compiler.ast import List 8 from compiler.ast import List
9 from compiler.ast import Module 9 from compiler.ast import Module
10 from compiler.ast import Node 10 from compiler.ast import Node
(...skipping 2308 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 raise GypError("Target %s has an invalid target type '%s'. " 2319 raise GypError("Target %s has an invalid target type '%s'. "
2320 "Must be one of %s." % 2320 "Must be one of %s." %
2321 (target, target_type, '/'.join(VALID_TARGET_TYPES))) 2321 (target, target_type, '/'.join(VALID_TARGET_TYPES)))
2322 if (target_dict.get('standalone_static_library', 0) and 2322 if (target_dict.get('standalone_static_library', 0) and
2323 not target_type == 'static_library'): 2323 not target_type == 'static_library'):
2324 raise GypError('Target %s has type %s but standalone_static_library flag is' 2324 raise GypError('Target %s has type %s but standalone_static_library flag is'
2325 ' only valid for static_library type.' % (target, 2325 ' only valid for static_library type.' % (target,
2326 target_type)) 2326 target_type))
2327 2327
2328 2328
2329 def ValidateSourcesInTarget(target, target_dict, build_file): 2329 def ValidateSourcesInTarget(target, target_dict, build_file, variables):
2330
2331 # For MSVS versions <= 2008, files with duplicate basenames are not allowed.
2332 # For all other build configs, duplicates are OK.
2333 if variables.get('GENERATOR', '') != 'msvs' or \
Sam Clegg 2013/02/28 17:35:26 nit: No need to pass second arg to get()
2334 int(variables.get('MSVS_VERSION', '9999')) > '2008':
Sam Clegg 2013/02/28 17:35:26 Is it possible that MSVS_VERSION is not set when g
2335 return
2336
2330 # TODO: Check if MSVC allows this for loadable_module targets. 2337 # TODO: Check if MSVC allows this for loadable_module targets.
2331 if target_dict.get('type', None) not in ('static_library', 'shared_library'): 2338 if target_dict.get('type', None) not in ('static_library', 'shared_library'):
2332 return 2339 return
2340
2333 sources = target_dict.get('sources', []) 2341 sources = target_dict.get('sources', [])
2334 basenames = {} 2342 basenames = {}
2335 for source in sources: 2343 for source in sources:
2336 name, ext = os.path.splitext(source) 2344 name, ext = os.path.splitext(source)
2337 is_compiled_file = ext in [ 2345 is_compiled_file = ext in [
2338 '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S'] 2346 '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S']
2339 if not is_compiled_file: 2347 if not is_compiled_file:
2340 continue 2348 continue
2341 basename = os.path.basename(name) # Don't include extension. 2349 basename = os.path.basename(name) # Don't include extension.
2342 basenames.setdefault(basename, []).append(source) 2350 basenames.setdefault(basename, []).append(source)
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 target_dict, PHASE_LATELATE, variables, build_file) 2663 target_dict, PHASE_LATELATE, variables, build_file)
2656 2664
2657 # Make sure that the rules make sense, and build up rule_sources lists as 2665 # Make sure that the rules make sense, and build up rule_sources lists as
2658 # needed. Not all generators will need to use the rule_sources lists, but 2666 # needed. Not all generators will need to use the rule_sources lists, but
2659 # some may, and it seems best to build the list in a common spot. 2667 # some may, and it seems best to build the list in a common spot.
2660 # Also validate actions and run_as elements in targets. 2668 # Also validate actions and run_as elements in targets.
2661 for target in flat_list: 2669 for target in flat_list:
2662 target_dict = targets[target] 2670 target_dict = targets[target]
2663 build_file = gyp.common.BuildFile(target) 2671 build_file = gyp.common.BuildFile(target)
2664 ValidateTargetType(target, target_dict) 2672 ValidateTargetType(target, target_dict)
2665 # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to 2673 ValidateSourcesInTarget(target, target_dict, build_file, variables)
2666 # scalesystemdependent_arm_additions.c or similar.
2667 if 'arm' not in variables.get('target_arch', ''):
2668 ValidateSourcesInTarget(target, target_dict, build_file)
2669 ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) 2674 ValidateRulesInTarget(target, target_dict, extra_sources_for_rules)
2670 ValidateRunAsInTarget(target, target_dict, build_file) 2675 ValidateRunAsInTarget(target, target_dict, build_file)
2671 ValidateActionsInTarget(target, target_dict, build_file) 2676 ValidateActionsInTarget(target, target_dict, build_file)
2672 2677
2673 # Generators might not expect ints. Turn them into strs. 2678 # Generators might not expect ints. Turn them into strs.
2674 TurnIntIntoStrInDict(data) 2679 TurnIntIntoStrInDict(data)
2675 2680
2676 # TODO(mark): Return |data| for now because the generator needs a list of 2681 # TODO(mark): Return |data| for now because the generator needs a list of
2677 # build files that came in. In the future, maybe it should just accept 2682 # build files that came in. In the future, maybe it should just accept
2678 # a list, and not the whole data dict. 2683 # a list, and not the whole data dict.
2679 return [flat_list, targets, data] 2684 return [flat_list, targets, data]
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698