summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-05-27 09:00:21 -0700
committerJake Petroules <jake.petroules@qt.io>2017-05-30 14:50:53 +0000
commitb13a5e2a07764dbf92736a2c89e65af0d26c4556 (patch)
tree4891901c267daa993b7aaa297cfd1fc66dbb5a25 /tests/auto
parenta66281bec7dca8a0c733ecc4c61bc0415c0a3dfa (diff)
downloadqbs-b13a5e2a07764dbf92736a2c89e65af0d26c4556.tar.gz
Add properties to indicate the Android NDK samples directory
This was removed from the actual NDK in r11, and so can be set to the external googlesamples/android-ndk repository on github.com. Change-Id: Ie47883ebd003c119583b4a3321041ebbbf401029 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/blackbox/find/find-android.qbs1
-rw-r--r--tests/auto/blackbox/testdata-java/android/teapot/teapot.qbs35
-rw-r--r--tests/auto/blackbox/tst_blackboxjava.cpp4
3 files changed, 37 insertions, 3 deletions
diff --git a/tests/auto/blackbox/find/find-android.qbs b/tests/auto/blackbox/find/find-android.qbs
index 7b4ac159b..23c8b2f91 100644
--- a/tests/auto/blackbox/find/find-android.qbs
+++ b/tests/auto/blackbox/find/find-android.qbs
@@ -24,6 +24,7 @@ Product {
if (product.moduleProperty("Android.ndk", "present")) {
tools["ndk"] = product.moduleProperty("Android.ndk", "ndkDir");
+ tools["ndk-samples"] = product.Android.ndk.ndkSamplesDir;
}
var tf;
diff --git a/tests/auto/blackbox/testdata-java/android/teapot/teapot.qbs b/tests/auto/blackbox/testdata-java/android/teapot/teapot.qbs
index dbacef92d..ff3077335 100644
--- a/tests/auto/blackbox/testdata-java/android/teapot/teapot.qbs
+++ b/tests/auto/blackbox/testdata-java/android/teapot/teapot.qbs
@@ -1,4 +1,5 @@
import qbs
+import qbs.File
Project {
minimumQbsVersion: qbs.version
@@ -62,9 +63,24 @@ Project {
Depends { name: "native-glue" }
Depends { name: "ndk-helper" }
+ Probe {
+ id: teapotProbeJni
+ property string samplesDir: Android.ndk.ndkSamplesDir
+ property string jniDir
+ configure: {
+ var paths = ["/teapots/classic-teapot/src/main/cpp/", "/Teapot/app/src/main/jni/"];
+ for (var i = 0; i < paths.length; ++i) {
+ if (File.exists(samplesDir + paths[i])) {
+ jniDir = samplesDir + paths[i];
+ break;
+ }
+ }
+ }
+ }
+
Group {
name: "C++ sources"
- prefix: Android.ndk.ndkDir + "/samples/Teapot/app/src/main/jni/"
+ prefix: teapotProbeJni.jniDir
files: [
"TeapotNativeActivity.cpp",
"TeapotRenderer.cpp",
@@ -81,8 +97,23 @@ Project {
}
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"];
+ for (var i = 0; i < paths.length; ++i) {
+ if (File.exists(samplesDir + paths[i])) {
+ dir = samplesDir + paths[i];
+ break;
+ }
+ }
+ }
+ }
+
name: "com.sample.teapot"
- sourceSetDir: Android.sdk.ndkDir + "/samples/Teapot/app/src/main"
+ sourceSetDir: teapotProbe.dir
Depends { productTypes: ["android.nativelibrary"] }
}
}
diff --git a/tests/auto/blackbox/tst_blackboxjava.cpp b/tests/auto/blackbox/tst_blackboxjava.cpp
index 0dc7e6346..50c7dd5df 100644
--- a/tests/auto/blackbox/tst_blackboxjava.cpp
+++ b/tests/auto/blackbox/tst_blackboxjava.cpp
@@ -54,6 +54,7 @@ QMap<QString, QString> TestBlackboxJava::findAndroid(int *status)
return QMap<QString, QString> {
{"sdk", QDir::fromNativeSeparators(tools["sdk"].toString())},
{"ndk", QDir::fromNativeSeparators(tools["ndk"].toString())},
+ {"ndk-samples", QDir::fromNativeSeparators(tools["ndk-samples"].toString())},
};
}
@@ -71,8 +72,9 @@ void TestBlackboxJava::android()
const auto androidPaths = findAndroid(&status);
const auto ndkPath = androidPaths["ndk"];
+ const auto ndkSamplesPath = androidPaths["ndk-samples"];
static const QStringList ndkSamplesDirs = QStringList() << "teapot" << "no-native";
- if (!ndkPath.isEmpty() && !QFileInfo(ndkPath + "/samples").isDir()
+ if (!ndkPath.isEmpty() && !QFileInfo(ndkSamplesPath).isDir()
&& ndkSamplesDirs.contains(projectDir))
QSKIP("NDK samples directory not present");