diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2016-11-07 10:25:59 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2016-11-10 12:45:21 +0000 |
commit | e518441cf636a2839d58d23f9853dbcdeeaad85a (patch) | |
tree | bbd3e7fe088cc404b3ac8d592ab3622264823dce | |
parent | b0160eb96e47a20f2ac28b7dbb327c87460cb9da (diff) |
Let nested groups inherit the parent group's file tags
Tags should behave the same as module properties in that respect.
Change-Id: I5cbfde9c2cf90eef93feef0a8ffd894309341577
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | doc/reference/items/group.qdoc | 11 | ||||
-rw-r--r-- | src/lib/corelib/language/projectresolver.cpp | 8 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/auto-qrc/auto-qrc.qbs | 1 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/nested-groups/main3.cpp | 29 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata/nested-groups/nested-groups.qbs | 7 |
5 files changed, 48 insertions, 8 deletions
diff --git a/doc/reference/items/group.qdoc b/doc/reference/items/group.qdoc index b1aeb246b..139cc6f6d 100644 --- a/doc/reference/items/group.qdoc +++ b/doc/reference/items/group.qdoc @@ -94,8 +94,9 @@ Groups may also appear in modules, which causes the respective sources to be added to the products depending on said module. - Groups can be nested. In this case, child groups inherit the module properties of their parent - group. The condition of a child group gets logically ANDed with the one of its parent group. + Groups can be nested. In this case, child groups inherit the module properties and the file + tags of their parent group. The condition of a child group gets logically ANDed with the one + of its parent group. \section1 Group Properties @@ -143,10 +144,10 @@ \li bool \li true \li Determines how tags on files that are listed both at the top level of - a product and a group are handled. + a product (or the parent group, if there is one) and a group are handled. If this property is true, then the file tags set via the group - replace the ones set via the product. - If it is false, the "group tags" are added to the "product tags". + replace the ones set via the product or parent group. + If it is false, the "group tags" are added to the "parent tags". \row \li excludeFiles \li list diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index f6e390bff..f2910787f 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -670,8 +670,12 @@ void ProjectResolver::resolveGroup(Item *item, ProjectContext *projectContext) bool fileTagsSet; group->fileTags = m_evaluator->fileTagsValue(item, QLatin1String("fileTags"), &fileTagsSet); group->overrideTags = m_evaluator->boolValue(item, QLatin1String("overrideTags")); - if (group->overrideTags && group->fileTags.isEmpty() && fileTagsSet) - group->fileTags.insert(unknownFileTag()); + if (group->overrideTags && fileTagsSet) { + if (group->fileTags.isEmpty() ) + group->fileTags.insert(unknownFileTag()); + } else if (m_productContext->currentGroup) { + group->fileTags.unite(m_productContext->currentGroup->fileTags); + } const CodeLocation filesLocation = item->property(QLatin1String("files"))->location(); ErrorInfo fileError; diff --git a/tests/auto/blackbox/testdata/auto-qrc/auto-qrc.qbs b/tests/auto/blackbox/testdata/auto-qrc/auto-qrc.qbs index 499e8a373..2d0452d49 100644 --- a/tests/auto/blackbox/testdata/auto-qrc/auto-qrc.qbs +++ b/tests/auto/blackbox/testdata/auto-qrc/auto-qrc.qbs @@ -20,7 +20,6 @@ Project { Qt.core.resourceSourceBase: "qrc-base/subdir" files: ["resource2.txt"] - fileTags: ["qt.core.resource_data"] } } } diff --git a/tests/auto/blackbox/testdata/nested-groups/main3.cpp b/tests/auto/blackbox/testdata/nested-groups/main3.cpp new file mode 100644 index 000000000..e14f806b0 --- /dev/null +++ b/tests/auto/blackbox/testdata/nested-groups/main3.cpp @@ -0,0 +1,29 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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$ +** +****************************************************************************/ + +int main() { } diff --git a/tests/auto/blackbox/testdata/nested-groups/nested-groups.qbs b/tests/auto/blackbox/testdata/nested-groups/nested-groups.qbs index 64aa3703e..7ff4cf28b 100644 --- a/tests/auto/blackbox/testdata/nested-groups/nested-groups.qbs +++ b/tests/auto/blackbox/testdata/nested-groups/nested-groups.qbs @@ -7,6 +7,8 @@ CppApplication { Group { cpp.defines: ["REQUIRED_FOR_FILE1", "BREAKS_FILE2"] + fileTags: ["cpp"] + // This group has no files, and that's okay. Group { @@ -28,6 +30,11 @@ CppApplication { files: ["main2.cpp"] } } + Group { + name: "no tags" + fileTags: [] + files: ["main3.cpp"] + } } } } |