forked from qt-creator/qt-creator
ProjectExplorer: Use Utils::FileName in ProcessParameters
For the command and the working directory. Change-Id: Ia69dc7100aeb57bb6e1b35f4dd4f3cf3763d8cda Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -690,6 +690,11 @@ QString Environment::expandVariables(const QString &input) const
|
||||
return result;
|
||||
}
|
||||
|
||||
FileName Environment::expandVariables(const FileName &variables) const
|
||||
{
|
||||
return FileName::fromString(expandVariables(variables.toString()));
|
||||
}
|
||||
|
||||
QStringList Environment::expandVariables(const QStringList &variables) const
|
||||
{
|
||||
return Utils::transform(variables, [this](const QString &i) { return expandVariables(i); });
|
||||
|
@@ -135,6 +135,7 @@ public:
|
||||
bool isSameExecutable(const QString &exe1, const QString &exe2) const;
|
||||
|
||||
QString expandVariables(const QString &input) const;
|
||||
FileName expandVariables(const FileName &input) const;
|
||||
QStringList expandVariables(const QStringList &input) const;
|
||||
|
||||
bool operator!=(const Environment &other) const;
|
||||
|
@@ -290,6 +290,11 @@ QString MacroExpander::expand(const QString &stringWithVariables) const
|
||||
return res;
|
||||
}
|
||||
|
||||
FileName MacroExpander::expand(const FileName &fileNameWithVariables) const
|
||||
{
|
||||
return FileName::fromString(expand(fileNameWithVariables.toString()));
|
||||
}
|
||||
|
||||
QByteArray MacroExpander::expand(const QByteArray &stringWithVariables) const
|
||||
{
|
||||
return expand(QString::fromLatin1(stringWithVariables)).toLatin1();
|
||||
|
@@ -37,6 +37,7 @@ namespace Utils {
|
||||
|
||||
namespace Internal { class MacroExpanderPrivate; }
|
||||
|
||||
class FileName;
|
||||
class MacroExpander;
|
||||
using MacroExpanderProvider = std::function<MacroExpander *()>;
|
||||
using MacroExpanderProviders = QVector<MacroExpanderProvider>;
|
||||
@@ -55,6 +56,7 @@ public:
|
||||
QString value(const QByteArray &variable, bool *found = nullptr) const;
|
||||
|
||||
QString expand(const QString &stringWithVariables) const;
|
||||
FileName expand(const FileName &fileNameWithVariables) const;
|
||||
QByteArray expand(const QByteArray &stringWithVariables) const;
|
||||
QVariant expandVariant(const QVariant &v) const;
|
||||
|
||||
|
@@ -70,6 +70,7 @@
|
||||
#include <memory>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
using namespace Android::Internal;
|
||||
|
||||
namespace {
|
||||
@@ -90,10 +91,10 @@ static void setupProcessParameters(ProcessParameters *pp,
|
||||
const QString &command)
|
||||
{
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
Utils::Environment env = bc->environment();
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommand(command);
|
||||
pp->setCommand(FileName::fromString(command));
|
||||
pp->setArguments(Utils::QtcProcess::joinArgs(arguments));
|
||||
pp->resolveAll();
|
||||
}
|
||||
@@ -279,7 +280,7 @@ bool AndroidBuildApkStep::init()
|
||||
// Generate arguments with keystore password concealed
|
||||
ProjectExplorer::ProcessParameters pp2;
|
||||
setupProcessParameters(&pp2, bc, argumentsPasswordConcealed, command);
|
||||
m_command = pp2.effectiveCommand();
|
||||
m_command = pp2.effectiveCommand().toString();
|
||||
m_argumentsPasswordConcealed = pp2.prettyArguments();
|
||||
|
||||
return true;
|
||||
|
@@ -72,8 +72,8 @@ bool AndroidPackageInstallationStep::init()
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setCommand(tc->makeCommand(bc->environment()).toString());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setCommand(tc->makeCommand(bc->environment()));
|
||||
Environment env = bc->environment();
|
||||
Environment::setupEnglishOutput(&env);
|
||||
pp->setEnvironment(env);
|
||||
|
@@ -77,9 +77,8 @@ bool AutogenStep::init()
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
pp->setWorkingDirectory(projectDir);
|
||||
pp->setCommand("./autogen.sh");
|
||||
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
pp->setCommand(Utils::FileName::fromString("./autogen.sh"));
|
||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -122,9 +121,8 @@ BuildStepConfigWidget *AutogenStep::createConfigWidget()
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
param.setWorkingDirectory(projectDir);
|
||||
param.setCommand("./autogen.sh");
|
||||
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
param.setCommand(Utils::FileName::fromString("./autogen.sh"));
|
||||
param.setArguments(m_additionalArgumentsAspect->value());
|
||||
|
||||
widget->setSummaryText(param.summary(displayName()));
|
||||
|
@@ -75,9 +75,8 @@ bool AutoreconfStep::init()
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
pp->setWorkingDirectory(projectDir);
|
||||
pp->setCommand("autoreconf");
|
||||
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
pp->setCommand(Utils::FileName::fromString("autoreconf"));
|
||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -114,9 +113,8 @@ BuildStepConfigWidget *AutoreconfStep::createConfigWidget()
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
param.setWorkingDirectory(projectDir);
|
||||
param.setCommand("autoreconf");
|
||||
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
param.setCommand(Utils::FileName::fromString("autoreconf"));
|
||||
param.setArguments(m_additionalArgumentsAspect->value());
|
||||
|
||||
widget->setSummaryText(param.summary(displayName()));
|
||||
|
@@ -97,8 +97,8 @@ bool ConfigureStep::init()
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setCommand(Utils::FileName::fromString(projectDirRelativeToBuildDir(bc) + "configure"));
|
||||
pp->setArguments(m_additionalArgumentsAspect->value());
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -158,8 +158,8 @@ void ConfigureStep::updateDetails()
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||
param.setCommand(projectDirRelativeToBuildDir(bc) + "configure");
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setCommand(Utils::FileName::fromString(projectDirRelativeToBuildDir(bc) + "configure"));
|
||||
param.setArguments(m_additionalArgumentsAspect->value());
|
||||
|
||||
m_widget->setSummaryText(param.summaryInWorkdir(displayName()));
|
||||
|
@@ -218,7 +218,7 @@ bool CMakeBuildStep::init()
|
||||
if (!env.value("NINJA_STATUS").startsWith(m_ninjaProgressString))
|
||||
env.set("NINJA_STATUS", m_ninjaProgressString + "%o/sec] ");
|
||||
pp->setEnvironment(env);
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setCommand(cmakeCommand());
|
||||
pp->setArguments(arguments);
|
||||
pp->resolveAll();
|
||||
@@ -373,10 +373,10 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
|
||||
return arguments;
|
||||
}
|
||||
|
||||
QString CMakeBuildStep::cmakeCommand() const
|
||||
Utils::FileName CMakeBuildStep::cmakeCommand() const
|
||||
{
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(target()->kit());
|
||||
return tool ? tool->cmakeExecutable().toString() : QString();
|
||||
return tool ? tool->cmakeExecutable() : Utils::FileName();
|
||||
}
|
||||
|
||||
QString CMakeBuildStep::cleanTarget()
|
||||
@@ -531,7 +531,7 @@ void CMakeBuildStepConfigWidget::updateDetails()
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setCommand(m_buildStep->cmakeCommand());
|
||||
param.setArguments(m_buildStep->allArguments(nullptr));
|
||||
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
QString allArguments(const CMakeRunConfiguration *rc) const;
|
||||
|
||||
QString cmakeCommand() const;
|
||||
Utils::FileName cmakeCommand() const;
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
|
@@ -635,7 +635,7 @@ MakeInstallCommand CMakeProject::makeInstallCommand(const Target *target,
|
||||
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
|
||||
if (const auto cmakeStep = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
||||
->firstOfType<CMakeBuildStep>()) {
|
||||
cmd.command = FileName::fromString(cmakeStep->cmakeCommand());
|
||||
cmd.command = cmakeStep->cmakeCommand();
|
||||
}
|
||||
}
|
||||
cmd.arguments << "--build" << "." << "--target" << "install";
|
||||
|
@@ -87,11 +87,11 @@ bool IosBuildStep::init()
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
Utils::Environment env = bc->environment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommand(buildCommand());
|
||||
pp->setCommand(Utils::FileName::fromString(buildCommand()));
|
||||
pp->setArguments(Utils::QtcProcess::joinArgs(allArguments()));
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -251,9 +251,9 @@ void IosBuildStepConfigWidget::updateDetails()
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setCommand(m_buildStep->buildCommand());
|
||||
param.setCommand(Utils::FileName::fromString(m_buildStep->buildCommand()));
|
||||
param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->allArguments()));
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
|
@@ -68,11 +68,11 @@ bool IosDsymBuildStep::init()
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
Utils::Environment env = bc->environment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommand(command());
|
||||
pp->setCommand(Utils::FileName::fromString(command()));
|
||||
pp->setArguments(Utils::QtcProcess::joinArgs(arguments()));
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -268,9 +268,9 @@ void IosDsymBuildStepConfigWidget::updateDetails()
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setCommand(m_buildStep->command());
|
||||
param.setCommand(Utils::FileName::fromString(m_buildStep->command()));
|
||||
param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->arguments()));
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
|
@@ -228,14 +228,14 @@ void NimCompilerBuildStep::updateCommand()
|
||||
Kit *kit = target()->kit();
|
||||
auto tc = dynamic_cast<NimToolChain*>(ToolChainKitAspect::toolChain(kit, Constants::C_NIMLANGUAGE_ID));
|
||||
QTC_ASSERT(tc, return);
|
||||
processParameters()->setCommand(tc->compilerCommand().toString());
|
||||
processParameters()->setCommand(tc->compilerCommand());
|
||||
}
|
||||
|
||||
void NimCompilerBuildStep::updateWorkingDirectory()
|
||||
{
|
||||
auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration());
|
||||
QTC_ASSERT(bc, return);
|
||||
processParameters()->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
processParameters()->setWorkingDirectory(bc->buildDirectory());
|
||||
}
|
||||
|
||||
void NimCompilerBuildStep::updateArguments()
|
||||
|
@@ -104,7 +104,7 @@ void NimCompilerBuildStepConfigWidget::updateCommandLineText()
|
||||
ProcessParameters *parameters = m_buildStep->processParameters();
|
||||
|
||||
QStringList command;
|
||||
command << parameters->command();
|
||||
command << parameters->command().toString();
|
||||
command << parameters->arguments();
|
||||
|
||||
// Remove empty args
|
||||
|
@@ -200,7 +200,7 @@ bool AbstractProcessStep::init()
|
||||
|
||||
void AbstractProcessStep::doRun()
|
||||
{
|
||||
QDir wd(d->m_param.effectiveWorkingDirectory());
|
||||
QDir wd(d->m_param.effectiveWorkingDirectory().toString());
|
||||
if (!wd.exists()) {
|
||||
if (!wd.mkpath(wd.absolutePath())) {
|
||||
emit addOutput(tr("Could not create directory \"%1\"")
|
||||
@@ -211,7 +211,7 @@ void AbstractProcessStep::doRun()
|
||||
}
|
||||
}
|
||||
|
||||
QString effectiveCommand = d->m_param.effectiveCommand();
|
||||
QString effectiveCommand = d->m_param.effectiveCommand().toString();
|
||||
if (!QFileInfo::exists(effectiveCommand)) {
|
||||
processStartupFailed();
|
||||
finish(false);
|
||||
@@ -275,7 +275,7 @@ void AbstractProcessStep::cleanUp(QProcess *process)
|
||||
void AbstractProcessStep::processStarted()
|
||||
{
|
||||
emit addOutput(tr("Starting: \"%1\" %2")
|
||||
.arg(QDir::toNativeSeparators(d->m_param.effectiveCommand()),
|
||||
.arg(QDir::toNativeSeparators(d->m_param.effectiveCommand().toString()),
|
||||
d->m_param.prettyArguments()),
|
||||
BuildStep::OutputFormat::NormalMessage);
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void AbstractProcessStep::processFinished(int exitCode, QProcess::ExitStatus sta
|
||||
if (d->m_outputParserChain)
|
||||
d->m_outputParserChain->flush();
|
||||
|
||||
QString command = QDir::toNativeSeparators(d->m_param.effectiveCommand());
|
||||
QString command = QDir::toNativeSeparators(d->m_param.effectiveCommand().toString());
|
||||
if (status == QProcess::NormalExit && exitCode == 0) {
|
||||
emit addOutput(tr("The process \"%1\" exited normally.").arg(command),
|
||||
BuildStep::OutputFormat::NormalMessage);
|
||||
@@ -313,7 +313,7 @@ void AbstractProcessStep::processFinished(int exitCode, QProcess::ExitStatus sta
|
||||
void AbstractProcessStep::processStartupFailed()
|
||||
{
|
||||
emit addOutput(tr("Could not start process \"%1\" %2")
|
||||
.arg(QDir::toNativeSeparators(d->m_param.effectiveCommand()),
|
||||
.arg(QDir::toNativeSeparators(d->m_param.effectiveCommand().toString()),
|
||||
d->m_param.prettyArguments()),
|
||||
BuildStep::OutputFormat::ErrorMessage);
|
||||
}
|
||||
|
@@ -207,6 +207,11 @@ void IOutputParser::setWorkingDirectory(const QString &workingDirectory)
|
||||
m_parser->setWorkingDirectory(workingDirectory);
|
||||
}
|
||||
|
||||
void IOutputParser::setWorkingDirectory(const Utils::FileName &fn)
|
||||
{
|
||||
setWorkingDirectory(fn.toString());
|
||||
}
|
||||
|
||||
void IOutputParser::flush()
|
||||
{
|
||||
doFlush();
|
||||
|
@@ -53,6 +53,7 @@ public:
|
||||
|
||||
virtual bool hasFatalErrors() const;
|
||||
virtual void setWorkingDirectory(const QString &workingDirectory);
|
||||
void setWorkingDirectory(const Utils::FileName &fn);
|
||||
|
||||
void flush(); // flush out pending tasks
|
||||
|
||||
|
@@ -79,7 +79,7 @@ bool MakeStep::init()
|
||||
if (!bc)
|
||||
emit addTask(Task::buildConfigurationMissingTask());
|
||||
|
||||
const QString make = effectiveMakeCommand();
|
||||
const FileName make = effectiveMakeCommand();
|
||||
if (make.isEmpty())
|
||||
emit addTask(makeCommandMissingTask());
|
||||
|
||||
@@ -90,7 +90,7 @@ bool MakeStep::init()
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory().toString());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setEnvironment(environment(bc));
|
||||
pp->setCommand(make);
|
||||
pp->setArguments(allArguments());
|
||||
@@ -105,7 +105,7 @@ bool MakeStep::init()
|
||||
IOutputParser *parser = target()->kit()->createOutputParser();
|
||||
if (parser)
|
||||
appendOutputParser(parser);
|
||||
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
|
||||
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory().toString());
|
||||
|
||||
return AbstractProcessStep::init();
|
||||
}
|
||||
@@ -143,18 +143,18 @@ static const QList<ToolChain *> preferredToolChains(const Kit *kit)
|
||||
return tcs;
|
||||
}
|
||||
|
||||
QString MakeStep::defaultMakeCommand() const
|
||||
FileName MakeStep::defaultMakeCommand() const
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
if (!bc)
|
||||
return QString();
|
||||
return {};
|
||||
const Utils::Environment env = environment(bc);
|
||||
for (const ToolChain *tc : preferredToolChains(target()->kit())) {
|
||||
FileName make = tc->makeCommand(env);
|
||||
if (!make.isEmpty())
|
||||
return make.toString();
|
||||
return make;
|
||||
}
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
QString MakeStep::msgNoMakeCommand()
|
||||
@@ -260,7 +260,7 @@ Utils::Environment MakeStep::environment(BuildConfiguration *bc) const
|
||||
return env;
|
||||
}
|
||||
|
||||
void MakeStep::setMakeCommand(const QString &command)
|
||||
void MakeStep::setMakeCommand(const FileName &command)
|
||||
{
|
||||
m_makeCommand = command;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ QVariantMap MakeStep::toMap() const
|
||||
|
||||
map.insert(id().withSuffix(BUILD_TARGETS_SUFFIX).toString(), m_buildTargets);
|
||||
map.insert(id().withSuffix(MAKE_ARGUMENTS_SUFFIX).toString(), m_makeArguments);
|
||||
map.insert(id().withSuffix(MAKE_COMMAND_SUFFIX).toString(), m_makeCommand);
|
||||
map.insert(id().withSuffix(MAKE_COMMAND_SUFFIX).toString(), m_makeCommand.toString());
|
||||
map.insert(id().withSuffix(CLEAN_SUFFIX).toString(), m_clean);
|
||||
const QString jobCountKey = id().withSuffix(JOBCOUNT_SUFFIX).toString();
|
||||
if (m_userJobCount != defaultJobCount())
|
||||
@@ -286,7 +286,8 @@ bool MakeStep::fromMap(const QVariantMap &map)
|
||||
{
|
||||
m_buildTargets = map.value(id().withSuffix(BUILD_TARGETS_SUFFIX).toString()).toStringList();
|
||||
m_makeArguments = map.value(id().withSuffix(MAKE_ARGUMENTS_SUFFIX).toString()).toString();
|
||||
m_makeCommand = map.value(id().withSuffix(MAKE_COMMAND_SUFFIX).toString()).toString();
|
||||
m_makeCommand = FileName::fromString(
|
||||
map.value(id().withSuffix(MAKE_COMMAND_SUFFIX).toString()).toString());
|
||||
m_clean = map.value(id().withSuffix(CLEAN_SUFFIX).toString()).toBool();
|
||||
m_overrideMakeflags = map.value(id().withSuffix(OVERRIDE_MAKEFLAGS_SUFFIX).toString(), false).toBool();
|
||||
m_userJobCount = map.value(id().withSuffix(JOBCOUNT_SUFFIX).toString(), defaultJobCount()).toInt();
|
||||
@@ -324,12 +325,12 @@ void MakeStep::setUserArguments(const QString &args)
|
||||
m_makeArguments = args;
|
||||
}
|
||||
|
||||
QString MakeStep::makeCommand() const
|
||||
FileName MakeStep::makeCommand() const
|
||||
{
|
||||
return m_makeCommand;
|
||||
}
|
||||
|
||||
QString MakeStep::effectiveMakeCommand() const
|
||||
FileName MakeStep::effectiveMakeCommand() const
|
||||
{
|
||||
if (!m_makeCommand.isEmpty())
|
||||
return m_makeCommand;
|
||||
@@ -386,7 +387,7 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
m_ui->makeLineEdit->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
m_ui->makeLineEdit->setBaseDirectory(Utils::PathChooser::homePath());
|
||||
m_ui->makeLineEdit->setHistoryCompleter("PE.MakeCommand.History");
|
||||
m_ui->makeLineEdit->setPath(m_makeStep->makeCommand());
|
||||
m_ui->makeLineEdit->setPath(m_makeStep->makeCommand().toString());
|
||||
m_ui->makeArgumentsLineEdit->setText(m_makeStep->userArguments());
|
||||
m_ui->nonOverrideWarning->setToolTip("<html><body><p>" +
|
||||
tr("<code>MAKEFLAGS</code> specifies parallel jobs. Check \"%1\" to override.")
|
||||
@@ -459,7 +460,7 @@ void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||
|
||||
const QString defaultMake = m_makeStep->defaultMakeCommand();
|
||||
const QString defaultMake = m_makeStep->defaultMakeCommand().toString();
|
||||
if (defaultMake.isEmpty())
|
||||
m_ui->makeLabel->setText(tr("Make:"));
|
||||
else
|
||||
@@ -484,14 +485,14 @@ void MakeStepConfigWidget::updateDetails()
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setWorkingDirectory(bc->buildDirectory().toString());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setCommand(m_makeStep->effectiveMakeCommand());
|
||||
|
||||
param.setArguments(m_makeStep->allArguments());
|
||||
param.setEnvironment(m_makeStep->environment(bc));
|
||||
|
||||
if (param.commandMissing())
|
||||
setSummaryText(tr("<b>Make:</b> %1 not found in the environment.").arg(param.command())); // Override display text
|
||||
setSummaryText(tr("<b>Make:</b> %1 not found in the environment.")
|
||||
.arg(param.command().toString())); // Override display text
|
||||
else
|
||||
setSummaryText(param.summaryInWorkdir(displayName()));
|
||||
}
|
||||
@@ -504,7 +505,7 @@ void MakeStepConfigWidget::itemChanged(QListWidgetItem *item)
|
||||
|
||||
void MakeStepConfigWidget::makeLineEditTextEdited()
|
||||
{
|
||||
m_makeStep->setMakeCommand(m_ui->makeLineEdit->rawPath());
|
||||
m_makeStep->setMakeCommand(FileName::fromString(m_ui->makeLineEdit->rawPath()));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,8 @@
|
||||
#include "abstractprocessstep.h"
|
||||
#include "projectexplorer_global.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QListWidgetItem);
|
||||
|
||||
namespace Utils { class Environment; }
|
||||
@@ -56,16 +58,16 @@ public:
|
||||
QString allArguments() const;
|
||||
QString userArguments() const;
|
||||
void setUserArguments(const QString &args);
|
||||
QString makeCommand() const;
|
||||
void setMakeCommand(const QString &command);
|
||||
QString effectiveMakeCommand() const;
|
||||
Utils::FileName makeCommand() const;
|
||||
void setMakeCommand(const Utils::FileName &command);
|
||||
Utils::FileName effectiveMakeCommand() const;
|
||||
|
||||
void setClean(bool clean);
|
||||
bool isClean() const;
|
||||
|
||||
static QString defaultDisplayName();
|
||||
|
||||
QString defaultMakeCommand() const;
|
||||
Utils::FileName defaultMakeCommand() const;
|
||||
static QString msgNoMakeCommand();
|
||||
static Task makeCommandMissingTask();
|
||||
|
||||
@@ -91,7 +93,7 @@ private:
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_availableTargets;
|
||||
QString m_makeArguments;
|
||||
QString m_makeCommand;
|
||||
Utils::FileName m_makeCommand;
|
||||
int m_userJobCount = 4;
|
||||
bool m_overrideMakeflags = false;
|
||||
bool m_clean = false;
|
||||
|
@@ -44,7 +44,9 @@
|
||||
\sa ProjectExplorer::AbstractProcessStep
|
||||
*/
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
ProcessParameters::ProcessParameters() :
|
||||
m_macroExpander(nullptr),
|
||||
@@ -56,7 +58,7 @@ ProcessParameters::ProcessParameters() :
|
||||
Sets the executable to run.
|
||||
*/
|
||||
|
||||
void ProcessParameters::setCommand(const QString &cmd)
|
||||
void ProcessParameters::setCommand(const Utils::FileName &cmd)
|
||||
{
|
||||
m_command = cmd;
|
||||
m_effectiveCommand.clear();
|
||||
@@ -78,7 +80,7 @@ void ProcessParameters::setArguments(const QString &arguments)
|
||||
Should be called from init().
|
||||
*/
|
||||
|
||||
void ProcessParameters::setWorkingDirectory(const QString &workingDirectory)
|
||||
void ProcessParameters::setWorkingDirectory(const FileName &workingDirectory)
|
||||
{
|
||||
m_workingDirectory = workingDirectory;
|
||||
m_effectiveWorkingDirectory.clear();
|
||||
@@ -103,13 +105,14 @@ void ProcessParameters::setWorkingDirectory(const QString &workingDirectory)
|
||||
Gets the fully expanded working directory.
|
||||
*/
|
||||
|
||||
QString ProcessParameters::effectiveWorkingDirectory() const
|
||||
FileName ProcessParameters::effectiveWorkingDirectory() const
|
||||
{
|
||||
if (m_effectiveWorkingDirectory.isEmpty()) {
|
||||
QString wds = m_workingDirectory;
|
||||
QString wds = m_workingDirectory.toString();
|
||||
if (m_macroExpander)
|
||||
wds = m_macroExpander->expand(wds);
|
||||
m_effectiveWorkingDirectory = QDir::cleanPath(m_environment.expandVariables(wds));
|
||||
m_effectiveWorkingDirectory
|
||||
= FileName::fromString(QDir::cleanPath(m_environment.expandVariables(wds)));
|
||||
}
|
||||
return m_effectiveWorkingDirectory;
|
||||
}
|
||||
@@ -118,14 +121,15 @@ QString ProcessParameters::effectiveWorkingDirectory() const
|
||||
Gets the fully expanded command name to run.
|
||||
*/
|
||||
|
||||
QString ProcessParameters::effectiveCommand() const
|
||||
FileName ProcessParameters::effectiveCommand() const
|
||||
{
|
||||
if (m_effectiveCommand.isEmpty()) {
|
||||
QString cmd = m_command;
|
||||
FileName cmd = m_command;
|
||||
if (m_macroExpander)
|
||||
cmd = m_macroExpander->expand(cmd);
|
||||
m_effectiveCommand =
|
||||
m_environment.searchInPath(cmd, {Utils::FileName::fromString(effectiveWorkingDirectory())}).toString();
|
||||
m_environment.searchInPath(cmd.toString(),
|
||||
{effectiveWorkingDirectory()});
|
||||
m_commandMissing = m_effectiveCommand.isEmpty();
|
||||
if (m_commandMissing)
|
||||
m_effectiveCommand = cmd;
|
||||
@@ -155,7 +159,7 @@ QString ProcessParameters::effectiveArguments() const
|
||||
|
||||
QString ProcessParameters::prettyCommand() const
|
||||
{
|
||||
QString cmd = m_command;
|
||||
QString cmd = m_command.toString();
|
||||
if (m_macroExpander)
|
||||
cmd = m_macroExpander->expand(cmd);
|
||||
return Utils::FileName::fromString(cmd).fileName();
|
||||
@@ -164,7 +168,7 @@ QString ProcessParameters::prettyCommand() const
|
||||
QString ProcessParameters::prettyArguments() const
|
||||
{
|
||||
QString margs = effectiveArguments();
|
||||
QString workDir = effectiveWorkingDirectory();
|
||||
QString workDir = effectiveWorkingDirectory().toString();
|
||||
Utils::QtcProcess::SplitError err;
|
||||
Utils::QtcProcess::Arguments args =
|
||||
Utils::QtcProcess::prepareArgs(margs, &err, Utils::HostOsInfo::hostOs(), &m_environment, &workDir);
|
||||
@@ -187,7 +191,7 @@ QString ProcessParameters::summaryInWorkdir(const QString &displayName) const
|
||||
.arg(displayName,
|
||||
Utils::QtcProcess::quoteArg(prettyCommand()),
|
||||
prettyArguments(),
|
||||
QDir::toNativeSeparators(effectiveWorkingDirectory()));
|
||||
QDir::toNativeSeparators(effectiveWorkingDirectory().toString()));
|
||||
}
|
||||
|
||||
void ProcessParameters::resolveAll()
|
||||
@@ -196,3 +200,5 @@ void ProcessParameters::resolveAll()
|
||||
effectiveArguments();
|
||||
effectiveWorkingDirectory();
|
||||
}
|
||||
|
||||
} // ProcessExplorer
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <utils/environment.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace Utils { class MacroExpander; }
|
||||
|
||||
@@ -39,14 +40,14 @@ class PROJECTEXPLORER_EXPORT ProcessParameters
|
||||
public:
|
||||
ProcessParameters();
|
||||
|
||||
void setCommand(const QString &cmd);
|
||||
QString command() const { return m_command; }
|
||||
void setCommand(const Utils::FileName &cmd);
|
||||
Utils::FileName command() const { return m_command; }
|
||||
|
||||
void setArguments(const QString &arguments);
|
||||
QString arguments() const { return m_arguments; }
|
||||
|
||||
void setWorkingDirectory(const QString &workingDirectory);
|
||||
QString workingDirectory() const { return m_workingDirectory; }
|
||||
void setWorkingDirectory(const Utils::FileName &workingDirectory);
|
||||
Utils::FileName workingDirectory() const { return m_workingDirectory; }
|
||||
|
||||
void setEnvironment(const Utils::Environment &env) { m_environment = env; }
|
||||
Utils::Environment environment() const { return m_environment; }
|
||||
@@ -55,9 +56,9 @@ public:
|
||||
Utils::MacroExpander *macroExpander() const { return m_macroExpander; }
|
||||
|
||||
/// Get the fully expanded working directory:
|
||||
QString effectiveWorkingDirectory() const;
|
||||
Utils::FileName effectiveWorkingDirectory() const;
|
||||
/// Get the fully expanded command name to run:
|
||||
QString effectiveCommand() const;
|
||||
Utils::FileName effectiveCommand() const;
|
||||
/// Get the fully expanded arguments to use:
|
||||
QString effectiveArguments() const;
|
||||
|
||||
@@ -71,14 +72,14 @@ public:
|
||||
|
||||
void resolveAll();
|
||||
private:
|
||||
QString m_workingDirectory;
|
||||
QString m_command;
|
||||
Utils::FileName m_workingDirectory;
|
||||
Utils::FileName m_command;
|
||||
QString m_arguments;
|
||||
Utils::Environment m_environment;
|
||||
Utils::MacroExpander *m_macroExpander;
|
||||
|
||||
mutable QString m_effectiveWorkingDirectory;
|
||||
mutable QString m_effectiveCommand;
|
||||
mutable Utils::FileName m_effectiveWorkingDirectory;
|
||||
mutable Utils::FileName m_effectiveCommand;
|
||||
mutable QString m_effectiveArguments;
|
||||
mutable bool m_commandMissing;
|
||||
};
|
||||
|
@@ -93,8 +93,8 @@ void ProcessStep::setupProcessParameters(ProcessParameters *pp)
|
||||
|
||||
pp->setMacroExpander(bc ? bc->macroExpander() : Utils::globalMacroExpander());
|
||||
pp->setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment());
|
||||
pp->setWorkingDirectory(workingDirectory);
|
||||
pp->setCommand(command);
|
||||
pp->setWorkingDirectory(Utils::FileName::fromString(workingDirectory));
|
||||
pp->setCommand(Utils::FileName::fromString(command));
|
||||
pp->setArguments(arguments);
|
||||
pp->resolveAll();
|
||||
}
|
||||
|
@@ -855,7 +855,7 @@ MakeInstallCommand Project::makeInstallCommand(const Target *target, const QStri
|
||||
if (const BuildConfiguration * const bc = target->activeBuildConfiguration()) {
|
||||
if (const auto makeStep = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)
|
||||
->firstOfType<MakeStep>()) {
|
||||
cmd.command = Utils::FileName::fromString(makeStep->effectiveMakeCommand());
|
||||
cmd.command = makeStep->effectiveMakeCommand();
|
||||
}
|
||||
}
|
||||
cmd.arguments << "install" << ("INSTALL_ROOT=" + QDir::toNativeSeparators(installRoot));
|
||||
|
@@ -75,7 +75,7 @@ bool QmakeMakeStep::init()
|
||||
if (!bc)
|
||||
emit addTask(Task::buildConfigurationMissingTask());
|
||||
|
||||
const QString make = effectiveMakeCommand();
|
||||
Utils::FileName make = effectiveMakeCommand();
|
||||
if (make.isEmpty())
|
||||
emit addTask(makeCommandMissingTask());
|
||||
|
||||
@@ -96,7 +96,7 @@ bool QmakeMakeStep::init()
|
||||
workingDirectory = bc->subNodeBuild()->buildDir();
|
||||
else
|
||||
workingDirectory = bc->buildDirectory().toString();
|
||||
pp->setWorkingDirectory(workingDirectory);
|
||||
pp->setWorkingDirectory(Utils::FileName::fromString(workingDirectory));
|
||||
|
||||
pp->setCommand(make);
|
||||
|
||||
@@ -148,7 +148,8 @@ bool QmakeMakeStep::init()
|
||||
objectsDir += "/release";
|
||||
}
|
||||
}
|
||||
QString relObjectsDir = QDir(pp->workingDirectory()).relativeFilePath(objectsDir);
|
||||
QString relObjectsDir = QDir(pp->workingDirectory().toString())
|
||||
.relativeFilePath(objectsDir);
|
||||
if (relObjectsDir == ".")
|
||||
relObjectsDir.clear();
|
||||
if (!relObjectsDir.isEmpty())
|
||||
|
@@ -223,7 +223,7 @@ bool QMakeStep::init()
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(qmakeBc->macroExpander());
|
||||
pp->setWorkingDirectory(workingDirectory);
|
||||
pp->setWorkingDirectory(Utils::FileName::fromString(workingDirectory));
|
||||
pp->setEnvironment(qmakeBc->environment());
|
||||
|
||||
setOutputParser(new QMakeParser);
|
||||
@@ -314,7 +314,7 @@ void QMakeStep::finish(bool success)
|
||||
void QMakeStep::startOneCommand(const QString &command, const QString &args)
|
||||
{
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setCommand(command);
|
||||
pp->setCommand(Utils::FileName::fromString(command));
|
||||
pp->setArguments(args);
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -343,7 +343,7 @@ void QMakeStep::runNextCommand()
|
||||
case State::RUN_MAKE_QMAKE_ALL:
|
||||
{
|
||||
auto *parser = new GnuMakeParser;
|
||||
parser->setWorkingDirectory(processParameters()->workingDirectory());
|
||||
parser->setWorkingDirectory(processParameters()->workingDirectory().toString());
|
||||
setOutputParser(parser);
|
||||
m_nextState = State::POST_PROCESS;
|
||||
startOneCommand(m_makeExecutable, m_makeArguments);
|
||||
@@ -439,7 +439,7 @@ void QMakeStep::setSeparateDebugInfo(bool enable)
|
||||
QString QMakeStep::makeCommand() const
|
||||
{
|
||||
auto *ms = qobject_cast<BuildStepList *>(parent())->firstOfType<MakeStep>();
|
||||
return ms ? ms->effectiveMakeCommand() : QString();
|
||||
return ms ? ms->effectiveMakeCommand().toString() : QString();
|
||||
}
|
||||
|
||||
QString QMakeStep::makeArguments(const QString &makefile) const
|
||||
|
@@ -173,7 +173,7 @@ bool MakeInstallStep::cleanInstallRoot() const
|
||||
|
||||
void MakeInstallStep::updateCommandFromAspect()
|
||||
{
|
||||
setMakeCommand(aspect<ExecutableAspect>()->executable().toString());
|
||||
setMakeCommand(aspect<ExecutableAspect>()->executable());
|
||||
updateFullCommandLine();
|
||||
}
|
||||
|
||||
@@ -188,7 +188,8 @@ void MakeInstallStep::updateArgsFromAspect()
|
||||
void MakeInstallStep::updateFullCommandLine()
|
||||
{
|
||||
static_cast<BaseStringAspect *>(aspect(FullCommandLineAspectId))->setValue(
|
||||
QDir::toNativeSeparators(QtcProcess::quoteArg(effectiveMakeCommand()))
|
||||
QDir::toNativeSeparators(
|
||||
QtcProcess::quoteArg(effectiveMakeCommand().toString()))
|
||||
+ ' ' + userArguments());
|
||||
}
|
||||
|
||||
|
@@ -107,7 +107,7 @@ bool WinRtPackageDeploymentStep::init()
|
||||
QDir::toNativeSeparators(qt->binPath().toString())));
|
||||
return false;
|
||||
}
|
||||
params->setCommand(windeployqtPath);
|
||||
params->setCommand(Utils::FileName::fromString(windeployqtPath));
|
||||
params->setArguments(args);
|
||||
params->setEnvironment(buildConfiguration()->environment());
|
||||
|
||||
|
Reference in New Issue
Block a user