diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/androiddeployqt/main.cpp | 21 | ||||
-rw-r--r-- | src/tools/androidtestrunner/main.cpp | 54 | ||||
-rw-r--r-- | src/tools/bootstrap/bootstrap.pro | 16 |
3 files changed, 78 insertions, 13 deletions
diff --git a/src/tools/androiddeployqt/main.cpp b/src/tools/androiddeployqt/main.cpp index d3febe7383..10bbd59bfb 100644 --- a/src/tools/androiddeployqt/main.cpp +++ b/src/tools/androiddeployqt/main.cpp @@ -209,6 +209,7 @@ struct Options bool sectionsOnly; bool protectedAuthenticationPath; bool jarSigner; + QString apkPath; // Gdbserver TriState gdbServer; @@ -396,6 +397,11 @@ Options parseOptions() options.helpRequested = true; else options.jdkPath = arguments.at(++i); + } else if (argument.compare(QLatin1String("--apk"), Qt::CaseInsensitive) == 0) { + if (i + 1 == arguments.size()) + options.helpRequested = true; + else + options.apkPath = arguments.at(++i); } else if (argument.compare(QLatin1String("--sign"), Qt::CaseInsensitive) == 0) { if (i + 2 >= arguments.size()) { options.helpRequested = true; @@ -544,6 +550,7 @@ void printHelp() " dependencies into the build directory and update the XML templates.\n" " The project will not be built or installed.\n" " --no-strip: Do not strip debug symbols from libraries.\n" + " --apk <path/where/to/copy/the/apk>: Path where to copy the built apk.\n" " --help: Displays this information.\n\n", qPrintable(QCoreApplication::arguments().at(0)) ); @@ -2389,6 +2396,14 @@ bool installApk(const Options &options) return true; } +bool copyPackage(const Options &options) +{ + fflush(stdout); + auto from = apkPath(options, options.keyStore.isEmpty() ? UnsignedAPK : SignedAPK); + QFile::remove(options.apkPath); + return QFile::copy(from, options.apkPath); +} + bool copyStdCpp(Options *options) { if (options->verbose) @@ -2759,7 +2774,8 @@ enum ErrorCode CannotSignPackage = 15, CannotInstallApk = 16, CannotGenerateAssetsFileList = 18, - CannotCopyAndroidExtraResources = 19 + CannotCopyAndroidExtraResources = 19, + CannotCopyApk = 20 }; int main(int argc, char *argv[]) @@ -2902,6 +2918,9 @@ int main(int argc, char *argv[]) if (!options.keyStore.isEmpty() && !signPackage(options)) return CannotSignPackage; + if (!options.apkPath.isEmpty() && !copyPackage(options)) + return CannotCopyApk; + if (Q_UNLIKELY(options.timing)) fprintf(stdout, "[TIMING] %d ms: Signed package\n", options.timer.elapsed()); } diff --git a/src/tools/androidtestrunner/main.cpp b/src/tools/androidtestrunner/main.cpp index 229253fe85..043c827403 100644 --- a/src/tools/androidtestrunner/main.cpp +++ b/src/tools/androidtestrunner/main.cpp @@ -31,6 +31,7 @@ #include <QDir> #include <QHash> #include <QRegExp> +#include <QSystemSemaphore> #include <QXmlStreamReader> #include <algorithm> @@ -60,6 +61,7 @@ struct Options QStringList testArgsList; QHash<QString, QString> outFiles; QString testArgs; + QString apkPath; QHash<QString, std::function<bool(const QByteArray &)>> checkFiles = { {QStringLiteral("txt"), [](const QByteArray &data) -> bool { return data.indexOf("\nFAIL! : ") < 0; @@ -227,6 +229,11 @@ static bool parseOptions() g_options.helpRequested = true; else g_options.makeCommand = arguments.at(++i); + } else if (argument.compare(QStringLiteral("--apk"), Qt::CaseInsensitive) == 0) { + if (i + 1 == arguments.size()) + g_options.helpRequested = true; + else + g_options.apkPath = arguments.at(++i); } else if (argument.compare(QStringLiteral("--activity"), Qt::CaseInsensitive) == 0) { if (i + 1 == arguments.size()) g_options.helpRequested = true; @@ -280,6 +287,8 @@ static void printHelp() " Default is 5 minutes.\n" " --make <make cmd>: make command, needed to install the qt library.\n" " If make is missing make sure the --path is set.\n" + " --apk <apk path>: If the apk is specified and if exists, we'll skip\n" + " the package building.\n" " -- arguments that will be passed to the test application.\n" " --verbose: Prints out information during processing.\n" " --help: Displays this information.\n\n", @@ -420,6 +429,19 @@ static bool pullFiles() return ret; } +struct RunnerLocker +{ + RunnerLocker() + { + runner.acquire(); + } + ~RunnerLocker() + { + runner.release(); + } + QSystemSemaphore runner{QStringLiteral("androidtestrunner"), 1, QSystemSemaphore::Open}; +}; + int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); @@ -428,19 +450,29 @@ int main(int argc, char *argv[]) return 1; } - if (!g_options.makeCommand.isEmpty()) { - // 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, g_options.buildPath), nullptr, g_options.verbose)) { + RunnerLocker lock; // do not install or run packages while another test is running + if (!g_options.apkPath.isEmpty() && QFile::exists(g_options.apkPath)) { + if (!execCommand(QStringLiteral("%1 install -r %2") + .arg(g_options.adbCommand, g_options.apkPath), nullptr, g_options.verbose)) { + return 1; + } + } else { + if (!g_options.makeCommand.isEmpty()) { + // 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, g_options.buildPath), nullptr, g_options.verbose)) { + return 1; + } + } + + // Run androiddeployqt + static auto verbose = g_options.verbose ? QStringLiteral("--verbose") : QStringLiteral(); + if (!execCommand(QStringLiteral("%1 %3 --reinstall --output %2 --apk %4").arg(g_options.androidDeployQtCommand, + g_options.buildPath, + verbose, + g_options.apkPath), nullptr, true)) { return 1; } - } - // Run androiddeployqt - static auto verbose = g_options.verbose ? QStringLiteral("--verbose") : QStringLiteral(); - if (!execCommand(QStringLiteral("%1 %3 --reinstall --output %2").arg(g_options.androidDeployQtCommand, - g_options.buildPath, - verbose), nullptr, g_options.verbose)) { - return 1; } QString manifest = g_options.buildPath + QStringLiteral("/AndroidManifest.xml"); diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 40c0702f0a..8598fc2721 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -60,6 +60,8 @@ SOURCES += \ ../../corelib/kernel/qmetatype.cpp \ ../../corelib/kernel/qvariant.cpp \ ../../corelib/kernel/qsystemerror.cpp \ + ../../corelib/kernel/qsharedmemory.cpp \ + ../../corelib/kernel/qsystemsemaphore.cpp \ ../../corelib/plugin/quuid.cpp \ ../../corelib/serialization/qdatastream.cpp \ ../../corelib/serialization/qjson.cpp \ @@ -103,6 +105,12 @@ SOURCES += \ ../../xml/sax/qxml.cpp unix:SOURCES += ../../corelib/kernel/qcore_unix.cpp \ + ../../corelib/kernel/qsharedmemory_posix.cpp \ + ../../corelib/kernel/qsharedmemory_systemv.cpp \ + ../../corelib/kernel/qsharedmemory_unix.cpp \ + ../../corelib/kernel/qsystemsemaphore_posix.cpp \ + ../../corelib/kernel/qsystemsemaphore_systemv.cpp \ + ../../corelib/kernel/qsystemsemaphore_unix.cpp \ ../../corelib/io/qfilesystemengine_unix.cpp \ ../../corelib/io/qfilesystemiterator_unix.cpp \ ../../corelib/io/qfsfileengine_unix.cpp @@ -112,12 +120,18 @@ win32:SOURCES += ../../corelib/global/qoperatingsystemversion_win.cpp \ ../../corelib/io/qfilesystemiterator_win.cpp \ ../../corelib/io/qfsfileengine_win.cpp \ ../../corelib/kernel/qcoreapplication_win.cpp \ + ../../corelib/kernel/qsharedmemory_win.cpp \ + ../../corelib/kernel/qsystemsemaphore_win.cpp \ ../../corelib/plugin/qsystemlibrary.cpp \ mac { SOURCES += \ ../../corelib/kernel/qcoreapplication_mac.cpp \ - ../../corelib/kernel/qcore_mac.cpp + ../../corelib/kernel/qcore_mac.cpp \ + ../../corelib/io/qfilesystemengine_unix.cpp \ + ../../corelib/io/qfilesystemiterator_unix.cpp \ + ../../corelib/io/qfsfileengine_unix.cpp + OBJECTIVE_SOURCES += \ ../../corelib/global/qoperatingsystemversion_darwin.mm \ ../../corelib/kernel/qcore_mac_objc.mm \ |