aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2018-08-02 18:19:20 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2018-08-10 10:38:12 +0000
commit6464a075c5edfafb3a88bfc4097b3d5d9b9cdb28 (patch)
treef69681c5317c1b96de01d37077c0eee087dcbb3c /tests
parentd7715770c02d10593921ee5c3d3fd4c03a4f85d1 (diff)
Enable the Application item to create Android apps
The formerly required AndroidApk item is no longer needed: We just tag the APK file as an application and let the Application item pull in the Android.sdk module for Android targets. It is also possible to have native code directly in the Application product; in that case, the multiplexed variants become dynamic libraries and the APK file is built for the aggregate. [ChangeLog] The AndroidApk item was deprecated, a normal Application item can be used instead. Change-Id: I04f5f3892f354ca9eb4f2da8055abcd8d072aba0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/product1.qbs5
-rw-r--r--tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/product2.qbs5
-rw-r--r--tests/auto/blackbox/testdata-android/multiple-libs-per-apk/multiple-libs-per-apk.qbs17
-rw-r--r--tests/auto/blackbox/testdata-android/no-native/no-native.qbs4
-rw-r--r--tests/auto/blackbox/testdata-android/teapot/teapot.qbs42
-rw-r--r--tests/auto/blackbox/tst_blackboxandroid.cpp3
6 files changed, 45 insertions, 31 deletions
diff --git a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/product1.qbs b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/product1.qbs
index ad544085d..5d2978f7e 100644
--- a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/product1.qbs
+++ b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product1/product1.qbs
@@ -20,9 +20,10 @@ Project {
cpp.useRPaths: false
}
- AndroidApk {
+ Application {
name: "twolibs1"
- packageName: "io.qt.dummy1"
+ Android.sdk.apkBaseName: name
+ Android.sdk.packageName: "io.qt.dummy1"
Depends {
productTypes: ["android.nativelibrary"]
limitToSubProject: true
diff --git a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/product2.qbs b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/product2.qbs
index af7d01489..63065883b 100644
--- a/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/product2.qbs
+++ b/tests/auto/blackbox/testdata-android/multiple-apks-per-project/product2/product2.qbs
@@ -16,9 +16,10 @@ Project {
Android.ndk.appStl: "stlport_shared"
}
- AndroidApk {
+ Application {
name: "twolibs2"
- packageName: "io.qt.dummy2"
+ Android.sdk.apkBaseName: name
+ Android.sdk.packageName: "io.qt.dummy2"
Depends {
productTypes: ["android.nativelibrary"]
limitToSubProject: true
diff --git a/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/multiple-libs-per-apk.qbs b/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/multiple-libs-per-apk.qbs
index 6da74e556..2aafd5861 100644
--- a/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/multiple-libs-per-apk.qbs
+++ b/tests/auto/blackbox/testdata-android/multiple-libs-per-apk/multiple-libs-per-apk.qbs
@@ -21,6 +21,8 @@ Project {
JavaJarFile {
Depends { name: "Android.sdk" }
+ Android.sdk.packageName: undefined
+ Android.sdk.automaticSources: false
Depends { name: "lib6" }
Depends { name: "lib8" }
name: "lib3"
@@ -29,38 +31,49 @@ Project {
JavaJarFile {
Depends { name: "Android.sdk" }
+ Android.sdk.packageName: undefined
+ Android.sdk.automaticSources: false
name: "lib4"
files: ["lib4.java"]
}
JavaJarFile {
Depends { name: "Android.sdk" }
+ Android.sdk.packageName: undefined
+ Android.sdk.automaticSources: false
name: "lib5"
files: ["lib5.java"]
}
JavaJarFile {
Depends { name: "Android.sdk" }
+ Android.sdk.packageName: undefined
+ Android.sdk.automaticSources: false
name: "lib6"
files: ["lib6.java"]
}
JavaJarFile {
Depends { name: "Android.sdk" }
+ Android.sdk.packageName: undefined
+ Android.sdk.automaticSources: false
name: "lib7"
files: ["lib7.java"]
}
JavaJarFile {
Depends { name: "Android.sdk" }
+ Android.sdk.packageName: undefined
+ Android.sdk.automaticSources: false
Depends { name: "lib7"; Android.sdk.embedJar: false }
name: "lib8"
files: ["lib8.java"]
}
- AndroidApk {
+ Application {
name: "twolibs"
- packageName: "io.qt.dummy"
+ Android.sdk.apkBaseName: name
+ Android.sdk.packageName: "io.qt.dummy"
Depends { productTypes: ["android.nativelibrary"] }
Depends { name: "lib3"; Android.sdk.embedJar: true }
Depends { name: "lib4"; Android.sdk.embedJar: false }
diff --git a/tests/auto/blackbox/testdata-android/no-native/no-native.qbs b/tests/auto/blackbox/testdata-android/no-native/no-native.qbs
index 9f32a4fa5..11bc1c60d 100644
--- a/tests/auto/blackbox/testdata-android/no-native/no-native.qbs
+++ b/tests/auto/blackbox/testdata-android/no-native/no-native.qbs
@@ -1,6 +1,6 @@
-AndroidApk {
+Application {
name: "com.example.android.basicmediadecoder"
- sourceSetDir: Android.sdk.sdkDir
+ Android.sdk.sourceSetDir: Android.sdk.sdkDir
+ "/samples/android-BasicMediaDecoder/Application/src/main"
}
diff --git a/tests/auto/blackbox/testdata-android/teapot/teapot.qbs b/tests/auto/blackbox/testdata-android/teapot/teapot.qbs
index 81772fb71..69e06a032 100644
--- a/tests/auto/blackbox/testdata-android/teapot/teapot.qbs
+++ b/tests/auto/blackbox/testdata-android/teapot/teapot.qbs
@@ -76,9 +76,10 @@ Project {
}
}
- DynamicLibrary {
+ CppApplication {
name: "TeapotNativeActivity"
qbs.targetPlatform: "android"
+
Depends { name: "Android.ndk" }
Depends { name: "cpp" }
Depends { name: "android_cpufeatures" }
@@ -86,6 +87,21 @@ Project {
Depends { name: "ndk-helper" }
Probe {
+ id: teapotProbe
+ property string samplesDir: Android.sdk.ndkSamplesDir
+ property string dir
+ configure: {
+ var paths = ["/teapots/classic-teapot/src/main", "/Teapot/app/src/main", "/Teapot"];
+ for (var i = 0; i < paths.length; ++i) {
+ if (File.exists(samplesDir + paths[i])) {
+ dir = samplesDir + paths[i];
+ break;
+ }
+ }
+ }
+ }
+
+ Probe {
id: teapotProbeJni
property string samplesDir: Android.ndk.ndkSamplesDir
property string jniDir
@@ -114,6 +130,9 @@ Project {
FileTagger { patterns: ["*.inl"]; fileTags: ["hpp"] }
+ Android.sdk.apkBaseName: name
+ Android.sdk.packageName: "com.sample.teapot"
+ Android.sdk.sourceSetDir: teapotProbe.dir
Android.ndk.appStl: "gnustl_shared"
cpp.cxxLanguageVersion: "c++11"
cpp.dynamicLibraries: ["log", "android", "EGL", "GLESv2"]
@@ -123,25 +142,4 @@ Project {
// Refer to: https://github.com/android-ndk/ndk/issues/381
cpp.linkerFlags: ["-u", "ANativeActivity_onCreate"]
}
-
- AndroidApk {
- Probe {
- id: teapotProbe
- property string samplesDir: Android.sdk.ndkSamplesDir
- property string dir
- configure: {
- var paths = ["/teapots/classic-teapot/src/main", "/Teapot/app/src/main", "/Teapot"];
- for (var i = 0; i < paths.length; ++i) {
- if (File.exists(samplesDir + paths[i])) {
- dir = samplesDir + paths[i];
- break;
- }
- }
- }
- }
-
- name: "com.sample.teapot"
- sourceSetDir: teapotProbe.dir
- Depends { productTypes: ["android.nativelibrary"] }
- }
}
diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp
index 7ad008bdf..705bc6b7e 100644
--- a/tests/auto/blackbox/tst_blackboxandroid.cpp
+++ b/tests/auto/blackbox/tst_blackboxandroid.cpp
@@ -106,6 +106,7 @@ void TestBlackboxAndroid::android()
params.profile = p.name();
QCOMPARE(runQbs(params), 0);
for (const QString &productName : qAsConst(productNames)) {
+ QCOMPARE(m_qbsStdout.count("Generating BuildConfig.java"), productNames.size());
QVERIFY(m_qbsStdout.contains(productName.toLocal8Bit() + ".apk"));
const QString apkFilePath = relativeProductBuildDir(productName, configName)
+ '/' + productName + ".apk";
@@ -203,7 +204,7 @@ void TestBlackboxAndroid::android_data()
QTest::addColumn<QStringList>("productNames");
QTest::addColumn<QList<QByteArrayList>>("expectedFilesLists");
QTest::newRow("teapot")
- << "teapot" << QStringList("com.sample.teapot")
+ << "teapot" << QStringList("TeapotNativeActivity")
<< (QList<QByteArrayList>() << commonFiles + expandArchs(archs, {
"assets/Shaders/ShaderPlain.fsh",
"assets/Shaders/VS_ShaderPlain.vsh",