ProjectExplorer: Use CommandLine in MakeInstallCommand

Instead a FilePath/QStringList pair.

Change-Id: I55340795266699e448ec1e17681a5e788eaae37a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-06-10 14:57:28 +02:00
parent fc636755af
commit eb886ad40b
4 changed files with 15 additions and 11 deletions

View File

@@ -123,7 +123,7 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) { if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
if (const auto cmakeStep = bc->buildSteps()->firstOfType<CMakeBuildStep>()) { if (const auto cmakeStep = bc->buildSteps()->firstOfType<CMakeBuildStep>()) {
if (CMakeTool *tool = CMakeKitAspect::cmakeTool(target->kit())) if (CMakeTool *tool = CMakeKitAspect::cmakeTool(target->kit()))
cmd.command = tool->cmakeExecutable(); cmd.command.setExecutable(tool->cmakeExecutable());
} }
} }
@@ -142,8 +142,11 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
if (auto bc = bs->buildConfiguration()) if (auto bc = bs->buildConfiguration())
buildDirectory = bc->buildDirectory(); buildDirectory = bc->buildDirectory();
cmd.arguments << "--build" << buildDirectory.onDevice(cmd.command).path() cmd.command.addArg("--build");
<< "--target" << installTarget << config; cmd.command.addArg(buildDirectory.onDevice(cmd.command.executable()).path());
cmd.command.addArg("--target");
cmd.command.addArg(installTarget);
cmd.command.addArgs(config);
cmd.environment.set("DESTDIR", QDir::toNativeSeparators(installRoot)); cmd.environment.set("DESTDIR", QDir::toNativeSeparators(installRoot));
return cmd; return cmd;

View File

@@ -28,6 +28,7 @@
#include "deployablefile.h" #include "deployablefile.h"
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <utils/commandline.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <QList> #include <QList>
@@ -39,8 +40,7 @@ enum class DeploymentKnowledge { Perfect, Approximative, Bad };
class PROJECTEXPLORER_EXPORT MakeInstallCommand class PROJECTEXPLORER_EXPORT MakeInstallCommand
{ {
public: public:
Utils::FilePath command; Utils::CommandLine command;
QStringList arguments;
Utils::Environment environment; Utils::Environment environment;
}; };

View File

@@ -977,9 +977,10 @@ MakeInstallCommand Project::makeInstallCommand(const Target *target, const QStri
MakeInstallCommand cmd; MakeInstallCommand cmd;
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) { if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
if (const auto makeStep = bc->buildSteps()->firstOfType<MakeStep>()) if (const auto makeStep = bc->buildSteps()->firstOfType<MakeStep>())
cmd.command = makeStep->makeExecutable(); cmd.command.setExecutable(makeStep->makeExecutable());
} }
cmd.arguments << "install" << ("INSTALL_ROOT=" + QDir::toNativeSeparators(installRoot)); cmd.command.addArg("install");
cmd.command.addArg("INSTALL_ROOT=" + QDir::toNativeSeparators(installRoot));
return cmd; return cmd;
} }

View File

@@ -120,7 +120,7 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent
installRootAspect->setFilePath(FilePath::fromString(tmpDir.path())); installRootAspect->setFilePath(FilePath::fromString(tmpDir.path()));
const MakeInstallCommand cmd = target()->makeInstallCommand(tmpDir.path()); const MakeInstallCommand cmd = target()->makeInstallCommand(tmpDir.path());
QTC_ASSERT(!cmd.command.isEmpty(), return); QTC_ASSERT(!cmd.command.isEmpty(), return);
makeAspect->setExecutable(cmd.command); makeAspect->setExecutable(cmd.command.executable());
} }
Utils::Id MakeInstallStep::stepId() Utils::Id MakeInstallStep::stepId()
@@ -254,9 +254,9 @@ void MakeInstallStep::updateArgsFromAspect()
{ {
if (customCommandLineAspect()->isChecked()) if (customCommandLineAspect()->isChecked())
return; return;
setUserArguments(ProcessArgs::joinArgs(target()->makeInstallCommand(
static_cast<StringAspect *>(aspect(InstallRootAspectId))->filePath().toString()) const CommandLine cmd = target()->makeInstallCommand(installRoot().toString()).command;
.arguments)); setUserArguments(cmd.arguments());
updateFullCommandLine(); updateFullCommandLine();
} }