forked from qt-creator/qt-creator
ProjectExplorer: Pass envAspect directly to WorkingDirectory constructor
This trades a now necessary order of setup for the now removed "acquaintSiblings" facility. Change-Id: I85058578b792e210f24573e2ab4e3a40a8813a11 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -591,12 +591,6 @@ QVariant BaseAspect::fromSettingsValue(const QVariant &val) const
|
||||
return d->m_fromSettings ? d->m_fromSettings(val) : val;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
void BaseAspect::acquaintSiblings(const AspectContainer &)
|
||||
{}
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BoolAspectPrivate
|
||||
|
@@ -117,7 +117,6 @@ public:
|
||||
virtual void fromMap(const QVariantMap &map);
|
||||
virtual void toMap(QVariantMap &map) const;
|
||||
virtual void toActiveMap(QVariantMap &map) const { toMap(map); }
|
||||
virtual void acquaintSiblings(const AspectContainer &);
|
||||
|
||||
virtual void addToLayout(LayoutBuilder &builder);
|
||||
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
exeAspect->setPlaceHolderText(tr("Unknown"));
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(nullptr);
|
||||
|
||||
setUpdater([this, exeAspect] {
|
||||
const BuildTargetInfo bti = buildTargetInfo();
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
exeAspect->setExpectedKind(PathChooser::Any);
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(nullptr);
|
||||
|
||||
setDefaultDisplayName(RunConfigurationFactory::decoratedTargetName(tr("Custom Executable"), target));
|
||||
}
|
||||
|
@@ -100,9 +100,10 @@ QdbRunConfiguration::QdbRunConfiguration(Target *target, Utils::Id id)
|
||||
symbolsAspect->setLabelText(tr("Executable on host:"));
|
||||
symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay);
|
||||
|
||||
addAspect<RemoteLinux::RemoteLinuxEnvironmentAspect>(target);
|
||||
auto envAspect = addAspect<RemoteLinux::RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<FullCommandLineAspect>(this);
|
||||
|
||||
setUpdater([this, target, exeAspect, symbolsAspect] {
|
||||
|
@@ -46,7 +46,7 @@ MesonRunConfiguration::MesonRunConfiguration(ProjectExplorer::Target *target, Ut
|
||||
|
||||
addAspect<ProjectExplorer::ExecutableAspect>();
|
||||
addAspect<ProjectExplorer::ArgumentsAspect>();
|
||||
addAspect<ProjectExplorer::WorkingDirectoryAspect>();
|
||||
addAspect<ProjectExplorer::WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<ProjectExplorer::TerminalAspect>();
|
||||
|
||||
auto libAspect = addAspect<ProjectExplorer::UseLibraryPathsAspect>();
|
||||
|
@@ -51,10 +51,10 @@ public:
|
||||
NimbleRunConfiguration(Target *target, Utils::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
addAspect<LocalEnvironmentAspect>(target);
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setUpdater([this] {
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
{
|
||||
addAspect<ExecutableAspect>()->setExecutable(Nim::nimblePathFromKit(target->kit()));
|
||||
addAspect<ArgumentsAspect>()->setArguments("test");
|
||||
addAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(project()->projectDirectory());
|
||||
addAspect<WorkingDirectoryAspect>(nullptr)->setDefaultWorkingDirectory(project()->projectDirectory());
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setDisplayName(tr("Nimble Test"));
|
||||
|
@@ -49,10 +49,10 @@ public:
|
||||
NimRunConfiguration(Target *target, Utils::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
addAspect<LocalEnvironmentAspect>(target);
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setDisplayName(tr("Current Build Target"));
|
||||
|
@@ -302,8 +302,6 @@ void BuildConfiguration::doInitialize(const BuildInfo &info)
|
||||
for (Utils::Id id : qAsConst(d->m_initialCleanSteps))
|
||||
d->m_cleanSteps.appendStep(id);
|
||||
|
||||
acquaintAspects();
|
||||
|
||||
if (d->m_initializer)
|
||||
d->m_initializer(info);
|
||||
}
|
||||
@@ -791,7 +789,6 @@ BuildConfiguration *BuildConfigurationFactory::restore(Target *parent, const QVa
|
||||
if (!id.name().startsWith(factory->m_buildConfigId.name()))
|
||||
continue;
|
||||
BuildConfiguration *bc = factory->m_creator(parent);
|
||||
bc->acquaintAspects();
|
||||
QTC_ASSERT(bc, return nullptr);
|
||||
if (!bc->fromMap(map)) {
|
||||
delete bc;
|
||||
|
@@ -54,7 +54,7 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *targe
|
||||
exeAspect->setEnvironmentChange(EnvironmentChange::fromFixedEnvironment(envAspect->environment()));
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
connect(envAspect, &EnvironmentAspect::environmentChanged, this, [exeAspect, envAspect] {
|
||||
|
@@ -70,7 +70,7 @@ DesktopRunConfiguration::DesktopRunConfiguration(Target *target, Id id, Kind kin
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
|
@@ -140,12 +140,6 @@ Utils::BaseAspect *ProjectConfiguration::aspect(Utils::Id id) const
|
||||
return m_aspects.aspect(id);
|
||||
}
|
||||
|
||||
void ProjectConfiguration::acquaintAspects()
|
||||
{
|
||||
for (Utils::BaseAspect *aspect : m_aspects)
|
||||
aspect->acquaintSiblings(m_aspects);
|
||||
}
|
||||
|
||||
void ProjectConfiguration::doPostInit()
|
||||
{
|
||||
for (const std::function<void()> &postInit : qAsConst(m_postInit))
|
||||
|
@@ -87,8 +87,6 @@ public:
|
||||
Utils::BaseAspect *aspect(Utils::Id id) const;
|
||||
template <typename T> T *aspect() const { return m_aspects.aspect<T>(); }
|
||||
|
||||
void acquaintAspects();
|
||||
|
||||
Utils::FilePath mapFromBuildDeviceToGlobalPath(const Utils::FilePath &path) const;
|
||||
|
||||
void addPostInit(const std::function<void()> &fixup) { m_postInit.append(fixup); }
|
||||
|
@@ -584,7 +584,6 @@ RunConfiguration *RunConfigurationFactory::create(Target *target) const
|
||||
for (const RunConfiguration::AspectFactory &factory : theAspectFactories)
|
||||
rc->m_aspects.registerAspect(factory(target));
|
||||
|
||||
rc->acquaintAspects();
|
||||
rc->doPostInit();
|
||||
return rc;
|
||||
}
|
||||
|
@@ -164,7 +164,8 @@ bool TerminalAspect::isUserSet() const
|
||||
working directory for running the executable.
|
||||
*/
|
||||
|
||||
WorkingDirectoryAspect::WorkingDirectoryAspect()
|
||||
WorkingDirectoryAspect::WorkingDirectoryAspect(EnvironmentAspect *envAspect)
|
||||
: m_envAspect(envAspect)
|
||||
{
|
||||
setDisplayName(tr("Working Directory"));
|
||||
setId("WorkingDirectoryAspect");
|
||||
@@ -207,11 +208,6 @@ void WorkingDirectoryAspect::addToLayout(LayoutBuilder &builder)
|
||||
builder.addItems({tr("Working directory:"), m_chooser.data(), m_resetButton.data()});
|
||||
}
|
||||
|
||||
void WorkingDirectoryAspect::acquaintSiblings(const AspectContainer &siblings)
|
||||
{
|
||||
m_envAspect = siblings.aspect<EnvironmentAspect>();
|
||||
}
|
||||
|
||||
void WorkingDirectoryAspect::resetPath()
|
||||
{
|
||||
m_chooser->setFilePath(m_defaultWorkingDirectory);
|
||||
|
@@ -41,6 +41,8 @@ namespace Utils { class ExpandButton; }
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class ProjectConfiguration;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT TerminalAspect : public Utils::BaseAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -78,10 +80,9 @@ class PROJECTEXPLORER_EXPORT WorkingDirectoryAspect : public Utils::BaseAspect
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WorkingDirectoryAspect();
|
||||
explicit WorkingDirectoryAspect(EnvironmentAspect *envAspect);
|
||||
|
||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
||||
void acquaintSiblings(const Utils::AspectContainer &) override;
|
||||
|
||||
Utils::FilePath workingDirectory() const;
|
||||
Utils::FilePath defaultWorkingDirectory() const;
|
||||
|
@@ -277,7 +277,7 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Utils::Id id)
|
||||
|
||||
auto argumentsAspect = addAspect<ArgumentsAspect>();
|
||||
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(nullptr);
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setCommandLineGetter([this, bufferedAspect, interpreterAspect, argumentsAspect] {
|
||||
|
@@ -59,10 +59,11 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Utils::Id id)
|
||||
symbolsAspect->setLabelText(tr("Executable on host:"));
|
||||
symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay);
|
||||
|
||||
auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
auto libAspect = addAspect<StringAspect>();
|
||||
libAspect->setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath");
|
||||
|
@@ -57,6 +57,8 @@ private:
|
||||
RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
auto exeAspect = addAspect<ExecutableAspect>();
|
||||
exeAspect->setSettingsKey("RemoteLinux.CustomRunConfig.RemoteExecutable");
|
||||
exeAspect->setLabelText(tr("Remote executable:"));
|
||||
@@ -71,10 +73,9 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar
|
||||
symbolsAspect->setDisplayStyle(SymbolFileAspect::PathChooserDisplay);
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<TerminalAspect>();
|
||||
addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<X11ForwardingAspect>();
|
||||
|
||||
|
@@ -57,6 +57,8 @@ public:
|
||||
RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
auto exeAspect = addAspect<ExecutableAspect>();
|
||||
exeAspect->setLabelText(tr("Executable on device:"));
|
||||
exeAspect->setExecutablePathStyle(OsTypeLinux);
|
||||
@@ -70,10 +72,9 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
||||
symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay);
|
||||
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<WorkingDirectoryAspect>(envAspect);
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<TerminalAspect>();
|
||||
addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
addAspect<X11ForwardingAspect>();
|
||||
|
||||
|
Reference in New Issue
Block a user