aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/module-providers/Qt/templates
diff options
context:
space:
mode:
Diffstat (limited to 'share/qbs/module-providers/Qt/templates')
-rw-r--r--share/qbs/module-providers/Qt/templates/android_support.qbs94
-rw-r--r--share/qbs/module-providers/Qt/templates/core.qbs9
-rw-r--r--share/qbs/module-providers/Qt/templates/dbus.js1
-rw-r--r--share/qbs/module-providers/Qt/templates/gui.qbs8
-rw-r--r--share/qbs/module-providers/Qt/templates/moc.js5
-rw-r--r--share/qbs/module-providers/Qt/templates/plugin_support.qbs2
-rw-r--r--share/qbs/module-providers/Qt/templates/qml.js25
-rw-r--r--share/qbs/module-providers/Qt/templates/qml.qbs2
-rw-r--r--share/qbs/module-providers/Qt/templates/quick.js9
-rw-r--r--share/qbs/module-providers/Qt/templates/quick.qbs4
-rw-r--r--share/qbs/module-providers/Qt/templates/rcc.js8
11 files changed, 141 insertions, 26 deletions
diff --git a/share/qbs/module-providers/Qt/templates/android_support.qbs b/share/qbs/module-providers/Qt/templates/android_support.qbs
index 3790037f3..68a29bb95 100644
--- a/share/qbs/module-providers/Qt/templates/android_support.qbs
+++ b/share/qbs/module-providers/Qt/templates/android_support.qbs
@@ -4,6 +4,7 @@ import qbs.ModUtils
import qbs.TextFile
import qbs.Utilities
import qbs.Process
+import qbs.Xml
Module {
version: @version@
@@ -35,10 +36,14 @@ Module {
property bool _multiAbi: Utilities.versionCompare(version, "5.14") >= 0
+ // QTBUG-87288: correct QtNetwork jar dependencies for 5.15.0 < Qt < 5.15.3
+ property bool _correctQtNetworkDependencies: Utilities.versionCompare(version, "5.15.0") > 0 &&
+ Utilities.versionCompare(version, "5.15.3") < 0
+
Depends { name: "Android.sdk"; condition: _enableSdkSupport }
Depends { name: "Android.ndk"; condition: _enableNdkSupport }
Depends { name: "java"; condition: _enableSdkSupport }
- Depends { name: "cpp" }
+ Depends { name: "cpp"; condition: _enableNdkSupport }
Properties {
condition: _enableNdkSupport && qbs.toolchain.contains("clang")
@@ -62,8 +67,10 @@ Module {
condition: _enableSdkSupport && Utilities.versionCompare(version, "6.0") >= 0
java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "Qt6Android.jar")]
}
+ // "ANDROID_HAS_WSTRING" was removed from qtcore qstring.h in Qt 5.14.0
Properties {
- condition: _enableNdkSupport && (Android.ndk.abi === "armeabi-v7a" || Android.ndk.abi === "x86")
+ condition: _enableNdkSupport && Utilities.versionCompare(version, "5.14.0") < 0 &&
+ (Android.ndk.abi === "armeabi-v7a" || Android.ndk.abi === "x86")
cpp.defines: "ANDROID_HAS_WSTRING"
}
Properties {
@@ -78,7 +85,11 @@ Module {
condition: _enableSdkSupport && Utilities.versionCompare(version, "6.0") >= 0
Android.sdk.minimumVersion: "23"
}
- cpp.archSuffix: _multiAbi ? "_" + Android.ndk.abi : ""
+
+ Properties {
+ condition: _enableNdkSupport
+ cpp.archSuffix: _multiAbi ? "_" + Android.ndk.abi : ""
+ }
Rule {
condition: _enableSdkSupport
@@ -191,7 +202,7 @@ Module {
var prefixDirs = product.Qt.android_support.extraPrefixDirs;
if (prefixDirs && prefixDirs.length > 0)
f.writeLine('"extraPrefixDirs": ' + JSON.stringify(prefixDirs) + ',');
- if (Array.isArray(product.qmlImportPaths) && product.qmlImportPaths.length > 0)
+ if ((product.qmlImportPaths instanceof Array) && product.qmlImportPaths.length > 0)
f.writeLine('"qml-import-paths": "' + product.qmlImportPaths.join(',') + '",');
if (Utilities.versionCompare(product.Qt.android_support.version, "6.0") >= 0) {
@@ -349,8 +360,6 @@ Module {
var moveCmd = new JavaScriptCommand();
moveCmd.description = "processing androiddeployqt outout";
moveCmd.sourceCode = function() {
- File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml",
- outputs["android.manifest_final"][0].filePath);
var libsDir = product.Qt.android_support._deployQtOutDir + "/libs";
var libDir = product.Android.sdk.packageContentsDir + "/lib";
var listFilePath = outputs["android.deployqt_list"][0].filePath;
@@ -394,7 +403,78 @@ Module {
File.remove(oldLibs[i]);
}
};
- return [copyCmd, androidDeployQtCmd, moveCmd];
+
+ var correctingCmd = new JavaScriptCommand();
+ if (product.Qt.android_support._correctQtNetworkDependencies) {
+ correctingCmd.description = "correcting network jar dependency";
+ correctingCmd.sourceCode = function() {
+ var findNetworkLib = function() {
+ var libsDir = product.Android.sdk.packageContentsDir + "/lib";
+ var dirList = File.directoryEntries(libsDir, File.Dirs |
+ File.NoDotAndDotDot);
+ for (var i = 0; i < dirList.length; ++i) {
+ var archDir = FileInfo.joinPaths(libsDir, dirList[i]);
+ var fileList = File.directoryEntries(archDir, File.Files);
+ if (fileList) {
+ for (var j = 0; j < fileList.length; ++j) {
+ if (fileList[j].contains("libQt5Network")) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ if (findNetworkLib()) {
+ var manifestData = new Xml.DomDocument();
+ var manifestFilePath = product.Qt.android_support._deployQtOutDir +
+ "/AndroidManifest.xml"
+ manifestData.load(manifestFilePath);
+
+ var rootElem = manifestData.documentElement();
+ if (!rootElem || !rootElem.isElement() || rootElem.tagName() != "manifest")
+ throw "No manifest tag found in '" + manifestFilePath + "'.";
+ var appElem = rootElem.firstChild("application");
+ if (!appElem || !appElem.isElement() || appElem.tagName() != "application")
+ throw "No application tag found in '" + manifestFilePath + "'.";
+ var activityElem = appElem.firstChild("activity");
+ if (!activityElem || !activityElem.isElement() ||
+ activityElem.tagName() != "activity")
+ throw "No activity tag found in '" + manifestFilePath + "'.";
+ var metaDataElem = activityElem.firstChild("meta-data");
+ while (metaDataElem && metaDataElem.isElement()) {
+ if (metaDataElem.attribute("android:name") ==
+ "android.app.load_local_jars" ) {
+ var value = metaDataElem.attribute("android:value");
+ var fileName = "QtAndroidNetwork.jar";
+ metaDataElem.setAttribute("android:value", value + ":jar/" +
+ fileName);
+ var jarFilePath = FileInfo.joinPaths(
+ product.Qt.android_support._qtInstallDir, "jar",
+ fileName);
+ var targetFilePath = FileInfo.joinPaths(product.java.classFilesDir,
+ fileName);
+ File.copy(jarFilePath, targetFilePath);
+ break;
+ }
+ metaDataElem = metaDataElem.nextSibling("meta-data");
+ }
+ manifestData.save(outputs["android.manifest_final"][0].filePath, 4);
+ } else {
+ File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml",
+ outputs["android.manifest_final"][0].filePath);
+ }
+ };
+ } else {
+ correctingCmd.description = "copying manifest";
+ correctingCmd.sourceCode = function() {
+ File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml",
+ outputs["android.manifest_final"][0].filePath);
+ }
+ }
+
+ return [copyCmd, androidDeployQtCmd, moveCmd, correctingCmd];
}
}
diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs
index 8f0b0e2df..2e810eeed 100644
--- a/share/qbs/module-providers/Qt/templates/core.qbs
+++ b/share/qbs/module-providers/Qt/templates/core.qbs
@@ -5,6 +5,7 @@ import qbs.Utilities
import qbs.Xml
import "moc.js" as Moc
import "qdoc.js" as Qdoc
+import "rcc.js" as Rcc
Module {
condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild)
@@ -41,12 +42,14 @@ Module {
property path installPath: @installPath@
property path incPath: @incPath@
property path libPath: @libPath@
+ property path libExecPath: @libExecPath@
property path pluginPath: @pluginPath@
property string mkspecName: @mkspecName@
property path mkspecPath: @mkspecPath@
property string mocName: "moc"
property stringList mocFlags: []
property string lreleaseName: "lrelease"
+ property string rccName: "rcc"
property string qdocName: versionMajor >= 5 ? "qdoc" : "qdoc3"
property stringList qdocEnvironment
property path docPath: @docPath@
@@ -433,7 +436,7 @@ Module {
"-o", output.filePath];
if (input.Qt.core.enableBigResources)
args.push("-pass", "1");
- var cmd = new Command(product.Qt.core.binPath + '/rcc', args);
+ var cmd = new Command(Rcc.fullPath(product), args);
cmd.description = "rcc "
+ (input.Qt.core.enableBigResources ? "(pass 1) " : "")
+ input.fileName;
@@ -445,7 +448,7 @@ Module {
Rule {
inputs: ["intermediate_obj"]
Artifact {
- filePath: input.completeBaseName + ".2.o"
+ filePath: input.completeBaseName + ".2" + input.cpp.objectSuffix
fileTags: ["obj"]
}
prepare: {
@@ -464,7 +467,7 @@ Module {
}
var qrcArtifact = findChild(input, function(c) { return c.fileTags.contains("qrc"); });
var cppArtifact = findChild(input, function(c) { return c.fileTags.contains("cpp"); });
- var cmd = new Command(product.Qt.core.binPath + '/rcc',
+ var cmd = new Command(Rcc.fullPath(product),
[qrcArtifact.filePath,
"-temp", input.filePath,
"-name", FileInfo.completeBaseName(input.filePath),
diff --git a/share/qbs/module-providers/Qt/templates/dbus.js b/share/qbs/module-providers/Qt/templates/dbus.js
index 0674bf684..3cdd6fb90 100644
--- a/share/qbs/module-providers/Qt/templates/dbus.js
+++ b/share/qbs/module-providers/Qt/templates/dbus.js
@@ -29,6 +29,7 @@
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
+var ModUtils = require("qbs.ModUtils");
function outputFileName(input, suffix)
{
diff --git a/share/qbs/module-providers/Qt/templates/gui.qbs b/share/qbs/module-providers/Qt/templates/gui.qbs
index a3c427175..1d45c6f1e 100644
--- a/share/qbs/module-providers/Qt/templates/gui.qbs
+++ b/share/qbs/module-providers/Qt/templates/gui.qbs
@@ -23,9 +23,11 @@ QtModule {
}
prepare: {
- var cmd = new Command(ModUtils.moduleProperty(product, "binPath") + '/'
- + ModUtils.moduleProperty(product, "uicName"),
- [input.filePath, '-o', output.filePath])
+ var uicPath = Utilities.versionCompare(product.Qt.gui.version, "6.1") < 0
+ ? product.Qt.core.binPath + '/' + product.Qt.gui.uicName
+ : product.Qt.core.libExecPath + '/' + product.Qt.gui.uicName;
+
+ var cmd = new Command(uicPath, [input.filePath, '-o', output.filePath]);
cmd.description = 'uic ' + input.fileName;
cmd.highlight = 'codegen';
return cmd;
diff --git a/share/qbs/module-providers/Qt/templates/moc.js b/share/qbs/module-providers/Qt/templates/moc.js
index 92983e4f7..7d230267c 100644
--- a/share/qbs/module-providers/Qt/templates/moc.js
+++ b/share/qbs/module-providers/Qt/templates/moc.js
@@ -29,6 +29,7 @@
****************************************************************************/
var ModUtils = require("qbs.ModUtils");
+var Utilities = require("qbs.Utilities");
function args(product, input, outputs)
{
@@ -78,7 +79,9 @@ function args(product, input, outputs)
function fullPath(product)
{
- return product.Qt.core.binPath + '/' + product.Qt.core.mocName;
+ if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0)
+ return product.Qt.core.binPath + '/' + product.Qt.core.mocName;
+ return product.Qt.core.libExecPath + '/' + product.Qt.core.mocName;
}
function outputArtifacts(project, product, inputs, input)
diff --git a/share/qbs/module-providers/Qt/templates/plugin_support.qbs b/share/qbs/module-providers/Qt/templates/plugin_support.qbs
index 1de923f17..19a739589 100644
--- a/share/qbs/module-providers/Qt/templates/plugin_support.qbs
+++ b/share/qbs/module-providers/Qt/templates/plugin_support.qbs
@@ -32,7 +32,7 @@ Module {
newValue = [];
else if (typeof newValue == "string")
newValue = [newValue];
- if (!Array.isArray(newValue))
+ if (!newValue instanceof Array)
throw "Invalid value '" + newValue + "' in Qt.plugin_support.pluginsByType";
eppt[pluginType] = (eppt[pluginType] || []).uniqueConcat(newValue);
}
diff --git a/share/qbs/module-providers/Qt/templates/qml.js b/share/qbs/module-providers/Qt/templates/qml.js
index df69034fe..e48c9230e 100644
--- a/share/qbs/module-providers/Qt/templates/qml.js
+++ b/share/qbs/module-providers/Qt/templates/qml.js
@@ -3,14 +3,31 @@ var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
var TextFile = require("qbs.TextFile");
-function scannerData(scannerFilePath, qmlFiles, qmlPath)
+function scannerData(scannerFilePath, qmlFiles, qmlPath, targetOS)
{
var p;
try {
p = new Process();
- p.exec(scannerFilePath, ["-qmlFiles"].concat(qmlFiles).concat(["-importPath", qmlPath]),
- true);
- return JSON.parse(p.readStdOut());
+ if (!targetOS.contains("windows")) {
+ p.exec(scannerFilePath, ["-qmlFiles"].concat(qmlFiles).concat(["-importPath", qmlPath]),
+ true);
+ return JSON.parse(p.readStdOut());
+ }
+ var data = [];
+ var nextFileIndex = 0;
+ while (nextFileIndex < qmlFiles.length) {
+ var currentFileList = [];
+ var currentFileListStringLength = 0;
+ while (nextFileIndex < qmlFiles.length && currentFileListStringLength < 30000) {
+ var currentFile = qmlFiles[nextFileIndex++];
+ currentFileList.push(currentFile);
+ currentFileListStringLength += currentFile.length;
+ }
+ p.exec(scannerFilePath, ["-qmlFiles"].concat(currentFileList)
+ .concat(["-importPath", qmlPath]), true);
+ data = data.concat(JSON.parse(p.readStdOut()));
+ }
+ return data;
} finally {
if (p)
p.close();
diff --git a/share/qbs/module-providers/Qt/templates/qml.qbs b/share/qbs/module-providers/Qt/templates/qml.qbs
index f608ba4dd..af7b0fb5f 100644
--- a/share/qbs/module-providers/Qt/templates/qml.qbs
+++ b/share/qbs/module-providers/Qt/templates/qml.qbs
@@ -144,7 +144,7 @@ QtModule {
qmlInputs = [];
var scannerData = Qml.scannerData(product.Qt.qml.qmlImportScannerFilePath,
qmlInputs.map(function(inp) { return inp.filePath; }),
- product.Qt.qml.qmlPath);
+ product.Qt.qml.qmlPath, product.qbs.targetOS);
var cppFile;
var listFile;
try {
diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js
index 4f3da2fb0..ad433736c 100644
--- a/share/qbs/module-providers/Qt/templates/quick.js
+++ b/share/qbs/module-providers/Qt/templates/quick.js
@@ -30,13 +30,14 @@
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
+var Rcc = require("rcc.js");
-function scanQrc(qrcFilePath) {
+function scanQrc(product, qrcFilePath) {
var absInputDir = FileInfo.path(qrcFilePath);
var result = [];
var process = new Process();
try {
- var rcc = FileInfo.joinPaths(product.Qt.core.binPath, 'rcc' + product.cpp.executableSuffix);
+ var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + product.cpp.executableSuffix);
var exitCode = process.exec(rcc, ["--list", qrcFilePath], true);
for (;;) {
var line = process.readLine();
@@ -65,8 +66,8 @@ function qtQuickResourceFileOutputName(fileName) {
return fileName.replace(/\.qrc$/, "_qtquickcompiler.qrc");
}
-function contentFromQrc(qrcFilePath) {
- var filesInQrc = scanQrc(qrcFilePath);
+function contentFromQrc(product, qrcFilePath) {
+ var filesInQrc = scanQrc(product, qrcFilePath);
var qmlJsFiles = filesInQrc.filter(function (filePath) {
return (/\.(js|qml)$/).test(filePath);
} );
diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs
index bf04fe869..ac3ab5b26 100644
--- a/share/qbs/module-providers/Qt/templates/quick.qbs
+++ b/share/qbs/module-providers/Qt/templates/quick.qbs
@@ -79,7 +79,7 @@ QtModule {
condition: useCompiler
inputs: 'qt.quick.qrc'
searchPaths: [FileInfo.path(input.filePath)]
- scan: QC.scanQrc(input.filePath)
+ scan: QC.scanQrc(product, input.filePath)
}
FileTagger {
@@ -100,7 +100,7 @@ QtModule {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() {
- var content = QC.contentFromQrc(input.filePath);
+ var content = QC.contentFromQrc(product, input.filePath);
content.qrcFilePath = input.filePath;
var tf = new TextFile(output.filePath, TextFile.WriteOnly);
diff --git a/share/qbs/module-providers/Qt/templates/rcc.js b/share/qbs/module-providers/Qt/templates/rcc.js
new file mode 100644
index 000000000..89c57d99b
--- /dev/null
+++ b/share/qbs/module-providers/Qt/templates/rcc.js
@@ -0,0 +1,8 @@
+var Utilities = require("qbs.Utilities");
+
+function fullPath(product)
+{
+ if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0)
+ return product.Qt.core.binPath + '/' + product.Qt.core.rccName;
+ return product.Qt.core.libExecPath + '/' + product.Qt.core.rccName;
+}