summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-05-11 13:49:08 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-05-17 19:14:44 +0200
commit76eefab088b64f9ba4e5f5c48612bfdd3552081d (patch)
tree9250339b31708224a5b49ade1e91d2c9c6e4392b /src/tools
parent50c838d4b5cde32db6bfcf8dda4dfbf5c34b9b17 (diff)
Add proper dependencies to apk targets
Before, building ${target}_make_apk always re-built the apk, instead of rebuilding the apk only when inputs changed. This patch fixes that by moving the creation code from a custom target to a custom command with proper dependencies. The androidtestrunner tool now does not check for the existence of an apk anymore and always runs the make command that is supposed to build the apk. The ${target}_prepare_apk_dir target is not needed anymore by the Qt build but is still used by Qt Creator's Android support. Add a clarifying comment. Fixes: QTBUG-93431 Change-Id: I00d65d616fef9511b03b65f879c4bc6cb92dfc30 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/androidtestrunner/main.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp
index b10b7d0bf3..37e58d5257 100644
--- a/src/tools/androidtestrunner/main.cpp
+++ b/src/tools/androidtestrunner/main.cpp
@@ -446,26 +446,23 @@ int main(int argc, char *argv[])
return 1;
}
- if (!QFile::exists(g_options.apkPath)) {
- if (g_options.makeCommand.isEmpty()) {
- fprintf(stderr,
- "No apk found at \"%s\". Provide a make command with the \"--make\" parameter "
- "to generate it first.\n",
- qPrintable(g_options.apkPath));
- return 1;
- }
- if (!execCommand(g_options.makeCommand, nullptr, true)) {
- if (!g_options.skipAddInstallRoot) {
- // we need to run make INSTALL_ROOT=path install to install the application file(s) first
- if (!execCommand(QStringLiteral("%1 INSTALL_ROOT=%2 install")
- .arg(g_options.makeCommand, QDir::toNativeSeparators(g_options.buildPath)), nullptr, g_options.verbose)) {
- return 1;
- }
- } else {
- if (!execCommand(QStringLiteral("%1")
- .arg(g_options.makeCommand), nullptr, g_options.verbose)) {
- return 1;
- }
+ if (g_options.makeCommand.isEmpty()) {
+ fprintf(stderr,
+ "It is required to provide a make command with the \"--make\" parameter "
+ "to generate the apk.\n");
+ return 1;
+ }
+ if (!execCommand(g_options.makeCommand, nullptr, true)) {
+ if (!g_options.skipAddInstallRoot) {
+ // we need to run make INSTALL_ROOT=path install to install the application file(s) first
+ if (!execCommand(QStringLiteral("%1 INSTALL_ROOT=%2 install")
+ .arg(g_options.makeCommand, QDir::toNativeSeparators(g_options.buildPath)), nullptr, g_options.verbose)) {
+ return 1;
+ }
+ } else {
+ if (!execCommand(QStringLiteral("%1")
+ .arg(g_options.makeCommand), nullptr, g_options.verbose)) {
+ return 1;
}
}
}