qbs

Rule Item: how to check if it has to be re-run?


In my case, Rule has to be invoked upon environment changes (svn revision of working directory) instead of changes of input files. So, depending on alwaysRun, my rule is invoked either never (failing build) or always (forcing dependers to be rebuilt).

What I need is either:

  1. a way to check if Rule has to be run or not
  2. a way to cache rule output somehow, for dependers only to be rebuilt when necessary

Solution

  • Rules and Commands are re-run not only due to input changes, but also if properties used in them change. So in your case, you will want to define a property that corresponds to the svn repository state and refer to it in your rule and/or command. Then the re-execution will happen if and only if it is necessary. Note that in qbs 1.10, such a property is provided automatically via the vcs module: http://doc-snapshots.qt.io/qbs/vcs-module.html