aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/reference/modules/android-sdk-module.qdoc3
-rw-r--r--share/qbs/modules/Android/sdk/sdk.qbs34
-rw-r--r--share/qbs/modules/Android/sdk/utils.js2
3 files changed, 35 insertions, 4 deletions
diff --git a/doc/reference/modules/android-sdk-module.qdoc b/doc/reference/modules/android-sdk-module.qdoc
index 40d80b021..a9e06ae17 100644
--- a/doc/reference/modules/android-sdk-module.qdoc
+++ b/doc/reference/modules/android-sdk-module.qdoc
@@ -154,7 +154,8 @@
/*!
\qmlproperty string Android.sdk::packageName
- The package name of the respective product. Must match the one given in the manifest file.
+ The package name of the respective product. The \c package attribute in the manifest file
+ will be set to this value automatically.
\defaultvalue \c name
*/
diff --git a/share/qbs/modules/Android/sdk/sdk.qbs b/share/qbs/modules/Android/sdk/sdk.qbs
index 8f4ec14d4..6ed8a2b26 100644
--- a/share/qbs/modules/Android/sdk/sdk.qbs
+++ b/share/qbs/modules/Android/sdk/sdk.qbs
@@ -35,6 +35,7 @@ import qbs.ModUtils
import qbs.Probes
import qbs.TextFile
import qbs.Utilities
+import qbs.Xml
import "utils.js" as SdkUtils
Module {
@@ -234,10 +235,39 @@ Module {
}
}
+ property bool customManifestProcessing: false
+ Group {
+ condition: !Android.sdk.customManifestProcessing
+ fileTagsFilter: "android.manifest_processed"
+ fileTags: "android.manifest_final"
+ }
+ Rule {
+ condition: _enableRules
+ inputs: "android.manifest"
+ Artifact {
+ filePath: FileInfo.joinPaths("processed_manifest", input.fileName)
+ fileTags: "android.manifest_processed"
+ }
+ prepare: {
+ var cmd = new JavaScriptCommand();
+ cmd.description = "Ensuring correct package name in Android manifest file";
+ cmd.sourceCode = function() {
+ var manifestData = new Xml.DomDocument();
+ manifestData.load(input.filePath);
+ var rootElem = manifestData.documentElement();
+ if (!rootElem || !rootElem.isElement() || rootElem.tagName() != "manifest")
+ throw "No manifest tag found in '" + input.filePath + "'.";
+ rootElem.setAttribute("package", product.Android.sdk.packageName);
+ manifestData.save(output.filePath, 4);
+ }
+ return cmd;
+ }
+ }
+
Rule {
condition: _enableRules
multiplex: true
- inputs: ["android.resources", "android.assets", "android.manifest"]
+ inputs: ["android.resources", "android.assets", "android.manifest_final"]
outputFileTags: ["java.java"]
outputArtifacts: {
@@ -382,7 +412,7 @@ Module {
condition: _enableRules
multiplex: true
inputs: [
- "android.resources", "android.assets", "android.manifest",
+ "android.resources", "android.assets", "android.manifest_final",
"android.dex", "android.gdbserver_deployed", "android.stl_deployed",
"android.nativelibrary_deployed", "android.keystore"
]
diff --git a/share/qbs/modules/Android/sdk/utils.js b/share/qbs/modules/Android/sdk/utils.js
index d75743d4d..6a89fd5f2 100644
--- a/share/qbs/modules/Android/sdk/utils.js
+++ b/share/qbs/modules/Android/sdk/utils.js
@@ -115,7 +115,7 @@ function findParentDir(filePath, parentDirName)
function commonAaptPackageArgs(project, product, inputs, outputs, input, output,
explicitlyDependsOn) {
- var manifestFilePath = inputs["android.manifest"][0].filePath;
+ var manifestFilePath = inputs["android.manifest_final"][0].filePath;
var args = ["package", "-f",
"-M", manifestFilePath,
"-I", product.Android.sdk.androidJarFilePath];