2016-01-15 14:57:40 +01:00
|
|
|
/****************************************************************************
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 BogDan Vatra <bog_dan_ro@yahoo.com>
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2012-04-18 20:30:57 +03:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
#include "androidrunconfiguration.h"
|
2018-05-04 16:01:13 +02:00
|
|
|
|
|
|
|
|
#include "androidconstants.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
#include "androidglobal.h"
|
|
|
|
|
#include "androidtoolchain.h"
|
2012-04-24 15:49:09 +02:00
|
|
|
#include "androidmanager.h"
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2020-07-31 17:41:28 +02:00
|
|
|
#include <app/app_version.h>
|
|
|
|
|
|
2019-11-15 15:44:45 +01:00
|
|
|
#include <projectexplorer/buildsystem.h>
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <projectexplorer/kitinformation.h>
|
2018-05-04 11:13:43 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2021-03-25 19:10:35 +01:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
2012-04-24 15:49:09 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2018-05-04 11:13:43 +02:00
|
|
|
|
2012-09-03 18:31:44 +02:00
|
|
|
#include <qtsupport/qtkitinformation.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
|
2018-05-04 16:01:13 +02:00
|
|
|
#include <utils/detailswidget.h>
|
2012-04-18 20:30:57 +03:00
|
|
|
#include <utils/qtcassert.h>
|
2018-05-04 16:01:13 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
|
#include <utils/utilsicons.h>
|
|
|
|
|
|
2012-07-25 17:41:01 +02:00
|
|
|
using namespace ProjectExplorer;
|
2018-05-04 16:01:13 +02:00
|
|
|
using namespace Utils;
|
2012-04-18 20:30:57 +03:00
|
|
|
|
|
|
|
|
namespace Android {
|
2017-06-08 14:57:09 +02:00
|
|
|
|
2021-03-25 19:10:35 +01:00
|
|
|
class BaseStringListAspect final : public Utils::StringAspect
|
2012-04-18 20:30:57 +03:00
|
|
|
{
|
2021-03-25 19:10:35 +01:00
|
|
|
public:
|
|
|
|
|
explicit BaseStringListAspect() = default;
|
|
|
|
|
~BaseStringListAspect() final = default;
|
|
|
|
|
|
|
|
|
|
void fromMap(const QVariantMap &map) final
|
|
|
|
|
{
|
|
|
|
|
// Pre Qt Creator 5.0 hack: Reads QStringList as QString
|
|
|
|
|
setValue(map.value(settingsKey()).toStringList().join('\n'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toMap(QVariantMap &map) const final
|
|
|
|
|
{
|
|
|
|
|
// Pre Qt Creator 5.0 hack: Writes QString as QStringList
|
|
|
|
|
map.insert(settingsKey(), value().split('\n'));
|
|
|
|
|
}
|
|
|
|
|
};
|
2017-05-15 14:48:39 +02:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Utils::Id id)
|
2018-05-04 16:01:13 +02:00
|
|
|
: RunConfiguration(target, id)
|
2017-06-08 14:57:09 +02:00
|
|
|
{
|
2019-03-07 09:08:40 +01:00
|
|
|
auto envAspect = addAspect<EnvironmentAspect>();
|
2019-03-07 10:10:22 +01:00
|
|
|
envAspect->addSupportedBaseEnvironment(tr("Clean Environment"), {});
|
2019-03-07 09:08:40 +01:00
|
|
|
|
2020-08-24 09:24:22 +03:00
|
|
|
auto extraAppArgsAspect = addAspect<ArgumentsAspect>();
|
|
|
|
|
|
2020-09-18 12:11:40 +02:00
|
|
|
connect(extraAppArgsAspect, &BaseAspect::changed,
|
2020-09-11 13:19:59 +02:00
|
|
|
this, [target, extraAppArgsAspect]() {
|
2020-08-24 09:24:22 +03:00
|
|
|
if (target->buildConfigurations().first()->buildType() == BuildConfiguration::BuildType::Release) {
|
|
|
|
|
const QString buildKey = target->activeBuildKey();
|
|
|
|
|
target->buildSystem()->setExtraData(buildKey,
|
2021-09-05 18:49:26 +03:00
|
|
|
Android::Constants::AndroidApplicationArgs,
|
|
|
|
|
extraAppArgsAspect->arguments(target->macroExpander()));
|
2020-08-24 09:24:22 +03:00
|
|
|
}
|
|
|
|
|
});
|
2018-07-31 12:21:47 +02:00
|
|
|
|
2020-08-13 09:16:00 +02:00
|
|
|
auto amStartArgsAspect = addAspect<StringAspect>();
|
2021-09-05 18:49:26 +03:00
|
|
|
amStartArgsAspect->setId(Constants::ANDROID_AM_START_ARGS);
|
2018-05-04 16:01:13 +02:00
|
|
|
amStartArgsAspect->setSettingsKey("Android.AmStartArgsKey");
|
2021-10-04 13:28:06 +03:00
|
|
|
amStartArgsAspect->setLabelText(tr("Activity manager start arguments:"));
|
2020-08-13 09:16:00 +02:00
|
|
|
amStartArgsAspect->setDisplayStyle(StringAspect::LineEditDisplay);
|
2018-05-31 14:41:59 +02:00
|
|
|
amStartArgsAspect->setHistoryCompleter("Android.AmStartArgs.History");
|
2018-05-04 16:01:13 +02:00
|
|
|
|
2018-09-04 10:36:44 +02:00
|
|
|
auto preStartShellCmdAspect = addAspect<BaseStringListAspect>();
|
2021-03-25 19:10:35 +01:00
|
|
|
preStartShellCmdAspect->setDisplayStyle(StringAspect::TextEditDisplay);
|
2018-05-15 12:11:54 +02:00
|
|
|
preStartShellCmdAspect->setId(Constants::ANDROID_PRESTARTSHELLCMDLIST);
|
2018-05-04 16:01:13 +02:00
|
|
|
preStartShellCmdAspect->setSettingsKey("Android.PreStartShellCmdListKey");
|
2021-03-25 19:10:35 +01:00
|
|
|
preStartShellCmdAspect->setLabelText(tr("Pre-launch on-device shell commands:"));
|
2018-05-04 16:01:13 +02:00
|
|
|
|
2018-09-04 10:36:44 +02:00
|
|
|
auto postStartShellCmdAspect = addAspect<BaseStringListAspect>();
|
2021-03-25 19:10:35 +01:00
|
|
|
postStartShellCmdAspect->setDisplayStyle(StringAspect::TextEditDisplay);
|
2018-05-15 12:11:54 +02:00
|
|
|
postStartShellCmdAspect->setId(Constants::ANDROID_POSTFINISHSHELLCMDLIST);
|
2018-05-04 16:01:13 +02:00
|
|
|
postStartShellCmdAspect->setSettingsKey("Android.PostStartShellCmdListKey");
|
2021-03-25 19:10:35 +01:00
|
|
|
postStartShellCmdAspect->setLabelText(tr("Post-quit on-device shell commands:"));
|
2018-05-04 16:01:13 +02:00
|
|
|
|
2019-11-25 16:57:48 +01:00
|
|
|
setUpdater([this, target] {
|
|
|
|
|
const BuildTargetInfo bti = buildTargetInfo();
|
|
|
|
|
setDisplayName(bti.displayName);
|
|
|
|
|
setDefaultDisplayName(bti.displayName);
|
|
|
|
|
AndroidManager::updateGradleProperties(target, buildKey());
|
2018-05-04 16:01:13 +02:00
|
|
|
});
|
2019-11-25 16:57:48 +01:00
|
|
|
|
|
|
|
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
2017-06-08 14:57:09 +02:00
|
|
|
}
|
|
|
|
|
|
2012-04-18 20:30:57 +03:00
|
|
|
} // namespace Android
|