ProjectExplorer: De-virtualize EnvironmentAspect::baseEnvironment

Will help to streamline *EnvironmentAspect constructor signature,
which in turn will help to have a generic cloning mechanism to
clone aspect data, which in turn will help to finally execute on
the idea that RunControls should be re-runnable in their original
setup and also resilient to changes in the setup while they are
running.

Change-Id: Ibdaca487c1f7ce043e675fd014fe923a70273639
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-03-07 09:08:40 +01:00
parent 2f02dcf994
commit ac1b0facc0
16 changed files with 88 additions and 262 deletions

View File

@@ -50,8 +50,7 @@ HEADERS += \
androidsdkmanagerwidget.h \
androidpackageinstallationstep.h \
androidextralibrarylistmodel.h \
createandroidmanifestwizard.h \
androidrunenvironmentaspect.h
createandroidmanifestwizard.h
SOURCES += \
androidconfigurations.cpp \
@@ -95,8 +94,7 @@ SOURCES += \
androidsdkmanagerwidget.cpp \
androidpackageinstallationstep.cpp \
androidextralibrarylistmodel.cpp \
createandroidmanifestwizard.cpp \
androidrunenvironmentaspect.cpp
createandroidmanifestwizard.cpp
FORMS += \
androidsettingswidget.ui \

View File

@@ -75,8 +75,6 @@ Project {
"androidqtversion.h",
"androidrunconfiguration.cpp",
"androidrunconfiguration.h",
"androidrunenvironmentaspect.h",
"androidrunenvironmentaspect.cpp",
"androidruncontrol.cpp",
"androidruncontrol.h",
"androidrunner.cpp",

View File

@@ -30,7 +30,6 @@
#include "androidtoolchain.h"
#include "androidmanager.h"
#include "adbcommandswidget.h"
#include "androidrunenvironmentaspect.h"
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/project.h>
@@ -108,7 +107,11 @@ void BaseStringListAspect::setLabel(const QString &label)
AndroidRunConfiguration::AndroidRunConfiguration(Target *target, Core::Id id)
: RunConfiguration(target, id)
{
addAspect<AndroidRunEnvironmentAspect>();
enum BaseEnvironmentBase { CleanEnvironmentBase };
auto envAspect = addAspect<EnvironmentAspect>();
envAspect->addSupportedBaseEnvironment(CleanEnvironmentBase, tr("Clean Environment"));
envAspect->setBaseEnvironmentGetter([] { return Utils::Environment(); });
addAspect<ArgumentsAspect>();
auto amStartArgsAspect = addAspect<BaseStringAspect>();

View File

@@ -1,47 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2018 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.
**
****************************************************************************/
#include "androidrunenvironmentaspect.h"
namespace {
enum BaseEnvironmentBase {
CleanEnvironmentBase
};
}
namespace Android {
AndroidRunEnvironmentAspect::AndroidRunEnvironmentAspect()
{
addSupportedBaseEnvironment(CleanEnvironmentBase, tr("Clean Environment"));
}
Utils::Environment AndroidRunEnvironmentAspect::baseEnvironment() const
{
// Clean Environment
return Utils::Environment();
}
} // namespace Android

View File

@@ -1,42 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2018 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 <projectexplorer/environmentaspect.h>
namespace Android {
class AndroidRunEnvironmentAspect : public ProjectExplorer::EnvironmentAspect
{
Q_OBJECT
public:
AndroidRunEnvironmentAspect();
Utils::Environment baseEnvironment() const override;
};
} // namespace Android