ProjectExplorer: Replace RunConfiguration::executable

... by a RunConfiguration::commandLine().

That's what is typically consumed, and removes the need for some
custom runnable() implementations.

Change-Id: I7700b12cdd0965802a0add977b432314734a5a72
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-11 14:39:39 +02:00
parent a51b8a061e
commit 7ebe005206
8 changed files with 44 additions and 41 deletions

View File

@@ -201,10 +201,14 @@ RunConfiguration::RunConfiguration(Target *target, Core::Id id)
for (const AspectFactory &factory : theAspectFactories)
m_aspects.append(factory(target));
m_executableGetter = [this] {
m_commandLineGetter = [this] {
FilePath executable;
if (const auto executableAspect = aspect<ExecutableAspect>())
return executableAspect->executable();
return FilePath();
executable = executableAspect->executable();
QString arguments;
if (const auto argumentsAspect = aspect<ArgumentsAspect>())
arguments = argumentsAspect->arguments(macroExpander());
return CommandLine{executable, arguments, CommandLine::Raw};
};
}
@@ -327,14 +331,14 @@ QVariantMap RunConfiguration::toMap() const
return map;
}
void RunConfiguration::setExecutableGetter(const RunConfiguration::ExecutableGetter &exeGetter)
void RunConfiguration::setCommandLineGetter(const CommandLineGetter &cmdGetter)
{
m_executableGetter = exeGetter;
m_commandLineGetter = cmdGetter;
}
FilePath RunConfiguration::executable() const
CommandLine RunConfiguration::commandLine() const
{
return m_executableGetter();
return m_commandLineGetter();
}
BuildTargetInfo RunConfiguration::buildTargetInfo() const
@@ -392,9 +396,7 @@ bool RunConfiguration::fromMap(const QVariantMap &map)
Runnable RunConfiguration::runnable() const
{
Runnable r;
r.executable = executable().toString();
if (auto argumentsAspect = aspect<ArgumentsAspect>())
r.commandLineArguments = argumentsAspect->arguments(macroExpander());
r.setCommandLine(commandLine());
if (auto workingDirectoryAspect = aspect<WorkingDirectoryAspect>())
r.workingDirectory = workingDirectoryAspect->workingDirectory(macroExpander()).toString();
if (auto environmentAspect = aspect<EnvironmentAspect>())