forked from qt-creator/qt-creator
ProjectExplorer: Use FilePath in installRoot machinery
Helps to get path delimiters right. Change-Id: Ifaab593a530c667488b7b5e6546041d8c212ece8 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -117,7 +117,7 @@ ProjectExplorer::DeploymentKnowledge CMakeProject::deploymentKnowledge() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
|
MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
|
||||||
const QString &installRoot)
|
const FilePath &installRoot)
|
||||||
{
|
{
|
||||||
MakeInstallCommand cmd;
|
MakeInstallCommand cmd;
|
||||||
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
|
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
|
||||||
@@ -131,12 +131,12 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
|
|||||||
QStringList config;
|
QStringList config;
|
||||||
|
|
||||||
auto bs = qobject_cast<CMakeBuildSystem*>(target->buildSystem());
|
auto bs = qobject_cast<CMakeBuildSystem*>(target->buildSystem());
|
||||||
if (bs) {
|
QTC_ASSERT(bs, return {});
|
||||||
if (bs->usesAllCapsTargets())
|
|
||||||
installTarget = "INSTALL";
|
if (bs->usesAllCapsTargets())
|
||||||
if (bs->isMultiConfigReader())
|
installTarget = "INSTALL";
|
||||||
config << "--config" << bs->cmakeBuildType();
|
if (bs->isMultiConfigReader())
|
||||||
}
|
config << "--config" << bs->cmakeBuildType();
|
||||||
|
|
||||||
FilePath buildDirectory = ".";
|
FilePath buildDirectory = ".";
|
||||||
if (auto bc = bs->buildConfiguration())
|
if (auto bc = bs->buildConfiguration())
|
||||||
@@ -148,7 +148,7 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
|
|||||||
cmd.command.addArg(installTarget);
|
cmd.command.addArg(installTarget);
|
||||||
cmd.command.addArgs(config);
|
cmd.command.addArgs(config);
|
||||||
|
|
||||||
cmd.environment.set("DESTDIR", QDir::toNativeSeparators(installRoot));
|
cmd.environment.set("DESTDIR", installRoot.nativePath());
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
||||||
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
|
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
|
||||||
const QString &installRoot) override;
|
const Utils::FilePath &installRoot) final;
|
||||||
|
|
||||||
mutable Internal::CMakeProjectImporter *m_projectImporter = nullptr;
|
mutable Internal::CMakeProjectImporter *m_projectImporter = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
#include "mesonproject.h"
|
#include "mesonproject.h"
|
||||||
|
|
||||||
#include "mesonbuildsystem.h"
|
|
||||||
#include "mesonpluginconstants.h"
|
#include "mesonpluginconstants.h"
|
||||||
#include "exewrappers/mesontools.h"
|
|
||||||
#include "settings/tools/kitaspect/mesontoolkitaspect.h"
|
#include "settings/tools/kitaspect/mesontoolkitaspect.h"
|
||||||
#include "settings/tools/kitaspect/ninjatoolkitaspect.h"
|
#include "settings/tools/kitaspect/ninjatoolkitaspect.h"
|
||||||
|
|
||||||
@@ -79,8 +77,8 @@ ProjectExplorer::DeploymentKnowledge MesonProject::deploymentKnowledge() const
|
|||||||
return ProjectExplorer::DeploymentKnowledge::Bad;
|
return ProjectExplorer::DeploymentKnowledge::Bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::MakeInstallCommand MesonProject::makeInstallCommand(
|
ProjectExplorer::MakeInstallCommand MesonProject::makeInstallCommand(const ProjectExplorer::Target *target,
|
||||||
const ProjectExplorer::Target *target, const QString &installRoot)
|
const Utils::FilePath &installRoot)
|
||||||
{
|
{
|
||||||
Q_UNUSED(target)
|
Q_UNUSED(target)
|
||||||
Q_UNUSED(installRoot)
|
Q_UNUSED(installRoot)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
||||||
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
|
ProjectExplorer::MakeInstallCommand makeInstallCommand(const ProjectExplorer::Target *target,
|
||||||
const QString &installRoot) override;
|
const Utils::FilePath &installRoot) final;
|
||||||
|
|
||||||
mutable std::unique_ptr<MesonProjectImporter> m_projectImporter;
|
mutable std::unique_ptr<MesonProjectImporter> m_projectImporter;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -971,7 +971,7 @@ bool Project::hasMakeInstallEquivalent() const
|
|||||||
return d->m_hasMakeInstallEquivalent;
|
return d->m_hasMakeInstallEquivalent;
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeInstallCommand Project::makeInstallCommand(const Target *target, const QString &installRoot)
|
MakeInstallCommand Project::makeInstallCommand(const Target *target, const FilePath &installRoot)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(hasMakeInstallEquivalent(), return MakeInstallCommand());
|
QTC_ASSERT(hasMakeInstallEquivalent(), return MakeInstallCommand());
|
||||||
MakeInstallCommand cmd;
|
MakeInstallCommand cmd;
|
||||||
@@ -980,7 +980,7 @@ MakeInstallCommand Project::makeInstallCommand(const Target *target, const QStri
|
|||||||
cmd.command.setExecutable(makeStep->makeExecutable());
|
cmd.command.setExecutable(makeStep->makeExecutable());
|
||||||
}
|
}
|
||||||
cmd.command.addArg("install");
|
cmd.command.addArg("install");
|
||||||
cmd.command.addArg("INSTALL_ROOT=" + QDir::toNativeSeparators(installRoot));
|
cmd.command.addArg("INSTALL_ROOT=" + installRoot.nativePath());
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ public:
|
|||||||
|
|
||||||
virtual DeploymentKnowledge deploymentKnowledge() const { return DeploymentKnowledge::Bad; }
|
virtual DeploymentKnowledge deploymentKnowledge() const { return DeploymentKnowledge::Bad; }
|
||||||
bool hasMakeInstallEquivalent() const;
|
bool hasMakeInstallEquivalent() const;
|
||||||
virtual MakeInstallCommand makeInstallCommand(const Target *target, const QString &installRoot);
|
virtual MakeInstallCommand makeInstallCommand(const Target *target,
|
||||||
|
const Utils::FilePath &installRoot);
|
||||||
|
|
||||||
void setup(const QList<BuildInfo> &infoList);
|
void setup(const QList<BuildInfo> &infoList);
|
||||||
Utils::MacroExpander *macroExpander() const;
|
Utils::MacroExpander *macroExpander() const;
|
||||||
|
|||||||
@@ -803,7 +803,7 @@ QVariant Target::additionalData(Utils::Id id) const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeInstallCommand Target::makeInstallCommand(const QString &installRoot) const
|
MakeInstallCommand Target::makeInstallCommand(const FilePath &installRoot) const
|
||||||
{
|
{
|
||||||
return project()->makeInstallCommand(this, installRoot);
|
return project()->makeInstallCommand(this, installRoot);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public:
|
|||||||
void setNamedSettings(const QString &name, const QVariant &value);
|
void setNamedSettings(const QString &name, const QVariant &value);
|
||||||
|
|
||||||
QVariant additionalData(Utils::Id id) const;
|
QVariant additionalData(Utils::Id id) const;
|
||||||
MakeInstallCommand makeInstallCommand(const QString &installRoot) const;
|
MakeInstallCommand makeInstallCommand(const Utils::FilePath &installRoot) const;
|
||||||
|
|
||||||
Utils::MacroExpander *macroExpander() const;
|
Utils::MacroExpander *macroExpander() const;
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent
|
|||||||
|
|
||||||
QTemporaryDir tmpDir;
|
QTemporaryDir tmpDir;
|
||||||
installRootAspect->setFilePath(FilePath::fromString(tmpDir.path()));
|
installRootAspect->setFilePath(FilePath::fromString(tmpDir.path()));
|
||||||
const MakeInstallCommand cmd = target()->makeInstallCommand(tmpDir.path());
|
|
||||||
|
const MakeInstallCommand cmd = target()->makeInstallCommand(FilePath::fromString(tmpDir.path()));
|
||||||
QTC_ASSERT(!cmd.command.isEmpty(), return);
|
QTC_ASSERT(!cmd.command.isEmpty(), return);
|
||||||
makeAspect->setExecutable(cmd.command.executable());
|
makeAspect->setExecutable(cmd.command.executable());
|
||||||
}
|
}
|
||||||
@@ -167,7 +168,7 @@ bool MakeInstallStep::init()
|
|||||||
"last in the list of deploy steps. "
|
"last in the list of deploy steps. "
|
||||||
"Consider moving it up.")));
|
"Consider moving it up.")));
|
||||||
}
|
}
|
||||||
const MakeInstallCommand cmd = target()->makeInstallCommand(rootDir.path());
|
const MakeInstallCommand cmd = target()->makeInstallCommand(rootDir);
|
||||||
if (cmd.environment.isValid()) {
|
if (cmd.environment.isValid()) {
|
||||||
Environment env = processParameters()->environment();
|
Environment env = processParameters()->environment();
|
||||||
for (auto it = cmd.environment.constBegin(); it != cmd.environment.constEnd(); ++it) {
|
for (auto it = cmd.environment.constBegin(); it != cmd.environment.constEnd(); ++it) {
|
||||||
@@ -255,7 +256,7 @@ void MakeInstallStep::updateArgsFromAspect()
|
|||||||
if (customCommandLineAspect()->isChecked())
|
if (customCommandLineAspect()->isChecked())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const CommandLine cmd = target()->makeInstallCommand(installRoot().toString()).command;
|
const CommandLine cmd = target()->makeInstallCommand(installRoot()).command;
|
||||||
setUserArguments(cmd.arguments());
|
setUserArguments(cmd.arguments());
|
||||||
updateFullCommandLine();
|
updateFullCommandLine();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user