diff options
author | Ivan Komissarov <abbapoh@gmail.com> | 2021-10-04 17:56:38 +0300 |
---|---|---|
committer | Ivan Komissarov <abbapoh@gmail.com> | 2021-10-04 17:56:38 +0300 |
commit | 5cff551ade30b75fe97b2080d3c3a29ce1bcb928 (patch) | |
tree | f5c2d12aebf37765709403752b0e356fa282acd8 /share | |
parent | 2cce00b94de5a9c40052a0da0630bf354160e531 (diff) | |
parent | 0fcbccb1f7859dca5b9011cee901494b6e056743 (diff) | |
download | qbs-5cff551ade30b75fe97b2080d3c3a29ce1bcb928.tar.gz |
Merge branch '1.20' into master
Change-Id: Ibb0fdf6dc13d05c5ee45035713a631fdbfa341ad
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/module-providers/Qt/templates/android_support.qbs | 37 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/quick.js | 3 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/quick.qbs | 6 | ||||
-rw-r--r-- | share/qbs/modules/Android/sdk/sdk.qbs | 4 | ||||
-rw-r--r-- | share/qbs/modules/Android/sdk/utils.js | 17 |
5 files changed, 60 insertions, 7 deletions
diff --git a/share/qbs/module-providers/Qt/templates/android_support.qbs b/share/qbs/module-providers/Qt/templates/android_support.qbs index a1975b890..80315621e 100644 --- a/share/qbs/module-providers/Qt/templates/android_support.qbs +++ b/share/qbs/module-providers/Qt/templates/android_support.qbs @@ -311,6 +311,7 @@ Module { } ] prepare: { + var cmds = []; var copyCmd = new JavaScriptCommand(); copyCmd.description = "copying Qt resource templates"; copyCmd.sourceCode = function() { @@ -337,6 +338,8 @@ Module { } } }; + cmds.push(copyCmd); + var androidDeployQtArgs = [ "--output", product.Qt.android_support._deployQtOutDir, "--input", inputs["qt_androiddeployqt_input"][0].filePath, "--aux-mode", @@ -348,6 +351,7 @@ Module { var androidDeployQtCmd = new Command( product.Qt.android_support._androidDeployQtFilePath, androidDeployQtArgs); androidDeployQtCmd.description = "running androiddeployqt"; + cmds.push(androidDeployQtCmd); // We do not want androiddeployqt to write directly into our APK base dir, so // we ran it on an isolated directory and now we move stuff over. @@ -355,7 +359,7 @@ Module { // of androiddeployqt creates fewer files, the other ones are removed from // the APK base dir. var moveCmd = new JavaScriptCommand(); - moveCmd.description = "processing androiddeployqt outout"; + moveCmd.description = "processing androiddeployqt output"; moveCmd.sourceCode = function() { File.makePath(product.java.classFilesDir); var libsDir = product.Qt.android_support._deployQtOutDir + "/libs"; @@ -401,6 +405,34 @@ Module { File.remove(oldLibs[i]); } }; + cmds.push(moveCmd); + + // androiddeployqt doesn't strip the deployed libraries anymore so it has to done here + // but only for release build + if (product.qbs.buildVariant == "release") { + var stripLibsCmd = new JavaScriptCommand(); + stripLibsCmd.description = "stripping unneeded symbols from deployed qt libraries"; + stripLibsCmd.sourceCode = function() { + var stripArgs = ["--strip-all"]; + var architectures = []; + for (var i in inputs["android.nativelibrary"]) + architectures.push(inputs["android.nativelibrary"][i].Android.ndk.abi); + for (var i in architectures) { + var abiDirPath = FileInfo.joinPaths(product.Android.sdk.packageContentsDir, + "lib", architectures[i]); + var files = File.directoryEntries(abiDirPath, File.Files); + for (var i = 0; i < files.length; ++i) { + var filePath = FileInfo.joinPaths(abiDirPath, files[i]); + if (FileInfo.suffix(filePath) == "so") { + stripArgs.push(filePath); + } + } + } + var process = new Process(); + process.exec(product.cpp.stripPath, stripArgs, false); + } + cmds.push(stripLibsCmd); + } var correctingCmd = new JavaScriptCommand(); if (product.Qt.android_support._correctQtNetworkDependencies) { @@ -471,8 +503,9 @@ Module { outputs["android.manifest_final"][0].filePath); } } + cmds.push(correctingCmd); - return [copyCmd, androidDeployQtCmd, moveCmd, correctingCmd]; + return cmds; } } diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js index ad433736c..ec1402345 100644 --- a/share/qbs/module-providers/Qt/templates/quick.js +++ b/share/qbs/module-providers/Qt/templates/quick.js @@ -67,12 +67,13 @@ function qtQuickResourceFileOutputName(fileName) { } function contentFromQrc(product, qrcFilePath) { + var supportsFiltering = product.Qt.quick._supportsQmlJsFiltering; var filesInQrc = scanQrc(product, qrcFilePath); var qmlJsFiles = filesInQrc.filter(function (filePath) { return (/\.(js|qml)$/).test(filePath); } ); var content = {}; - if (filesInQrc.length - qmlJsFiles.length > 0) { + if (!supportsFiltering || filesInQrc.length - qmlJsFiles.length > 0) { content.newQrcFileName = qtQuickResourceFileOutputName(input.fileName); } content.qmlJsFiles = qmlJsFiles.map(function (filePath) { diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs index ac3ab5b26..00174150e 100644 --- a/share/qbs/module-providers/Qt/templates/quick.qbs +++ b/share/qbs/module-providers/Qt/templates/quick.qbs @@ -66,6 +66,8 @@ QtModule { readonly property bool _compilerIsQmlCacheGen: Utilities.versionCompare(Qt.core.version, "5.11") >= 0 + readonly property bool _supportsQmlJsFiltering: Utilities.versionCompare(Qt.core.version, + "5.15") < 0 readonly property string _generatedLoaderFileName: _compilerIsQmlCacheGen ? "qmlcache_loader.cpp" : "qtquickcompiler_loader.cpp" @@ -174,7 +176,9 @@ QtModule { if (info.newQrcFileName) { loaderFlags.push("--resource-file-mapping=" + FileInfo.fileName(info.qrcFilePath) - + ":" + info.newQrcFileName); + + '=' + info.newQrcFileName); + // Qt 5.15 doesn't really filter anyting but merely copies the qrc + // content to the new location var args = ["--filter-resource-file", info.qrcFilePath]; if (useCacheGen) diff --git a/share/qbs/modules/Android/sdk/sdk.qbs b/share/qbs/modules/Android/sdk/sdk.qbs index b284c1f8f..c52b54664 100644 --- a/share/qbs/modules/Android/sdk/sdk.qbs +++ b/share/qbs/modules/Android/sdk/sdk.qbs @@ -55,7 +55,9 @@ Module { platformSearchPaths: [Android.sdk.sdkDir] names: ["bundletool-all"] nameSuffixes: ["-0.11.0.jar", "-0.12.0.jar", "-0.13.0.jar", "-0.13.3.jar", "-0.13.4.jar", - "-0.14.0.jar", "-0.15.0.jar", "-1.0.0.jar", "-1.1.0.jar", "-1.2.0.jar", "-1.3.0.jar"] + "-0.14.0.jar", "-0.15.0.jar", "-1.0.0.jar", "-1.1.0.jar", "-1.2.0.jar", "-1.3.0.jar", + "-1.4.0.jar", "-1.5.0.jar", "-1.6.0.jar", "-1.6.1.jar", "-1.7.0.jar", "-1.7.1.jar", + "-1.8.0.jar"] } property path sdkDir: sdkProbe.path diff --git a/share/qbs/modules/Android/sdk/utils.js b/share/qbs/modules/Android/sdk/utils.js index 36a88ddbb..d217d113b 100644 --- a/share/qbs/modules/Android/sdk/utils.js +++ b/share/qbs/modules/Android/sdk/utils.js @@ -389,12 +389,25 @@ function prepareBundletoolPackage(project, product, inputs, outputs, input, outp } cmds.push(removeCmd); + var bundleConfigFilePath = FileInfo.joinPaths(product.buildDirectory, "BundleConfig.json"); + var createBundleConfigCmd = new JavaScriptCommand(); + createBundleConfigCmd.description = "create BundleConfig.json"; + createBundleConfigCmd.filePath = bundleConfigFilePath; + createBundleConfigCmd.sourceCode = function() { + var bc = new TextFile(filePath, TextFile.WriteOnly); + bc.writeLine('{"optimizations": {'); + bc.writeLine('"uncompress_native_libraries": {'); + bc.writeLine('"enabled": false'); + bc.writeLine('}}}'); + } + cmds.push(createBundleConfigCmd); + var args = ["-jar", product.Android.sdk.bundletoolFilePath, "build-bundle"]; args.push("--modules=" + baseFilePath); args.push("--output=" + aabFilePath); + args.push("--config=" + bundleConfigFilePath); var cmd = new Command(product.java.interpreterFilePath, args); - var aabFileName = outputs["android.package_unsigned"][0].fileName; - cmd.description = "generating " + aabFileName; + cmd.description = "generating " + aabFilePath.fileName; cmds.push(cmd); return cmds; |