summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Cotty <raphael.cotty@gmail.com>2021-09-22 22:29:56 +0200
committerRaphaƫl Cotty <raphael.cotty@gmail.com>2021-09-24 17:37:29 +0000
commit647897e3c966c1349a4d1d7f60ba457803509e85 (patch)
tree0a03b515d79c51409c3fa61f78723c594e1e6a0b
parent310655329c0beff6508f8f24386577ee8f3c7a44 (diff)
downloadqbs-647897e3c966c1349a4d1d7f60ba457803509e85.tar.gz
Android: fix aab generation
BundleTool doesn't compress native libs by default which are then uncompress when deployed on the device. This patch generates a BuildConfig.json which overwrites default bundletool behavior. Fixes: QTBUG-80766 Change-Id: Id758fe8fdbc1029b76b745f07be8ede3cbc3e96a Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r--share/qbs/modules/Android/sdk/sdk.qbs4
-rw-r--r--share/qbs/modules/Android/sdk/utils.js17
2 files changed, 18 insertions, 3 deletions
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;