diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 37b112ac8fe..ca8979b4e35 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -23,38 +23,27 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *targe CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *target, Id id) : RunConfiguration(target, id) { - auto envAspect = addAspect(); - envAspect->setSupportForBuildEnvironment(target); + environment.setSupportForBuildEnvironment(target); - auto exeAspect = addAspect(); - exeAspect->setDeviceSelector(target, ExecutableAspect::HostDevice); - exeAspect->setSettingsKey("ProjectExplorer.CustomExecutableRunConfiguration.Executable"); - exeAspect->setReadOnly(false); - exeAspect->setHistoryCompleter("Qt.CustomExecutable.History"); - exeAspect->setExpectedKind(PathChooser::ExistingCommand); - exeAspect->setEnvironment(envAspect->environment()); + executable.setDeviceSelector(target, ExecutableAspect::HostDevice); + executable.setSettingsKey("ProjectExplorer.CustomExecutableRunConfiguration.Executable"); + executable.setReadOnly(false); + executable.setHistoryCompleter("Qt.CustomExecutable.History"); + executable.setExpectedKind(PathChooser::ExistingCommand); + executable.setEnvironment(environment.environment()); - auto argsAspect = addAspect(); - argsAspect->setMacroExpander(macroExpander()); + arguments.setMacroExpander(macroExpander()); - auto workingDirAspect = addAspect(); - workingDirAspect->setMacroExpander(macroExpander()); - workingDirAspect->setEnvironment(envAspect); + workingDir.setMacroExpander(macroExpander()); + workingDir.setEnvironment(&environment); - addAspect(); - - connect(envAspect, &EnvironmentAspect::environmentChanged, this, [exeAspect, envAspect] { - exeAspect->setEnvironment(envAspect->environment()); + connect(&environment, &EnvironmentAspect::environmentChanged, this, [this] { + executable.setEnvironment(environment.environment()); }); setDefaultDisplayName(defaultDisplayName()); } -FilePath CustomExecutableRunConfiguration::executable() const -{ - return aspect()->executable(); -} - bool CustomExecutableRunConfiguration::isEnabled() const { return true; @@ -64,8 +53,8 @@ Runnable CustomExecutableRunConfiguration::runnable() const { Runnable r; r.command = commandLine(); - r.environment = aspect()->environment(); - r.workingDirectory = aspect()->workingDirectory(); + r.environment = environment.environment(); + r.workingDirectory = workingDir(); if (!r.command.isEmpty()) { const FilePath expanded = macroExpander()->expand(r.command.executable()); diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h index 101516bb2de..5eaced5c493 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h @@ -3,6 +3,8 @@ #pragma once +#include "environmentaspect.h" +#include "runconfigurationaspects.h" #include "runcontrol.h" namespace ProjectExplorer { @@ -23,7 +25,12 @@ private: Tasks checkForIssues() const override; void configurationDialogFinished(); - Utils::FilePath executable() const; + + EnvironmentAspect environment{this}; + ExecutableAspect executable{this}; + ArgumentsAspect arguments{this}; + WorkingDirectoryAspect workingDir{this}; + TerminalAspect terminal{this}; }; class CustomExecutableRunConfigurationFactory : public FixedRunConfigurationFactory