summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Builder.py12
-rw-r--r--src/engine/SCons/Script/__init__.py1
-rw-r--r--src/engine/SCons/Warnings.py3
3 files changed, 15 insertions, 1 deletions
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 17d661c..8372292 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -164,9 +164,19 @@ def _init_nodes(builder, env, overrides, tlist, slist):
raise UserError, "Multiple ways to build the same target were specified for: %s" % str(t)
if t.has_builder():
if t.env != env:
- raise UserError, "Two different environments were specified for the same target: %s"%str(t)
+ t_contents = t.builder.action.get_contents(tlist, slist, t.env)
+ contents = t.builder.action.get_contents(tlist, slist, env)
+
+ if t_contents == contents:
+ SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning,
+ "Two different environments were specified for target %s,\n\tbut they appear to have the same action: %s"%(str(t), t.builder.action.strfunction(tlist, slist, t.env)))
+
+ else:
+ raise UserError, "Two environments with different actions were specified for the same target: %s"%str(t)
+
elif t.overrides != overrides:
raise UserError, "Two different sets of overrides were specified for the same target: %s"%str(t)
+
elif builder.scanner and t.target_scanner and builder.scanner != t.target_scanner:
raise UserError, "Two different scanners were specified for the same target: %s"%str(t)
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 0e56214..ac05f3c 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -709,6 +709,7 @@ def _main(args, parser):
SCons.Warnings._warningOut = _scons_internal_warning
SCons.Warnings.enableWarningClass(SCons.Warnings.CorruptSConsignWarning)
SCons.Warnings.enableWarningClass(SCons.Warnings.DeprecatedWarning)
+ SCons.Warnings.enableWarningClass(SCons.Warnings.DuplicateEnvironmentWarning)
SCons.Warnings.enableWarningClass(SCons.Warnings.MissingSConscriptWarning)
SCons.Warnings.enableWarningClass(SCons.Warnings.NoParallelSupportWarning)
diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py
index 6426830..2e2e525 100644
--- a/src/engine/SCons/Warnings.py
+++ b/src/engine/SCons/Warnings.py
@@ -48,6 +48,9 @@ class DependencyWarning(Warning):
class DeprecatedWarning(Warning):
pass
+class DuplicateEnvironmentWarning(Warning):
+ pass
+
class MissingSConscriptWarning(Warning):
pass