From 76eefab088b64f9ba4e5f5c48612bfdd3552081d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 11 May 2021 13:49:08 +0200 Subject: 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 --- src/tools/androidtestrunner/main.cpp | 37 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'src/tools') 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; } } } -- cgit v1.2.3