summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/linguist/lupdate/main.cpp17
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/excluded.pro1
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp50
-rw-r--r--tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro3
4 files changed, 70 insertions, 1 deletions
diff --git a/src/linguist/lupdate/main.cpp b/src/linguist/lupdate/main.cpp
index 7229c9ca0..6af50f992 100644
--- a/src/linguist/lupdate/main.cpp
+++ b/src/linguist/lupdate/main.cpp
@@ -312,6 +312,19 @@ static QStringList getSources(const ProFileEvaluator &visitor, const QString &pr
return sourceFiles;
}
+static void excludeProjects(const ProFileEvaluator &visitor, QStringList *subProjects)
+{
+ foreach (const QString &ex, visitor.values(QLatin1String("TR_EXCLUDE"))) {
+ QRegExp rx(ex, Qt::CaseSensitive, QRegExp::Wildcard);
+ for (QStringList::Iterator it = subProjects->begin(); it != subProjects->end(); ) {
+ if (rx.exactMatch(*it))
+ it = subProjects->erase(it);
+ else
+ ++it;
+ }
+ }
+}
+
static void processSources(Translator &fetchedTor,
const QStringList &sourceFiles, ConversionData &cd)
{
@@ -380,9 +393,11 @@ static void processProject(
}
QString proPath = QFileInfo(proFile).path();
if (visitor.templateType() == ProFileEvaluator::TT_Subdirs) {
+ QStringList subProjects = visitor.values(QLatin1String("SUBDIRS"));
+ excludeProjects(visitor, &subProjects);
QStringList subProFiles;
QDir proDir(proPath);
- foreach (const QString &subdir, visitor.values(QLatin1String("SUBDIRS"))) {
+ foreach (const QString &subdir, subProjects) {
QString realdir = visitor.value(subdir + QLatin1String(".subdir"));
if (realdir.isEmpty())
realdir = visitor.value(subdir + QLatin1String(".file"));
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/excluded.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/excluded.pro
new file mode 100644
index 000000000..28dcadcbf
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/excluded.pro
@@ -0,0 +1 @@
+SOURCES += main.cpp
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp
new file mode 100644
index 000000000..cc99f9db4
--- /dev/null
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/excluded/main.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** 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 Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// IMPORTANT!!!! If you want to add testdata to this file,
+// always add it to the end in order to not change the linenumbers of translations!!!
+
+
+void func1() {
+ QString fake = QApplication::tr("fake", "This message will not be collected");
+}
+
+
diff --git a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro
index 13f921703..cad99dc61 100644
--- a/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro
+++ b/tests/auto/linguist/lupdate/testdata/good/proparsingsubs/project.pro
@@ -1,3 +1,6 @@
TEMPLATE = subdirs
comm.subdir = common
SUBDIRS = win mac unix comm
+
+SUBDIRS += excluded
+TR_EXCLUDE = excluded