aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qmlcompiler/CMakeLists.txt1
-rw-r--r--src/qmlcompiler/qmlcompiler.pro6
-rw-r--r--src/qmlcompiler/qresourcerelocater.cpp (renamed from tools/qmlcachegen/resourcefilter.cpp)14
-rw-r--r--src/qmlcompiler/qresourcerelocater_p.h50
-rw-r--r--tools/qmlcachegen/.prev_CMakeLists.txt1
-rw-r--r--tools/qmlcachegen/CMakeLists.txt1
-rw-r--r--tools/qmlcachegen/qmlcachegen.cpp7
-rw-r--r--tools/qmlcachegen/qmlcachegen.pro1
8 files changed, 70 insertions, 11 deletions
diff --git a/src/qmlcompiler/CMakeLists.txt b/src/qmlcompiler/CMakeLists.txt
index d0e9be9418..f2180f35cd 100644
--- a/src/qmlcompiler/CMakeLists.txt
+++ b/src/qmlcompiler/CMakeLists.txt
@@ -17,6 +17,7 @@ qt_internal_add_module(QmlCompiler
qqmljsstreamwriter.cpp qqmljsstreamwriter_p.h
qqmljstypedescriptionreader.cpp qqmljstypedescriptionreader_p.h
qqmljstypereader.cpp qqmljstypereader_p.h
+ qresourcerelocater.cpp qresourcerelocater_p.h
PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::QmlDevToolsPrivate
diff --git a/src/qmlcompiler/qmlcompiler.pro b/src/qmlcompiler/qmlcompiler.pro
index 37a1b44b9c..a8c81af081 100644
--- a/src/qmlcompiler/qmlcompiler.pro
+++ b/src/qmlcompiler/qmlcompiler.pro
@@ -10,7 +10,8 @@ SOURCES = \
qqmljstypereader.cpp \
qqmljsscope.cpp \
qqmljstypedescriptionreader.cpp \
- qqmljsstreamwriter.cpp
+ qqmljsstreamwriter.cpp \
+ qresourcerelocater.cpp
HEADERS = \
qdeferredpointer_p.h \
@@ -21,6 +22,7 @@ HEADERS = \
qqmljsmetatypes_p.h \
qqmljsscope_p.h \
qqmljstypedescriptionreader_p.h \
- qqmljsstreamwriter_p.h
+ qqmljsstreamwriter_p.h \
+ qresourcerelocater_p.h
load(qt_module)
diff --git a/tools/qmlcachegen/resourcefilter.cpp b/src/qmlcompiler/qresourcerelocater.cpp
index 37c027c365..89158c1446 100644
--- a/tools/qmlcachegen/resourcefilter.cpp
+++ b/src/qmlcompiler/qresourcerelocater.cpp
@@ -25,12 +25,20 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include <QString>
+
+#include "qresourcerelocater_p.h"
+
#include <QXmlStreamReader>
#include <QFile>
#include <QDir>
-int filterResourceFile(const QString &input, const QString &output)
+QT_BEGIN_NAMESPACE
+
+/*!
+ Changes all the paths in resource file \a input so that they are relative to
+ location \a output and writes the result to resource file \a output.
+ */
+int qRelocateResourceFile(const QString &input, const QString &output)
{
enum State {
InitialState,
@@ -170,3 +178,5 @@ int filterResourceFile(const QString &input, const QString &output)
return EXIT_SUCCESS;
}
+
+QT_END_NAMESPACE
diff --git a/src/qmlcompiler/qresourcerelocater_p.h b/src/qmlcompiler/qresourcerelocater_p.h
new file mode 100644
index 0000000000..5b75a424e6
--- /dev/null
+++ b/src/qmlcompiler/qresourcerelocater_p.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** $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$
+**
+****************************************************************************/
+
+#ifndef QRESOURCERELOCATER_P_H
+#define QRESOURCERELOCATER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+int qRelocateResourceFile(const QString &input, const QString &output);
+
+QT_END_NAMESPACE
+
+#endif // QRESOURCERELOCATER_P_H
diff --git a/tools/qmlcachegen/.prev_CMakeLists.txt b/tools/qmlcachegen/.prev_CMakeLists.txt
index 78e63898ac..687ece89a1 100644
--- a/tools/qmlcachegen/.prev_CMakeLists.txt
+++ b/tools/qmlcachegen/.prev_CMakeLists.txt
@@ -10,7 +10,6 @@ qt_internal_add_tool(${target_name}
SOURCES
generateloader.cpp
qmlcachegen.cpp
- resourcefilter.cpp
DEFINES
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_TO_ASCII
diff --git a/tools/qmlcachegen/CMakeLists.txt b/tools/qmlcachegen/CMakeLists.txt
index 9903406fab..e81eae7dfb 100644
--- a/tools/qmlcachegen/CMakeLists.txt
+++ b/tools/qmlcachegen/CMakeLists.txt
@@ -11,7 +11,6 @@ qt_internal_add_tool(${target_name}
SOURCES
generateloader.cpp
qmlcachegen.cpp
- resourcefilter.cpp
DEFINES
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_TO_ASCII
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp
index 04d31d8887..ca68e7e450 100644
--- a/tools/qmlcachegen/qmlcachegen.cpp
+++ b/tools/qmlcachegen/qmlcachegen.cpp
@@ -41,12 +41,12 @@
#include <private/qqmljsparser_p.h>
#include <private/qqmljslexer_p.h>
#include <private/qqmljsresourcefilemapper_p.h>
+#include <private/qresourcerelocater_p.h>
#include <algorithm>
using namespace QQmlJS;
-int filterResourceFile(const QString &input, const QString &output);
bool generateLoader(const QStringList &compiledFiles, const QString &output,
const QStringList &resourceFileMappings, QString *errorString);
QString symbolNamespaceForPath(const QString &relativePath);
@@ -507,9 +507,8 @@ int main(int argc, char **argv)
if (outputFileName.isEmpty())
outputFileName = inputFile + QLatin1Char('c');
- if (parser.isSet(filterResourceFileOption)) {
- return filterResourceFile(inputFile, outputFileName);
- }
+ if (parser.isSet(filterResourceFileOption))
+ return qRelocateResourceFile(inputFile, outputFileName);
if (target == GenerateLoader) {
QQmlJSResourceFileMapper mapper(sources);
diff --git a/tools/qmlcachegen/qmlcachegen.pro b/tools/qmlcachegen/qmlcachegen.pro
index 530a0d54a1..1305d8fe65 100644
--- a/tools/qmlcachegen/qmlcachegen.pro
+++ b/tools/qmlcachegen/qmlcachegen.pro
@@ -5,7 +5,6 @@ DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
SOURCES = \
qmlcachegen.cpp \
- resourcefilter.cpp \
generateloader.cpp
TARGET = qmlcachegen