Sort input files so command lines do not change. This allows Ninja to skip unnecessary build steps.

pull/15/head
Jussi Pakkanen 11 years ago
parent 02cb18c934
commit 279dd5e809
  1. 4
      ninjabackend.py

@ -67,9 +67,11 @@ class NinjaBuildElement():
self.elems.append((name, elems)) self.elems.append((name, elems))
def write(self, outfile): def write(self, outfile):
# Sort inputs so the command line does not change.
# This allows Ninja to skip unnecessary rebuilds.
line = 'build %s: %s %s' % (' '.join([ninja_quote(i) for i in self.outfilenames]),\ line = 'build %s: %s %s' % (' '.join([ninja_quote(i) for i in self.outfilenames]),\
self.rule, self.rule,
' '.join([ninja_quote(i) for i in self.infilenames])) ' '.join([ninja_quote(i) for i in sorted(self.infilenames)]))
if len(self.deps) > 0: if len(self.deps) > 0:
line += ' | ' + ' '.join([ninja_quote(x) for x in self.deps]) line += ' | ' + ' '.join([ninja_quote(x) for x in self.deps])
if len(self.orderdeps) > 0: if len(self.orderdeps) > 0:

Loading…
Cancel
Save