2017-04-03 11:11:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "androidconfigurations.h"
|
|
|
|
|
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
#include <functional>
|
2017-04-03 11:11:17 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace Android {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class AvdManagerOutputParser;
|
|
|
|
|
|
|
|
|
|
class AndroidAvdManager
|
|
|
|
|
{
|
2018-04-18 12:23:02 +02:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(Android::Internal::AndroidAvdManager)
|
|
|
|
|
|
2017-04-03 11:11:17 +02:00
|
|
|
public:
|
|
|
|
|
AndroidAvdManager(const AndroidConfig& config = AndroidConfigurations::currentConfig());
|
|
|
|
|
~AndroidAvdManager();
|
|
|
|
|
|
2017-08-18 08:22:34 +02:00
|
|
|
QFuture<CreateAvdInfo> createAvd(CreateAvdInfo info) const;
|
2017-04-03 11:11:17 +02:00
|
|
|
bool removeAvd(const QString &name) const;
|
|
|
|
|
QFuture<AndroidDeviceInfoList> avdList() const;
|
|
|
|
|
|
|
|
|
|
QString startAvd(const QString &name) const;
|
|
|
|
|
bool startAvdAsync(const QString &avdName) const;
|
|
|
|
|
QString findAvd(const QString &avdName) const;
|
|
|
|
|
QString waitForAvd(const QString &avdName,
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
const std::function<bool()> &cancelChecker = {}) const;
|
2017-04-03 11:11:17 +02:00
|
|
|
bool isAvdBooted(const QString &device) const;
|
2020-02-10 16:02:24 +02:00
|
|
|
static bool avdManagerCommand(const AndroidConfig &config,
|
2020-01-08 14:55:16 +02:00
|
|
|
const QStringList &args,
|
|
|
|
|
QString *output);
|
2017-04-03 11:11:17 +02:00
|
|
|
|
|
|
|
|
private:
|
ProjectExplorer: Rework the build step run interface
Originally, the build manager used to run all build steps in a dedicated
thread. Communication between the step and the manager happened via a
QFutureInterface that was passed into the step's run() function.
Later, new steps were added that operated asynchronously, so the build
manager had to differentiate between the different kinds of steps for
starting and stopping.
These days, almost all build and deploy steps work asynchronously, which
made the QFuture-based interface look increasingly odd.
With this patch, all build steps are expected to work asynchronously, so
the build manager no longer needs to differentiate. Steps are started
and requested to stop via the run() and cancel() functions,
respectively, and emit the finished() signal when they are done. Build
step implementors no longer have to deal with a QFutureInterface. For
steps whose implementation is inherently synchronous, the BuildStep base
class offers a runInThread() function.
Change-Id: If905c68b234c5a669f6e19f43142eaa57d594803
Reviewed-by: hjk <hjk@qt.io>
2019-01-25 14:26:34 +01:00
|
|
|
bool waitForBooted(const QString &serialNumber,
|
|
|
|
|
const std::function<bool()> &cancelChecker) const;
|
2017-04-03 11:11:17 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
const AndroidConfig &m_config;
|
|
|
|
|
std::unique_ptr<AvdManagerOutputParser> m_parser;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Android
|