diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-10 15:58:51 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-07-16 09:01:46 +0000 |
commit | 4a0f385213148875859689c193f15f372f90802d (patch) | |
tree | 0c08d82081bcce1d13f9cb5477b671177a688d65 /tests/auto/blackbox/testdata-qt | |
parent | facd941064fbdad2a89ddc557e6540a2869a962f (diff) |
RuleNode: Fix calculation of changed inputs
The old code had a number of problems:
- It partially overlapped with the calculation of compatible inputs.
- It was wrong in that it failed to consider inputs from dependencies.
- It was wrong in that it assumed that after rule application, input
artifacts always have parent artifacts to later compare timestamps with.
This is not the case for e.g. a generated cpp file without a Q_OBJECT
macro on which moc is run: No transformer is created in such a case,
because the outputArtifacts array is empty.
The last problem was glossed over by the fact that we held a global list
of "changed source artifacts" in the executor, so such changes were
spotted when they happened in source artifacts. However, that code was
also rather dubious in itself because the criterion for "changed" was
that the timestamp was newer than it was on the last run of the
executor, so I don't think it was completely safe when doing partial
builds.
We solve these problems by remembering when we last applied the rule. An
input artifact is considered "changed" if it has been modified after
that.
Change-Id: Ib1bafd9e1078122776626155c4f2cc11ad622191
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata-qt')
4 files changed, 132 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/add-qobject-macro-to-generated-cpp-file.qbs b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/add-qobject-macro-to-generated-cpp-file.qbs new file mode 100644 index 000000000..e3eb72873 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/add-qobject-macro-to-generated-cpp-file.qbs @@ -0,0 +1,24 @@ +import qbs.File + +QtApplication { + files: ["main.cpp", "object.h"] + Group { + files: "object.cpp.in" + fileTags: "cpp.in" + } + Rule { + inputs: "cpp.in" + Artifact { + filePath: input.completeBaseName + fileTags: "cpp" + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "generatating " + output.fileName; + cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); } + return cmd; + } + } + cpp.includePaths: path +} + diff --git a/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/main.cpp b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/main.cpp new file mode 100644 index 000000000..3f57ddafb --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/main.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "object.h" + +int main() +{ + Object o; + o.f(); +} diff --git a/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.cpp.in b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.cpp.in new file mode 100644 index 000000000..b1b9922af --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.cpp.in @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <object.h> + +#include <QObject> + +// class InternalClass : public QObject +// { +// Q_OBJECT +// }; + +void Object::f() { } + + +// #include <object.moc> diff --git a/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.h b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.h new file mode 100644 index 000000000..5537a8d32 --- /dev/null +++ b/tests/auto/blackbox/testdata-qt/add-qobject-macro-to-generated-cpp-file/object.h @@ -0,0 +1,32 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +class Object { +public: + void f(); +}; |