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-06-08 13:16:50 +0200
commitf8238c302fbcd116414c25582d8c999e34a1f00a (patch)
tree4d3bd8e3e0af55e6dc4e00a3bd7fb19c5a462b62 /src/tools
parent47134f44c1c133b43698d4416b4f5a20a85e8893 (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> (cherry picked from commit 76eefab088b64f9ba4e5f5c48612bfdd3552081d)
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;
}
}
}