build: thrift: avoid rebuild if cassandra.thrift is touched but not modified

Thrift 0.12 includes a change [1] that avoids writing the generated output
if it has not changed. As a result, if you touch cassandra.thrift
(but not change it), the generated files will not update, and as
a result ninja will try to rebuild them every time. The compilation
of thrift files will be fast due to ccache, but still we will re-link
everything.

This touching of cassandra.thrift can happen naturally when switching
to a different git branch and then switching back. The net result
is that cassandra.thrift's contents has not changed, but its timestamp
has.

Fix by adding the "restat" option to the thrift rule. This instructs
ninja to check of the output has changed as expected or not, and to
avoid unneeded rebuilds if it has not.

[1] https://issues.apache.org/jira/browse/THRIFT-4532
This commit is contained in:
Avi Kivity
2020-06-25 15:33:43 +03:00
committed by Piotr Sarna
parent 6fe7706fce
commit a3dd1ba76f

View File

@@ -1468,6 +1468,7 @@ with open(buildfile_tmp, 'w') as f:
rule thrift.{mode}
command = thrift -gen cpp:cob_style -out $builddir/{mode}/gen $in
description = THRIFT $in
restat = 1
rule antlr3.{mode}
# We replace many local `ExceptionBaseType* ex` variables with a single function-scope one.
# Because we add such a variable to every function, and because `ExceptionBaseType` is not a global