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

Unified Diff: pylib/gyp/generator/ninja.py

Issue 10381103: ninja: rules chained only by output of first one failing Base URL: https://gyp.googlecode.com/svn/trunk
Patch Set: remove debug print Created 8 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
Index: pylib/gyp/generator/ninja.py
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
index 8809edb88bfe6dd6bd123f6e75261904e9b8b34c..a2da524189bb9530ee7ece0a7ec01a713f3c7a7a 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -517,6 +517,22 @@ class NinjaWriter:
return all_outputs
+ def _GetSourcesForRule(self, main_rule, all_rules):
+ """Get all sources that this rule needs to process. In addition to the
+ rule_sources we have to consider the outputs of other rules."""
+ sources = main_rule.get('rule_sources', [])
+ rule_ext = '.' + main_rule['extension']
+ for rule in all_rules:
+ if rule == main_rule:
+ continue
+ # If this rules outputs are processed, and they're something that this
+ # rule cares about, then add to the inputs.
+ if int(rule.get('process_outputs_as_sources', False)):
+ for output in rule['outputs']:
+ if output.endswith(rule_ext):
+ sources.append(output)
+ return sources
+
def WriteRules(self, rules, extra_sources, prebuild,
extra_mac_bundle_resources):
all_outputs = []
@@ -552,8 +568,9 @@ class NinjaWriter:
return path.replace('\\', '/')
return path
+ sources = self._GetSourcesForRule(rule, rules)
# For each source file, write an edge that generates all the outputs.
- for source in rule.get('rule_sources', []):
+ for source in sources:
dirname, basename = os.path.split(source)
root, ext = os.path.splitext(basename)
« no previous file with comments | « no previous file | test/ninja/chained-rules/chained-rules.gyp » ('j') | test/ninja/chained-rules/gyptest-chained-rules.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698