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

Unified Diff: pylib/gyp/input.py

Issue 1151963003: Revert "Stop checking for duplicate basenames" (Closed) Base URL: http://gyp.googlecode.com/svn/trunk
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pylib/gyp/__init__.py ('k') | test/errors/duplicate_basenames.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/input.py
diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py
index 34fbc54711923ca53def6cb3a86e5acc2680237d..2c30966e551ee0106e60a51b00b78e262fa1c24d 100644
--- a/pylib/gyp/input.py
+++ b/pylib/gyp/input.py
@@ -2488,6 +2488,37 @@ def ValidateTargetType(target, target_dict):
target_type))
+def ValidateSourcesInTarget(target, target_dict, build_file,
+ duplicate_basename_check):
+ if not duplicate_basename_check:
+ return
+ # TODO: Check if MSVC allows this for loadable_module targets.
+ if target_dict.get('type', None) not in ('static_library', 'shared_library'):
Nico 2015/05/21 23:50:07 Maybe shared_library can be removed here?
scottmg 2015/05/21 23:59:18 That seems pretty weird now that I look at it. I d
+ return
+ sources = target_dict.get('sources', [])
+ basenames = {}
+ for source in sources:
+ name, ext = os.path.splitext(source)
+ is_compiled_file = ext in [
+ '.c', '.cc', '.cpp', '.cxx', '.m', '.mm', '.s', '.S']
+ if not is_compiled_file:
+ continue
+ basename = os.path.basename(name) # Don't include extension.
+ basenames.setdefault(basename, []).append(source)
+
+ error = ''
+ for basename, files in basenames.iteritems():
+ if len(files) > 1:
+ error += ' %s: %s\n' % (basename, ' '.join(files))
+
+ if error:
+ print('static library %s has several files with the same basename:\n' %
+ target + error + 'Some build systems, e.g. MSVC08 and Make generator '
Nico 2015/05/21 23:50:07 Maybe this should say "libtool on mac" now?
scottmg 2015/05/21 23:59:18 Done.
+ 'for Mac, cannot handle that. Use --no-duplicate-basename-check to'
yukawa 2015/05/21 23:58:57 A white space between 'to' and 'disable'? If this
scottmg 2015/05/22 00:00:46 I think I did this accidentally during reflowing.
+ 'disable this validation.')
+ raise GypError('Duplicate basenames in sources section, see list above')
+
+
def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules):
"""Ensures that the rules sections in target_dict are valid and consistent,
and determines which sources they apply to.
@@ -2708,7 +2739,7 @@ def SetGeneratorGlobals(generator_input_info):
def Load(build_files, variables, includes, depth, generator_input_info, check,
- circular_check, parallel, root_targets):
+ circular_check, duplicate_basename_check, parallel, root_targets):
SetGeneratorGlobals(generator_input_info)
# A generator can have other lists (in addition to sources) be processed
# for rules.
@@ -2832,6 +2863,11 @@ def Load(build_files, variables, includes, depth, generator_input_info, check,
ProcessVariablesAndConditionsInDict(
target_dict, PHASE_LATELATE, variables, build_file)
+ # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to
+ # scalesystemdependent_arm_additions.c or similar.
Nico 2015/05/21 23:50:07 If the shared_library above goes away, this may or
scottmg 2015/05/21 23:59:18 I'm feeling lucky. Done!
+ if 'arm' in variables.get('target_arch', ''):
+ duplicate_basename_check = False
+
# Make sure that the rules make sense, and build up rule_sources lists as
# needed. Not all generators will need to use the rule_sources lists, but
# some may, and it seems best to build the list in a common spot.
@@ -2840,6 +2876,8 @@ def Load(build_files, variables, includes, depth, generator_input_info, check,
target_dict = targets[target]
build_file = gyp.common.BuildFile(target)
ValidateTargetType(target, target_dict)
+ ValidateSourcesInTarget(target, target_dict, build_file,
+ duplicate_basename_check)
ValidateRulesInTarget(target, target_dict, extra_sources_for_rules)
ValidateRunAsInTarget(target, target_dict, build_file)
ValidateActionsInTarget(target, target_dict, build_file)
« no previous file with comments | « pylib/gyp/__init__.py ('k') | test/errors/duplicate_basenames.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698