2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 18:07:12 +01:00

Docs: Avoid Qt re-builds by sorting set of includes

Because Python's set type is unordered, storing include paths in it
can produce unnecessary re-builds by generating different compiler
command lines between successive builds. Avoid this by using the
sorted() function on the includes.

The documentation for Python ≥ 2.7 guarantees that sorted() is stable,
while for Python 2.5–2.6 it uses the same algorithm as list.sort(),
which is stable [1].

[1]: https://stackoverflow.com/a/1915418
This commit is contained in:
Sean Fisk 2017-07-05 20:20:33 -04:00 committed by Thomas Nagy
parent cc9374b646
commit 2c4ff3e28b
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ You also need to edit your sources accordingly:
incs = set(self.to_list(getattr(self, 'includes', '')))
for x in self.compiled_tasks:
incs.add(x.inputs[0].parent.path_from(self.path))
self.includes = list(incs)
self.includes = sorted(incs)
Note: another tool provides Qt processing that does not require
.moc includes, see 'playground/slow_qt/'.

View File

@ -52,7 +52,7 @@ You also need to edit your sources accordingly:
incs = set(self.to_list(getattr(self, 'includes', '')))
for x in self.compiled_tasks:
incs.add(x.inputs[0].parent.path_from(self.path))
self.includes = list(incs)
self.includes = sorted(incs)
Note: another tool provides Qt processing that does not require
.moc includes, see 'playground/slow_qt/'.