forked from qt-creator/qt-creator
Android: Use specific classes for run worker factories
Slimmer file interfaces. Change-Id: I2cf846c04000eb29fe53219db9a97088b6b9a1aa Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -50,6 +50,7 @@ const char ANDROID_DEPLOYMENT_SETTINGS_FILE[] = "ANDROID_DEPLOYMENT_SETTINGS_FIL
|
|||||||
const char ANDROID_SO_LIBS_PATHS[] = "ANDROID_SO_LIBS_PATHS";
|
const char ANDROID_SO_LIBS_PATHS[] = "ANDROID_SO_LIBS_PATHS";
|
||||||
const char JAVA_HOME_ENV_VAR[] = "JAVA_HOME";
|
const char JAVA_HOME_ENV_VAR[] = "JAVA_HOME";
|
||||||
|
|
||||||
|
const char ANDROID_RUNCONFIG_ID[] = "Qt4ProjectManager.AndroidRunConfiguration:";
|
||||||
const char ANDROID_PACKAGE_INSTALL_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
|
const char ANDROID_PACKAGE_INSTALL_STEP_ID[] = "Qt4ProjectManager.AndroidPackageInstallationStep";
|
||||||
const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep";
|
const char ANDROID_BUILD_APK_ID[] = "QmakeProjectManager.AndroidBuildApkStep";
|
||||||
const char ANDROID_DEPLOY_QT_ID[] = "Qt4ProjectManager.AndroidDeployQtStep";
|
const char ANDROID_DEPLOY_QT_ID[] = "Qt4ProjectManager.AndroidDeployQtStep";
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <debugger/debuggerkitinformation.h>
|
#include <debugger/debuggerkitinformation.h>
|
||||||
#include <debugger/debuggerrunconfigurationaspect.h>
|
#include <debugger/debuggerrunconfigurationaspect.h>
|
||||||
|
#include <debugger/debuggerruncontrol.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
@@ -20,9 +21,12 @@
|
|||||||
|
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
|
#include <QFutureWatcher>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -33,8 +37,7 @@ using namespace Debugger;
|
|||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
static FilePaths getSoLibSearchPath(const ProjectNode *node)
|
static FilePaths getSoLibSearchPath(const ProjectNode *node)
|
||||||
{
|
{
|
||||||
@@ -77,14 +80,23 @@ static FilePaths getExtraLibs(const ProjectNode *node)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidDebugSupport::AndroidDebugSupport(RunControl *runControl, const QString &intentName)
|
class AndroidDebugSupport : public Debugger::DebuggerRunTool
|
||||||
: Debugger::DebuggerRunTool(runControl)
|
|
||||||
{
|
{
|
||||||
setId("AndroidDebugger");
|
public:
|
||||||
setLldbPlatform("remote-android");
|
explicit AndroidDebugSupport(RunControl *runControl) : Debugger::DebuggerRunTool(runControl)
|
||||||
m_runner = new AndroidRunner(runControl, intentName);
|
{
|
||||||
addStartDependency(m_runner);
|
setId("AndroidDebugger");
|
||||||
}
|
setLldbPlatform("remote-android");
|
||||||
|
m_runner = new AndroidRunner(runControl, {});
|
||||||
|
addStartDependency(m_runner);
|
||||||
|
}
|
||||||
|
|
||||||
|
void start() override;
|
||||||
|
void stop() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
AndroidRunner *m_runner = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
void AndroidDebugSupport::start()
|
void AndroidDebugSupport::start()
|
||||||
{
|
{
|
||||||
@@ -98,7 +110,7 @@ void AndroidDebugSupport::start()
|
|||||||
setAttachPid(m_runner->pid());
|
setAttachPid(m_runner->pid());
|
||||||
|
|
||||||
QtSupport::QtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(kit);
|
QtSupport::QtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(kit);
|
||||||
if (!Utils::HostOsInfo::isWindowsHost()
|
if (!HostOsInfo::isWindowsHost()
|
||||||
&& (qtVersion
|
&& (qtVersion
|
||||||
&& AndroidConfigurations::currentConfig().ndkVersion(qtVersion)
|
&& AndroidConfigurations::currentConfig().ndkVersion(qtVersion)
|
||||||
>= QVersionNumber(11, 0, 0))) {
|
>= QVersionNumber(11, 0, 0))) {
|
||||||
@@ -157,7 +169,7 @@ void AndroidDebugSupport::start()
|
|||||||
if (qtVersion) {
|
if (qtVersion) {
|
||||||
const FilePath ndkLocation =
|
const FilePath ndkLocation =
|
||||||
AndroidConfigurations::currentConfig().ndkLocation(qtVersion);
|
AndroidConfigurations::currentConfig().ndkLocation(qtVersion);
|
||||||
Utils::FilePath sysRoot = ndkLocation
|
FilePath sysRoot = ndkLocation
|
||||||
/ "platforms"
|
/ "platforms"
|
||||||
/ QString("android-%1").arg(sdkVersion)
|
/ QString("android-%1").arg(sdkVersion)
|
||||||
/ devicePreferredAbi; // Legacy Ndk structure
|
/ devicePreferredAbi; // Legacy Ndk structure
|
||||||
@@ -187,5 +199,13 @@ void AndroidDebugSupport::stop()
|
|||||||
DebuggerRunTool::stop();
|
DebuggerRunTool::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
// AndroidDebugWorkerFactory
|
||||||
} // namespace Android
|
|
||||||
|
AndroidDebugWorkerFactory::AndroidDebugWorkerFactory()
|
||||||
|
{
|
||||||
|
setProduct<AndroidDebugSupport>();
|
||||||
|
addSupportedRunMode(ProjectExplorer::Constants::DEBUG_RUN_MODE);
|
||||||
|
addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Android::Internal
|
||||||
|
@@ -3,26 +3,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "androidrunner.h"
|
#include <projectexplorer/runcontrol.h>
|
||||||
#include <debugger/debuggerruncontrol.h>
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidDebugSupport : public Debugger::DebuggerRunTool
|
class AndroidDebugWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AndroidDebugSupport(ProjectExplorer::RunControl *runControl,
|
AndroidDebugWorkerFactory();
|
||||||
const QString &intentName = QString());
|
|
||||||
|
|
||||||
void start() override;
|
|
||||||
void stop() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
AndroidRunner *m_runner = nullptr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
// Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
// Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include "androidplugin.h"
|
||||||
|
|
||||||
#include "androidconfigurations.h"
|
#include "androidconfigurations.h"
|
||||||
#include "androidbuildapkstep.h"
|
#include "androidbuildapkstep.h"
|
||||||
#include "androidconstants.h"
|
#include "androidconstants.h"
|
||||||
@@ -9,7 +11,6 @@
|
|||||||
#include "androiddevice.h"
|
#include "androiddevice.h"
|
||||||
#include "androidmanifesteditorfactory.h"
|
#include "androidmanifesteditorfactory.h"
|
||||||
#include "androidpackageinstallationstep.h"
|
#include "androidpackageinstallationstep.h"
|
||||||
#include "androidplugin.h"
|
|
||||||
#include "androidpotentialkit.h"
|
#include "androidpotentialkit.h"
|
||||||
#include "androidqmlpreviewworker.h"
|
#include "androidqmlpreviewworker.h"
|
||||||
#include "androidqmltoolingsupport.h"
|
#include "androidqmltoolingsupport.h"
|
||||||
@@ -48,8 +49,7 @@ using namespace ProjectExplorer::Constants;
|
|||||||
|
|
||||||
const char kSetupAndroidSetting[] = "ConfigureAndroid";
|
const char kSetupAndroidSetting[] = "ConfigureAndroid";
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidDeployConfigurationFactory : public DeployConfigurationFactory
|
class AndroidDeployConfigurationFactory : public DeployConfigurationFactory
|
||||||
{
|
{
|
||||||
@@ -89,29 +89,10 @@ public:
|
|||||||
AndroidPackageInstallationFactory packackeInstallationFactory;
|
AndroidPackageInstallationFactory packackeInstallationFactory;
|
||||||
AndroidManifestEditorFactory manifestEditorFactory;
|
AndroidManifestEditorFactory manifestEditorFactory;
|
||||||
AndroidRunConfigurationFactory runConfigFactory;
|
AndroidRunConfigurationFactory runConfigFactory;
|
||||||
|
AndroidRunWorkerFactory runWorkerFactory;
|
||||||
RunWorkerFactory runWorkerFactory{
|
AndroidDebugWorkerFactory debugWorkerFactory;
|
||||||
RunWorkerFactory::make<AndroidRunSupport>(),
|
AndroidQmlToolingSupportFactory profilerWorkerFactory;
|
||||||
{NORMAL_RUN_MODE},
|
AndroidQmlPreviewWorkerFactory qmlPreviewWorkerFactory;
|
||||||
{runConfigFactory.runConfigurationId()}
|
|
||||||
};
|
|
||||||
RunWorkerFactory debugWorkerFactory{
|
|
||||||
RunWorkerFactory::make<AndroidDebugSupport>(),
|
|
||||||
{DEBUG_RUN_MODE},
|
|
||||||
{runConfigFactory.runConfigurationId()}
|
|
||||||
};
|
|
||||||
RunWorkerFactory profilerWorkerFactory{
|
|
||||||
RunWorkerFactory::make<AndroidQmlToolingSupport>(),
|
|
||||||
{QML_PROFILER_RUN_MODE},
|
|
||||||
{runConfigFactory.runConfigurationId()}
|
|
||||||
};
|
|
||||||
RunWorkerFactory qmlPreviewWorkerFactory{
|
|
||||||
RunWorkerFactory::make<AndroidQmlPreviewWorker>(),
|
|
||||||
{QML_PREVIEW_RUN_MODE},
|
|
||||||
{"QmlProjectManager.QmlRunConfiguration.Qml", runConfigFactory.runConfigurationId()},
|
|
||||||
{Android::Constants::ANDROID_DEVICE_TYPE}
|
|
||||||
};
|
|
||||||
|
|
||||||
AndroidBuildApkStepFactory buildApkStepFactory;
|
AndroidBuildApkStepFactory buildApkStepFactory;
|
||||||
AndroidDeviceManager deviceManager;
|
AndroidDeviceManager deviceManager;
|
||||||
};
|
};
|
||||||
@@ -177,5 +158,4 @@ void AndroidPlugin::askUserAboutAndroidSetup()
|
|||||||
Core::ICore::infoBar()->addInfo(info);
|
Core::ICore::infoBar()->addInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
@@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidPlugin final : public ExtensionSystem::IPlugin
|
class AndroidPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
@@ -31,5 +30,4 @@ private slots:
|
|||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
@@ -1,11 +1,14 @@
|
|||||||
// Copyright (C) 2021 The Qt Company Ltd.
|
// Copyright (C) 2021 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
|
#include "androidqmlpreviewworker.h"
|
||||||
|
|
||||||
#include "androidavdmanager.h"
|
#include "androidavdmanager.h"
|
||||||
|
#include "androidconfigurations.h"
|
||||||
|
#include "androidconstants.h"
|
||||||
#include "androiddevice.h"
|
#include "androiddevice.h"
|
||||||
#include "androiddeviceinfo.h"
|
#include "androiddeviceinfo.h"
|
||||||
#include "androidmanager.h"
|
#include "androidmanager.h"
|
||||||
#include "androidqmlpreviewworker.h"
|
|
||||||
#include "androidtr.h"
|
#include "androidtr.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -24,20 +27,23 @@
|
|||||||
#include <qtsupport/baseqtversion.h>
|
#include <qtsupport/baseqtversion.h>
|
||||||
#include <qtsupport/qtkitinformation.h>
|
#include <qtsupport/qtkitinformation.h>
|
||||||
|
|
||||||
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDeadlineTimer>
|
#include <QDeadlineTimer>
|
||||||
|
#include <QFutureWatcher>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
namespace Android {
|
using namespace ProjectExplorer;
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
namespace Android::Internal {
|
||||||
|
|
||||||
#define APP_ID "io.qt.qtdesignviewer"
|
#define APP_ID "io.qt.qtdesignviewer"
|
||||||
|
|
||||||
class ApkInfo {
|
class ApkInfo
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ApkInfo();
|
ApkInfo();
|
||||||
const QStringList abis;
|
const QStringList abis;
|
||||||
@@ -62,8 +68,60 @@ ApkInfo::ApkInfo() :
|
|||||||
|
|
||||||
Q_GLOBAL_STATIC(ApkInfo, apkInfo)
|
Q_GLOBAL_STATIC(ApkInfo, apkInfo)
|
||||||
|
|
||||||
|
class UploadInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FilePath uploadPackage;
|
||||||
|
FilePath projectFolder;
|
||||||
|
};
|
||||||
|
|
||||||
static const char packageSuffix[] = ".qmlrc";
|
static const char packageSuffix[] = ".qmlrc";
|
||||||
|
|
||||||
|
class AndroidQmlPreviewWorker : public RunWorker
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
AndroidQmlPreviewWorker(RunControl *runControl);
|
||||||
|
~AndroidQmlPreviewWorker();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void previewPidChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void start() override;
|
||||||
|
void stop() override;
|
||||||
|
|
||||||
|
bool ensureAvdIsRunning();
|
||||||
|
bool checkAndInstallPreviewApp();
|
||||||
|
bool preparePreviewArtefacts();
|
||||||
|
bool uploadPreviewArtefacts();
|
||||||
|
|
||||||
|
SdkToolResult runAdbCommand(const QStringList &arguments) const;
|
||||||
|
SdkToolResult runAdbShellCommand(const QStringList &arguments) const;
|
||||||
|
int pidofPreview() const;
|
||||||
|
bool isPreviewRunning(int lastKnownPid = -1) const;
|
||||||
|
|
||||||
|
void startPidWatcher();
|
||||||
|
void startLogcat();
|
||||||
|
void filterLogcatAndAppendMessage(const QString &stdOut);
|
||||||
|
|
||||||
|
bool startPreviewApp();
|
||||||
|
bool stopPreviewApp();
|
||||||
|
|
||||||
|
Utils::FilePath designViewerApkPath(const QString &abi) const;
|
||||||
|
Utils::FilePath createQmlrcFile(const Utils::FilePath &workFolder, const QString &basename);
|
||||||
|
|
||||||
|
RunControl *m_rc = nullptr;
|
||||||
|
const AndroidConfig &m_androidConfig;
|
||||||
|
QString m_serialNumber;
|
||||||
|
QStringList m_avdAbis;
|
||||||
|
int m_viewerPid = -1;
|
||||||
|
QFutureWatcher<void> m_pidFutureWatcher;
|
||||||
|
Utils::QtcProcess m_logcatProcess;
|
||||||
|
QString m_logcatStartTimeStamp;
|
||||||
|
UploadInfo m_uploadInfo;
|
||||||
|
};
|
||||||
|
|
||||||
FilePath AndroidQmlPreviewWorker::designViewerApkPath(const QString &abi) const
|
FilePath AndroidQmlPreviewWorker::designViewerApkPath(const QString &abi) const
|
||||||
{
|
{
|
||||||
if (abi.isEmpty())
|
if (abi.isEmpty())
|
||||||
@@ -158,8 +216,8 @@ void AndroidQmlPreviewWorker::filterLogcatAndAppendMessage(const QString &stdOut
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidQmlPreviewWorker::AndroidQmlPreviewWorker(ProjectExplorer::RunControl *runControl)
|
AndroidQmlPreviewWorker::AndroidQmlPreviewWorker(RunControl *runControl)
|
||||||
: ProjectExplorer::RunWorker(runControl),
|
: RunWorker(runControl),
|
||||||
m_rc(runControl),
|
m_rc(runControl),
|
||||||
m_androidConfig(AndroidConfigurations::currentConfig())
|
m_androidConfig(AndroidConfigurations::currentConfig())
|
||||||
{
|
{
|
||||||
@@ -213,7 +271,6 @@ bool AndroidQmlPreviewWorker::ensureAvdIsRunning()
|
|||||||
devSN = m_serialNumber;
|
devSN = m_serialNumber;
|
||||||
|
|
||||||
if (!avdMananager.isAvdBooted(devSN)) {
|
if (!avdMananager.isAvdBooted(devSN)) {
|
||||||
using namespace ProjectExplorer;
|
|
||||||
const IDevice *dev = DeviceKitAspect::device(m_rc->target()->kit()).data();
|
const IDevice *dev = DeviceKitAspect::device(m_rc->target()->kit()).data();
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
appendMessage(Tr::tr("Selected device is invalid."), ErrorMessageFormat);
|
appendMessage(Tr::tr("Selected device is invalid."), ErrorMessageFormat);
|
||||||
@@ -430,5 +487,17 @@ bool AndroidQmlPreviewWorker::stopPreviewApp()
|
|||||||
return res.success();
|
return res.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
// AndroidQmlPreviewWorkerFactory
|
||||||
} // namespace Android
|
|
||||||
|
AndroidQmlPreviewWorkerFactory::AndroidQmlPreviewWorkerFactory()
|
||||||
|
{
|
||||||
|
setProduct<AndroidQmlPreviewWorker>();
|
||||||
|
addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE);
|
||||||
|
addSupportedRunConfig("QmlProjectManager.QmlRunConfiguration.Qml");
|
||||||
|
addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
|
||||||
|
addSupportedDeviceType(Android::Constants::ANDROID_DEVICE_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Android::Internal
|
||||||
|
|
||||||
|
#include "androidqmlpreviewworker.moc"
|
||||||
|
@@ -3,70 +3,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "androidconfigurations.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/runcontrol.h>
|
#include <projectexplorer/runcontrol.h>
|
||||||
|
|
||||||
#include <utils/qtcprocess.h>
|
namespace Android::Internal {
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
class AndroidQmlPreviewWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
|
|
||||||
namespace Android {
|
|
||||||
class SdkToolResult;
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class UploadInfo
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Utils::FilePath uploadPackage;
|
AndroidQmlPreviewWorkerFactory();
|
||||||
Utils::FilePath projectFolder;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidQmlPreviewWorker : public ProjectExplorer::RunWorker
|
} // Android::Internal
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
AndroidQmlPreviewWorker(ProjectExplorer::RunControl *runControl);
|
|
||||||
~AndroidQmlPreviewWorker();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void previewPidChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void start() override;
|
|
||||||
void stop() override;
|
|
||||||
|
|
||||||
bool ensureAvdIsRunning();
|
|
||||||
bool checkAndInstallPreviewApp();
|
|
||||||
bool preparePreviewArtefacts();
|
|
||||||
bool uploadPreviewArtefacts();
|
|
||||||
|
|
||||||
SdkToolResult runAdbCommand(const QStringList &arguments) const;
|
|
||||||
SdkToolResult runAdbShellCommand(const QStringList &arguments) const;
|
|
||||||
int pidofPreview() const;
|
|
||||||
bool isPreviewRunning(int lastKnownPid = -1) const;
|
|
||||||
|
|
||||||
void startPidWatcher();
|
|
||||||
void startLogcat();
|
|
||||||
void filterLogcatAndAppendMessage(const QString &stdOut);
|
|
||||||
|
|
||||||
bool startPreviewApp();
|
|
||||||
bool stopPreviewApp();
|
|
||||||
|
|
||||||
Utils::FilePath designViewerApkPath(const QString &abi) const;
|
|
||||||
Utils::FilePath createQmlrcFile(const Utils::FilePath &workFolder, const QString &basename);
|
|
||||||
|
|
||||||
ProjectExplorer::RunControl *m_rc = nullptr;
|
|
||||||
const AndroidConfig &m_androidConfig;
|
|
||||||
QString m_serialNumber;
|
|
||||||
QStringList m_avdAbis;
|
|
||||||
int m_viewerPid = -1;
|
|
||||||
QFutureWatcher<void> m_pidFutureWatcher;
|
|
||||||
Utils::QtcProcess m_logcatProcess;
|
|
||||||
QString m_logcatStartTimeStamp;
|
|
||||||
UploadInfo m_uploadInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Android
|
|
||||||
|
@@ -2,39 +2,44 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "androidqmltoolingsupport.h"
|
#include "androidqmltoolingsupport.h"
|
||||||
|
|
||||||
|
#include "androidconstants.h"
|
||||||
#include "androidrunner.h"
|
#include "androidrunner.h"
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
AndroidQmlToolingSupport::AndroidQmlToolingSupport(RunControl *runControl,
|
class AndroidQmlToolingSupport final : public RunWorker
|
||||||
const QString &intentName)
|
|
||||||
: RunWorker(runControl)
|
|
||||||
{
|
{
|
||||||
setId("AndroidQmlToolingSupport");
|
public:
|
||||||
|
explicit AndroidQmlToolingSupport(RunControl *runControl) : RunWorker(runControl)
|
||||||
|
{
|
||||||
|
setId("AndroidQmlToolingSupport");
|
||||||
|
|
||||||
auto runner = new AndroidRunner(runControl, intentName);
|
auto runner = new AndroidRunner(runControl, {});
|
||||||
addStartDependency(runner);
|
addStartDependency(runner);
|
||||||
|
|
||||||
auto worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
auto worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||||
worker->addStartDependency(this);
|
worker->addStartDependency(this);
|
||||||
|
|
||||||
connect(runner, &AndroidRunner::qmlServerReady, this, [this, worker](const QUrl &server) {
|
connect(runner, &AndroidRunner::qmlServerReady, this, [this, worker](const QUrl &server) {
|
||||||
worker->recordData("QmlServerUrl", server);
|
worker->recordData("QmlServerUrl", server);
|
||||||
reportStarted();
|
reportStarted();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void start() override {}
|
||||||
|
void stop() override { reportStopped(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
AndroidQmlToolingSupportFactory::AndroidQmlToolingSupportFactory()
|
||||||
|
{
|
||||||
|
setProduct<AndroidQmlToolingSupport>();
|
||||||
|
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
|
addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidQmlToolingSupport::start()
|
} // Android::Internal
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidQmlToolingSupport::stop()
|
|
||||||
{
|
|
||||||
reportStopped();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Android
|
|
||||||
|
@@ -4,23 +4,13 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/runcontrol.h>
|
#include <projectexplorer/runcontrol.h>
|
||||||
#include <utils/environment.h>
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidQmlToolingSupport : public ProjectExplorer::RunWorker
|
class AndroidQmlToolingSupportFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AndroidQmlToolingSupport(ProjectExplorer::RunControl *runControl,
|
AndroidQmlToolingSupportFactory();
|
||||||
const QString &intentName = QString());
|
|
||||||
|
|
||||||
private:
|
|
||||||
void start() override;
|
|
||||||
void stop() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "androidruncontrol.h"
|
#include "androidruncontrol.h"
|
||||||
|
|
||||||
|
#include "androidconstants.h"
|
||||||
#include "androidglobal.h"
|
#include "androidglobal.h"
|
||||||
#include "androidrunconfiguration.h"
|
#include "androidrunconfiguration.h"
|
||||||
#include "androidrunner.h"
|
#include "androidrunner.h"
|
||||||
@@ -13,8 +14,18 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
class AndroidRunSupport final : public AndroidRunner
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit AndroidRunSupport(ProjectExplorer::RunControl *runControl,
|
||||||
|
const QString &intentName = QString());
|
||||||
|
~AndroidRunSupport() override;
|
||||||
|
|
||||||
|
void start() override;
|
||||||
|
void stop() override;
|
||||||
|
};
|
||||||
|
|
||||||
AndroidRunSupport::AndroidRunSupport(RunControl *runControl, const QString &intentName)
|
AndroidRunSupport::AndroidRunSupport(RunControl *runControl, const QString &intentName)
|
||||||
: AndroidRunner(runControl, intentName)
|
: AndroidRunner(runControl, intentName)
|
||||||
@@ -37,5 +48,11 @@ void AndroidRunSupport::stop()
|
|||||||
AndroidRunner::stop();
|
AndroidRunner::stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
AndroidRunWorkerFactory::AndroidRunWorkerFactory()
|
||||||
} // namespace Android
|
{
|
||||||
|
setProduct<AndroidRunSupport>();
|
||||||
|
addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
|
||||||
|
addSupportedRunConfig(Constants::ANDROID_RUNCONFIG_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // Android::Internal
|
||||||
|
@@ -7,23 +7,14 @@
|
|||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidRunner;
|
class AndroidRunner;
|
||||||
|
|
||||||
class AndroidRunSupport final : public AndroidRunner
|
class AndroidRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AndroidRunSupport(ProjectExplorer::RunControl *runControl,
|
AndroidRunWorkerFactory();
|
||||||
const QString &intentName = QString());
|
|
||||||
~AndroidRunSupport() override;
|
|
||||||
|
|
||||||
void start() override;
|
|
||||||
void stop() override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
Reference in New Issue
Block a user