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) |