aboutsummaryrefslogtreecommitdiffstats
path: root/tools/qmlcachegen/qmlcachegen.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-10-20 15:07:59 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-10-23 13:31:14 +0200
commit2458f07eb568dc13f1f92b77adc047ef129a5636 (patch)
tree3a0c2081d39465dc24399704eb7e2c6db4c2718b /tools/qmlcachegen/qmlcachegen.cpp
parentf263e6ac9321d1f1b0fc4e46371642a2dbe85262 (diff)
Move generateloader.cpp to QmlCompiler
We need to be able to generate the loader code from multiple places. Change-Id: I9e04fd3583b535bc5f7d5fb293cb61309c1e199a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qmlcachegen/qmlcachegen.cpp')
-rw-r--r--tools/qmlcachegen/qmlcachegen.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp
index ca68e7e450..33a77bc835 100644
--- a/tools/qmlcachegen/qmlcachegen.cpp
+++ b/tools/qmlcachegen/qmlcachegen.cpp
@@ -41,16 +41,13 @@
#include <private/qqmljsparser_p.h>
#include <private/qqmljslexer_p.h>
#include <private/qqmljsresourcefilemapper_p.h>
+#include <private/qqmljsloadergenerator_p.h>
#include <private/qresourcerelocater_p.h>
#include <algorithm>
using namespace QQmlJS;
-bool generateLoader(const QStringList &compiledFiles, const QString &output,
- const QStringList &resourceFileMappings, QString *errorString);
-QString symbolNamespaceForPath(const QString &relativePath);
-
QSet<QString> illegalNames;
void setupIllegalNames()
@@ -392,7 +389,7 @@ static bool saveUnitAsCpp(const QString &inputFileName, const QString &outputFil
if (!writeStr(QByteArrayLiteral("namespace QmlCacheGeneratedCode {\nnamespace ")))
return false;
- if (!writeStr(symbolNamespaceForPath(inputFileName).toUtf8()))
+ if (!writeStr(qQmlJSSymbolNamespaceForPath(inputFileName).toUtf8()))
return false;
if (!writeStr(QByteArrayLiteral(" {\nextern const unsigned char qmlData alignas(16) [] = {\n")))
@@ -514,8 +511,8 @@ int main(int argc, char **argv)
QQmlJSResourceFileMapper mapper(sources);
Error error;
- if (!generateLoader(mapper.qmlCompilerFiles(), outputFileName,
- parser.values(resourceFileMappingOption), &error.message)) {
+ if (!qQmlJSGenerateLoader(mapper.qmlCompilerFiles(), outputFileName,
+ parser.values(resourceFileMappingOption), &error.message)) {
error.augment(QLatin1String("Error generating loader stub: ")).print();
return EXIT_FAILURE;
}
@@ -524,8 +521,8 @@ int main(int argc, char **argv)
if (target == GenerateLoaderStandAlone) {
Error error;
- if (!generateLoader(sources, outputFileName,
- parser.values(resourceNameOption), &error.message)) {
+ if (!qQmlJSGenerateLoader(sources, outputFileName,
+ parser.values(resourceNameOption), &error.message)) {
error.augment(QLatin1String("Error generating loader stub: ")).print();
return EXIT_FAILURE;
}