diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-20 15:01:58 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-30 13:07:38 +0000 |
commit | 1f327e8321a594d886ad226630bac9313c31d049 (patch) | |
tree | 5fb3e1418afebe2bc0f3c94b12eee33604748978 /tests/auto/blackbox/testdata | |
parent | cffe2129465d7fa5dd86c7a7beabeb9cbbf0389c (diff) |
Fix false positives in artifacts map change tracking
We used to invalidate a script if it accessed the artifacts map and that
map's keys are now different from what they were. However, that logic
was too coarse: All rules that run after the command will add new
artifacts, so such changes will be the norm, at least when the project
is built for the first time. As a result, some artifacts might get
rebuilt unnecessarily on the next qbs invocation.
The reason why we did it that way was that we needed to consider the
case where a script iterated over the elements of an artifacts map, e.g.
using a for..in loop. In such a case, we cannot know which part of the
map the code is interested in and the script needs to be re-run if the
keys change. This is now solved with the help of a QScriptClass, which
informs us if a script enumerates the keys. In all other cases, the
script only accesses well-known tags, so we only have to compare the
respective artifact lists and do not care about other keys getting added
or removed.
Change-Id: I182a50c34ece28f7ff3f7eba7a8f246e9b79b30e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata')
-rw-r--r-- | tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracking.qbs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracking.qbs b/tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracking.qbs index 92579ad7c..0d3c361f6 100644 --- a/tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracking.qbs +++ b/tests/auto/blackbox/testdata/artifacts-map-change-tracking/artifacts-map-change-tracking.qbs @@ -56,4 +56,31 @@ Project { } } } + + Product { + name: "p" + type: "p_type" + Rule { + multiplex: true + Artifact { filePath: "dummy1"; fileTags: "d_type" } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating " + output.fileName; + cmd.sourceCode = function() { + var blubb = product.artifacts.qbs; + }; + return cmd; + } + } + Rule { + inputs: "d_type" + Artifact { filePath: "dummy2"; fileTags: "p_type" } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generating " + output.fileName; + cmd.sourceCode = function() { }; + return cmd; + } + } + } } |