From a3dd1ba76fa932d9c29a02f0b5d6bad2e33ea8cd Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Thu, 25 Jun 2020 15:33:43 +0300 Subject: [PATCH] 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 --- configure.py | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.py b/configure.py index 05848e16d3..635cd89cba 100755 --- a/configure.py +++ b/configure.py @@ -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