summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mkspecs/features/android/android_deployment_settings.prf16
-rw-r--r--src/tools/androiddeployqt/main.cpp35
2 files changed, 39 insertions, 12 deletions
diff --git a/mkspecs/features/android/android_deployment_settings.prf b/mkspecs/features/android/android_deployment_settings.prf
index 4d6101e297..e781eb024c 100644
--- a/mkspecs/features/android/android_deployment_settings.prf
+++ b/mkspecs/features/android/android_deployment_settings.prf
@@ -63,6 +63,22 @@ contains(TEMPLATE, ".*app"):!build_pass:!android-embedded {
QML_ROOT_PATH = $$_PRO_FILE_PWD_
FILE_CONTENT += " \"qml-root-path\": $$emitString($$QML_ROOT_PATH),"
FILE_CONTENT += " \"stdcpp-path\": $$emitString($$ANDROID_STDCPP_PATH),"
+ !isEmpty(RESOURCES) {
+ # Make sure that qmake generated qrc files are accounted for
+ load(resources_functions)
+ qtFlattenResources()
+ for(resource, RESOURCES) {
+ contains(resource, ".*\\qmake_qmake_immediate.qrc$") {
+ # They will be created for each architecture, since they could be different
+ # we need to account for all of them
+ for (arch, ANDROID_ABIS): \
+ rescopy += $$absolute_path("qmake_qmake_immediate.qrc", $$OUT_PWD/$$arch)
+ } else {
+ contains(resource, ".*\\.qrc$"): rescopy += $$absolute_path($$resource, $$_PRO_FILE_PWD_)
+ }
+ }
+ FILE_CONTENT += " \"qrcFiles\": $$emitString($$join(rescopy, ",")),"
+ }
FILE_CONTENT += ""
FILE_CONTENT += " \"application-binary\": $$emitString($$TARGET)"
FILE_CONTENT += "}"
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp
index feecfba8fb..550ed0832f 100644
--- a/src/tools/androiddeployqt/main.cpp
+++ b/src/tools/androiddeployqt/main.cpp
@@ -164,6 +164,7 @@ struct Options
QString applicationBinary;
QString rootPath;
QStringList qmlImportPaths;
+ QStringList qrcFiles;
// Versioning
QString versionName;
@@ -976,7 +977,10 @@ bool readInputFile(Options *options)
}
}
}
-
+ {
+ const QJsonValue qrcFiles = jsonObject.value(QLatin1String("qrcFiles"));
+ options->qrcFiles = qrcFiles.toString().split(QLatin1Char(','), QString::SkipEmptyParts);
+ }
options->packageName = packageNameFromAndroidManifest(options->androidSourceDirectory + QLatin1String("/AndroidManifest.xml"));
if (options->packageName.isEmpty())
options->packageName = cleanPackageName(QLatin1String("org.qtproject.example.%1").arg(options->applicationBinary));
@@ -1709,22 +1713,28 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
}
QString rootPath = options->rootPath;
- if (rootPath.isEmpty())
- rootPath = QFileInfo(options->inputFileName).absolutePath();
- else
- rootPath = QFileInfo(rootPath).absoluteFilePath();
+ if (!options->qrcFiles.isEmpty()) {
+ qmlImportScanner += QLatin1String(" -qrcFiles");
+ for (const QString &qrcFile : options->qrcFiles)
+ qmlImportScanner += QLatin1Char(' ') + shellQuote(qrcFile);
+ } else {
+ if (rootPath.isEmpty())
+ rootPath = QFileInfo(options->inputFileName).absolutePath();
+ else
+ rootPath = QFileInfo(rootPath).absoluteFilePath();
- if (!rootPath.endsWith(QLatin1Char('/')))
- rootPath += QLatin1Char('/');
+ if (!rootPath.endsWith(QLatin1Char('/')))
+ rootPath += QLatin1Char('/');
+ qmlImportScanner += QLatin1String(" -rootPath %1").arg(shellQuote(rootPath));
+ }
QStringList importPaths;
importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml"));
- importPaths += shellQuote(rootPath);
+ if (!rootPath.isEmpty())
+ importPaths += shellQuote(rootPath);
for (const QString &qmlImportPath : qAsConst(options->qmlImportPaths))
importPaths += shellQuote(qmlImportPath);
-
- qmlImportScanner += QLatin1String(" -rootPath %1 -importPath %2")
- .arg(shellQuote(rootPath), importPaths.join(QLatin1Char(' ')));
+ qmlImportScanner += QLatin1String(" -importPath %1").arg(importPaths.join(QLatin1Char(' ')));
if (options->verbose) {
fprintf(stdout, "Running qmlimportscanner with the following command: %s\n",
@@ -1946,7 +1956,8 @@ bool readDependencies(Options *options)
}
}
- if (!options->rootPath.isEmpty() && !scanImports(options, &usedDependencies))
+ if ((!options->rootPath.isEmpty() || options->qrcFiles.isEmpty()) &&
+ !scanImports(options, &usedDependencies))
return false;
return true;