Index: pylib/gyp/input.py |
diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py |
index 568049df6c349c6dae60fcbd966e73a0c628a7ee..6bd4d172baae21cc153689401a390f10d6207c65 100644 |
--- a/pylib/gyp/input.py |
+++ b/pylib/gyp/input.py |
@@ -2190,6 +2190,15 @@ def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): |
rule_extensions = {} |
rules = target_dict.get('rules', []) |
+ |
+ # Gather the outputs for all rules with process_outputs_as_sources so we can |
+ # validate that they're not chained below. |
+ processed_outputs = [] |
+ for rule in rules: |
+ if rule.get('process_outputs_as_sources', False): |
+ for output in rule['outputs']: |
+ processed_outputs.append((rule, output)) |
Evan Martin
2012/05/18 22:53:36
Why not a map of output extension => other stuff,
|
+ |
for rule in rules: |
# Make sure that there's no conflict among rule names and extensions. |
rule_name = rule['rule_name'] |
@@ -2207,6 +2216,17 @@ def ValidateRulesInTarget(target, target_dict, extra_sources_for_rules): |
rule_name) |
rule_extensions[rule_extension] = rule |
+ # Make sure rules aren't chained (i.e. the output of one rule with |
+ # process_outputs_as_sources is the input for another rule). Some |
+ # generators can't reasonably support this. |
+ for other, output in processed_outputs: |
+ if other == rule: |
+ continue |
+ if output.endswith('.' + rule_extension): |
+ raise KeyError, ('target %s contains "%s" rule that would handle ' |
+ 'the output of other rule %s (processing %s)' % |
+ (target, rule_extension, other['rule_name'], output)) |
+ |
# Make sure rule_sources isn't already there. It's going to be |
# created below if needed. |
if 'rule_sources' in rule: |