diff options
Diffstat (limited to 'src')
20 files changed, 122 insertions, 162 deletions
diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index e80f56058d..e6dbba46ac 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -94,9 +94,7 @@ static void setupProcessParameters(ProcessParameters *pp, pp->setWorkingDirectory(bc->buildDirectory()); Utils::Environment env = bc->environment(); pp->setEnvironment(env); - pp->setCommand(FilePath::fromString(command)); - pp->setArguments(Utils::QtcProcess::joinArgs(arguments)); - pp->resolveAll(); + pp->setCommandLine({FilePath::fromString(command), arguments}); } class PasswordInputDialog : public QDialog diff --git a/src/plugins/android/androidpackageinstallationstep.cpp b/src/plugins/android/androidpackageinstallationstep.cpp index 9ad698bdec..b84202c41a 100644 --- a/src/plugins/android/androidpackageinstallationstep.cpp +++ b/src/plugins/android/androidpackageinstallationstep.cpp @@ -70,18 +70,19 @@ bool AndroidPackageInstallationStep::init() ProjectExplorer::Constants::CXX_LANGUAGE_ID); QTC_ASSERT(tc, return false); + CommandLine cmd{tc->makeCommand(bc->environment())}; + const QString innerQuoted = QtcProcess::quoteArg(dirPath); + const QString outerQuoted = QtcProcess::quoteArg("INSTALL_ROOT=" + innerQuoted); + cmd.addArgs(outerQuoted + " install", CommandLine::Raw); + ProcessParameters *pp = processParameters(); pp->setMacroExpander(bc->macroExpander()); pp->setWorkingDirectory(bc->buildDirectory()); - pp->setCommand(tc->makeCommand(bc->environment())); Environment env = bc->environment(); Environment::setupEnglishOutput(&env); pp->setEnvironment(env); - const QString innerQuoted = QtcProcess::quoteArg(dirPath); - const QString outerQuoted = QtcProcess::quoteArg("INSTALL_ROOT=" + innerQuoted); - pp->setArguments(outerQuoted + " install"); + pp->setCommandLine(cmd); - pp->resolveAll(); setOutputParser(new GnuMakeParser()); IOutputParser *parser = target()->kit()->createOutputParser(); if (parser) diff --git a/src/plugins/autotoolsprojectmanager/autogenstep.cpp b/src/plugins/autotoolsprojectmanager/autogenstep.cpp index fcb6b5c9ac..0ed238bd50 100644 --- a/src/plugins/autotoolsprojectmanager/autogenstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autogenstep.cpp @@ -41,6 +41,7 @@ using namespace AutotoolsProjectManager; using namespace AutotoolsProjectManager::Internal; using namespace ProjectExplorer; +using namespace Utils; const char AUTOGEN_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.AutogenStep.AdditionalArguments"; const char AUTOGEN_STEP_ID[] = "AutotoolsProjectManager.AutogenStep"; @@ -78,9 +79,9 @@ bool AutogenStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->target()->project()->projectDirectory()); - pp->setCommand(Utils::FilePath::fromString("./autogen.sh")); - pp->setArguments(m_additionalArgumentsAspect->value()); - pp->resolveAll(); + pp->setCommandLine({FilePath::fromString("./autogen.sh"), + m_additionalArgumentsAspect->value(), + CommandLine::Raw}); return AbstractProcessStep::init(); } @@ -122,8 +123,9 @@ BuildStepConfigWidget *AutogenStep::createConfigWidget() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->target()->project()->projectDirectory()); - param.setCommand(Utils::FilePath::fromString("./autogen.sh")); - param.setArguments(m_additionalArgumentsAspect->value()); + param.setCommandLine({FilePath::fromString("./autogen.sh"), + m_additionalArgumentsAspect->value(), + CommandLine::Raw}); widget->setSummaryText(param.summary(displayName())); }; diff --git a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp index 58ee0f383b..b195b048cc 100644 --- a/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp +++ b/src/plugins/autotoolsprojectmanager/autoreconfstep.cpp @@ -76,9 +76,8 @@ bool AutoreconfStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->target()->project()->projectDirectory()); - pp->setCommand(Utils::FilePath::fromString("autoreconf")); - pp->setArguments(m_additionalArgumentsAspect->value()); - pp->resolveAll(); + pp->setCommandLine({Utils::FilePath::fromString("autoreconf"), + m_additionalArgumentsAspect->value(), Utils::CommandLine::Raw}); return AbstractProcessStep::init(); } @@ -114,8 +113,9 @@ BuildStepConfigWidget *AutoreconfStep::createConfigWidget() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->target()->project()->projectDirectory()); - param.setCommand(Utils::FilePath::fromString("autoreconf")); - param.setArguments(m_additionalArgumentsAspect->value()); + param.setCommandLine({Utils::FilePath::fromString("autoreconf"), + m_additionalArgumentsAspect->value(), + Utils::CommandLine::Raw}); widget->setSummaryText(param.summary(displayName())); }; diff --git a/src/plugins/autotoolsprojectmanager/configurestep.cpp b/src/plugins/autotoolsprojectmanager/configurestep.cpp index 91b72eb4af..73d6d5e53f 100644 --- a/src/plugins/autotoolsprojectmanager/configurestep.cpp +++ b/src/plugins/autotoolsprojectmanager/configurestep.cpp @@ -47,6 +47,7 @@ using namespace AutotoolsProjectManager; using namespace AutotoolsProjectManager::Internal; using namespace ProjectExplorer; +using namespace Utils; const char CONFIGURE_ADDITIONAL_ARGUMENTS_KEY[] = "AutotoolsProjectManager.ConfigureStep.AdditionalArguments"; const char CONFIGURE_STEP_ID[] = "AutotoolsProjectManager.ConfigureStep"; @@ -98,9 +99,9 @@ bool ConfigureStep::init() pp->setMacroExpander(bc->macroExpander()); pp->setEnvironment(bc->environment()); pp->setWorkingDirectory(bc->buildDirectory()); - pp->setCommand(Utils::FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure")); - pp->setArguments(m_additionalArgumentsAspect->value()); - pp->resolveAll(); + pp->setCommandLine({FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"), + m_additionalArgumentsAspect->value(), + CommandLine::Raw}); return AbstractProcessStep::init(); } @@ -159,8 +160,9 @@ void ConfigureStep::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setEnvironment(bc->environment()); param.setWorkingDirectory(bc->buildDirectory()); - param.setCommand(Utils::FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure")); - param.setArguments(m_additionalArgumentsAspect->value()); + param.setCommandLine({FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"), + m_additionalArgumentsAspect->value(), + CommandLine::Raw}); m_widget->setSummaryText(param.summaryInWorkdir(displayName())); } diff --git a/src/plugins/ios/iosbuildstep.cpp b/src/plugins/ios/iosbuildstep.cpp index 0fbcb44305..ee6b8ea6e7 100644 --- a/src/plugins/ios/iosbuildstep.cpp +++ b/src/plugins/ios/iosbuildstep.cpp @@ -39,14 +39,18 @@ #include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/toolchain.h> #include <projectexplorer/gcctoolchain.h> + #include <qtsupport/qtkitinformation.h> #include <qtsupport/qtparser.h> + +#include <utils/fileutils.h> #include <utils/stringutils.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> using namespace Core; using namespace ProjectExplorer; +using namespace Utils; namespace Ios { namespace Internal { @@ -91,9 +95,7 @@ bool IosBuildStep::init() Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); - pp->setCommand(Utils::FilePath::fromString(buildCommand())); - pp->setArguments(Utils::QtcProcess::joinArgs(allArguments())); - pp->resolveAll(); + pp->setCommandLine({buildCommand(), allArguments()}); // If we are cleaning, then build can fail with an error code, but that doesn't mean // we should stop the clean queue @@ -164,9 +166,9 @@ QStringList IosBuildStep::defaultArguments() const return res; } -QString IosBuildStep::buildCommand() const +FilePath IosBuildStep::buildCommand() const { - return QString("xcodebuild"); // add path? + return FilePath::fromString("xcodebuild"); // add path? } void IosBuildStep::doRun() @@ -253,8 +255,7 @@ void IosBuildStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setWorkingDirectory(bc->buildDirectory()); param.setEnvironment(bc->environment()); - param.setCommand(Utils::FilePath::fromString(m_buildStep->buildCommand())); - param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->allArguments())); + param.setCommandLine({m_buildStep->buildCommand(), m_buildStep->allArguments()}); setSummaryText(param.summary(displayName())); } diff --git a/src/plugins/ios/iosbuildstep.h b/src/plugins/ios/iosbuildstep.h index 227f88b17a..96f7decfa9 100644 --- a/src/plugins/ios/iosbuildstep.h +++ b/src/plugins/ios/iosbuildstep.h @@ -54,7 +54,7 @@ public: QStringList baseArguments() const; QStringList allArguments() const; QStringList defaultArguments() const; - QString buildCommand() const; + Utils::FilePath buildCommand() const; private: bool init() override; diff --git a/src/plugins/ios/iosdsymbuildstep.cpp b/src/plugins/ios/iosdsymbuildstep.cpp index d238bcfb95..5c6f311a00 100644 --- a/src/plugins/ios/iosdsymbuildstep.cpp +++ b/src/plugins/ios/iosdsymbuildstep.cpp @@ -39,14 +39,17 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/buildconfiguration.h> #include <projectexplorer/projectexplorerconstants.h> + #include <qtsupport/qtkitinformation.h> #include <qtsupport/qtparser.h> + #include <utils/stringutils.h> #include <utils/qtcassert.h> #include <utils/qtcprocess.h> using namespace Core; using namespace ProjectExplorer; +using namespace Utils; namespace Ios { namespace Internal { @@ -72,9 +75,7 @@ bool IosDsymBuildStep::init() Utils::Environment env = bc->environment(); Utils::Environment::setupEnglishOutput(&env); pp->setEnvironment(env); - pp->setCommand(Utils::FilePath::fromString(command())); - pp->setArguments(Utils::QtcProcess::joinArgs(arguments())); - pp->resolveAll(); + pp->setCommandLine({command(), arguments()}); // If we are cleaning, then build can fail with an error code, but that doesn't mean // we should stop the clean queue @@ -97,7 +98,7 @@ QVariantMap IosDsymBuildStep::toMap() const map.insert(id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString(), isDefault()); map.insert(id().withSuffix(CLEAN_PARTIAL_KEY).toString(), m_clean); - map.insert(id().withSuffix(COMMAND_PARTIAL_KEY).toString(), command()); + map.insert(id().withSuffix(COMMAND_PARTIAL_KEY).toString(), command().toVariant()); return map; } @@ -108,8 +109,7 @@ bool IosDsymBuildStep::fromMap(const QVariantMap &map) bool useDefaultArguments = map.value( id().withSuffix(USE_DEFAULT_ARGS_PARTIAL_KEY).toString()).toBool(); m_clean = map.value(id().withSuffix(CLEAN_PARTIAL_KEY).toString(), m_clean).toBool(); - m_command = map.value(id().withSuffix(COMMAND_PARTIAL_KEY).toString(), m_command) - .toString(); + m_command = FilePath::fromVariant(map.value(id().withSuffix(COMMAND_PARTIAL_KEY).toString())); if (useDefaultArguments) { m_command = defaultCommand(); m_arguments = defaultArguments(); @@ -125,12 +125,12 @@ QStringList IosDsymBuildStep::defaultArguments() const return defaultCmdList().mid(1); } -QString IosDsymBuildStep::defaultCommand() const +FilePath IosDsymBuildStep::defaultCommand() const { if (m_clean) - return defaultCleanCmdList().at(0); + return FilePath::fromString(defaultCleanCmdList().at(0)); else - return defaultCmdList().at(0); + return FilePath::fromString(defaultCmdList().at(0)); } QStringList IosDsymBuildStep::defaultCleanCmdList() const @@ -158,14 +158,14 @@ QStringList IosDsymBuildStep::defaultCmdList() const return QStringList({dsymutilCmd, "-o", dsymPath, runConf->localExecutable().toUserOutput()}); } -QString IosDsymBuildStep::command() const +FilePath IosDsymBuildStep::command() const { if (m_command.isEmpty()) return defaultCommand(); return m_command; } -void IosDsymBuildStep::setCommand(const QString &command) +void IosDsymBuildStep::setCommand(const FilePath &command) { if (command == m_command) return; @@ -229,7 +229,7 @@ IosDsymBuildStepConfigWidget::IosDsymBuildStepConfigWidget(IosDsymBuildStep *bui Project *pro = m_buildStep->target()->project(); - m_ui->commandLineEdit->setText(m_buildStep->command()); + m_ui->commandLineEdit->setText(m_buildStep->command().toString()); m_ui->argumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs( m_buildStep->arguments())); m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault()); @@ -270,15 +270,14 @@ void IosDsymBuildStepConfigWidget::updateDetails() param.setMacroExpander(bc->macroExpander()); param.setWorkingDirectory(bc->buildDirectory()); param.setEnvironment(bc->environment()); - param.setCommand(Utils::FilePath::fromString(m_buildStep->command())); - param.setArguments(Utils::QtcProcess::joinArgs(m_buildStep->arguments())); + param.setCommandLine({m_buildStep->command(), m_buildStep->arguments()}); setSummaryText(param.summary(displayName())); } void IosDsymBuildStepConfigWidget::commandChanged() { - m_buildStep->setCommand(m_ui->commandLineEdit->text()); + m_buildStep->setCommand(FilePath::fromString(m_ui->commandLineEdit->text())); m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault()); updateDetails(); } @@ -295,7 +294,7 @@ void IosDsymBuildStepConfigWidget::resetDefaults() { m_buildStep->setCommand(m_buildStep->defaultCommand()); m_buildStep->setArguments(m_buildStep->defaultArguments()); - m_ui->commandLineEdit->setText(m_buildStep->command()); + m_ui->commandLineEdit->setText(m_buildStep->command().toString()); m_ui->argumentsTextEdit->setPlainText(Utils::QtcProcess::joinArgs( m_buildStep->arguments())); m_ui->resetDefaultsButton->setEnabled(!m_buildStep->isDefault()); diff --git a/src/plugins/ios/iosdsymbuildstep.h b/src/plugins/ios/iosdsymbuildstep.h index 1cd8abcb29..1d03205e34 100644 --- a/src/plugins/ios/iosdsymbuildstep.h +++ b/src/plugins/ios/iosdsymbuildstep.h @@ -27,6 +27,8 @@ #include <projectexplorer/abstractprocessstep.h> +#include <utils/fileutils.h> + namespace Ios { namespace Internal { namespace Ui { class IosPresetBuildStep; } @@ -46,9 +48,9 @@ public: void setArguments(const QStringList &args); QStringList arguments() const; QStringList defaultArguments() const; - QString defaultCommand() const; - QString command() const; - void setCommand(const QString &command); + Utils::FilePath defaultCommand() const; + Utils::FilePath command() const; + void setCommand(const Utils::FilePath &command); bool isDefault() const; private: @@ -61,7 +63,7 @@ private: QStringList defaultCmdList() const; QStringList m_arguments; - QString m_command; + Utils::FilePath m_command; bool m_clean; }; diff --git a/src/plugins/nim/project/nimcompilerbuildstep.cpp b/src/plugins/nim/project/nimcompilerbuildstep.cpp index 1ecc7e8c63..c2a71a565a 100644 --- a/src/plugins/nim/project/nimcompilerbuildstep.cpp +++ b/src/plugins/nim/project/nimcompilerbuildstep.cpp @@ -206,7 +206,6 @@ void NimCompilerBuildStep::updateProcessParameters() { updateOutFilePath(); updateCommand(); - updateArguments(); updateWorkingDirectory(); updateEnvironment(); emit processParametersChanged(); @@ -220,16 +219,6 @@ void NimCompilerBuildStep::updateOutFilePath() setOutFilePath(bc->buildDirectory().pathAppended(targetName)); } -void NimCompilerBuildStep::updateCommand() -{ - QTC_ASSERT(target(), return); - QTC_ASSERT(target()->kit(), return); - Kit *kit = target()->kit(); - auto tc = dynamic_cast<NimToolChain*>(ToolChainKitAspect::toolChain(kit, Constants::C_NIMLANGUAGE_ID)); - QTC_ASSERT(tc, return); - processParameters()->setCommand(tc->compilerCommand()); -} - void NimCompilerBuildStep::updateWorkingDirectory() { auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration()); @@ -237,38 +226,38 @@ void NimCompilerBuildStep::updateWorkingDirectory() processParameters()->setWorkingDirectory(bc->buildDirectory()); } -void NimCompilerBuildStep::updateArguments() +void NimCompilerBuildStep::updateCommand() { auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration()); QTC_ASSERT(bc, return); - QStringList arguments; - arguments << QStringLiteral("c"); - - switch (m_defaultOptions) { - case Release: - arguments << QStringLiteral("-d:release"); - break; - case Debug: - arguments << QStringLiteral("--debugInfo") - << QStringLiteral("--lineDir:on"); - break; - default: - break; - } + QTC_ASSERT(target(), return); + QTC_ASSERT(target()->kit(), return); + Kit *kit = target()->kit(); + auto tc = dynamic_cast<NimToolChain*>(ToolChainKitAspect::toolChain(kit, Constants::C_NIMLANGUAGE_ID)); + QTC_ASSERT(tc, return); - arguments << QStringLiteral("--out:%1").arg(m_outFilePath.toString()); - arguments << QStringLiteral("--nimCache:%1").arg(bc->cacheDirectory().toString()); + CommandLine cmd{tc->compilerCommand()}; - arguments << m_userCompilerOptions; - arguments << m_targetNimFile.toString(); + cmd.addArg("c"); - // Remove empty args - auto predicate = [](const QString &str) { return str.isEmpty(); }; - auto it = std::remove_if(arguments.begin(), arguments.end(), predicate); - arguments.erase(it, arguments.end()); + if (m_defaultOptions == Release) + cmd.addArg("-d:release"); + else if (m_defaultOptions == Debug) + cmd.addArgs({"--debugInfo", "--lineDir:on"}); + + cmd.addArg("--out:" + m_outFilePath.toString()); + cmd.addArg("--nimCache:" + bc->cacheDirectory().toString()); + + for (const QString &arg : m_userCompilerOptions) { + if (!arg.isEmpty()) + cmd.addArg(arg); + } + + if (!m_targetNimFile.isEmpty()) + cmd.addArg(m_targetNimFile.toString()); - processParameters()->setArguments(arguments.join(QChar::Space)); + processParameters()->setCommandLine(cmd); } void NimCompilerBuildStep::updateEnvironment() diff --git a/src/plugins/nim/project/nimcompilerbuildstep.h b/src/plugins/nim/project/nimcompilerbuildstep.h index a866694c9a..b9ea46316f 100644 --- a/src/plugins/nim/project/nimcompilerbuildstep.h +++ b/src/plugins/nim/project/nimcompilerbuildstep.h @@ -72,7 +72,6 @@ private: void updateProcessParameters(); void updateCommand(); void updateWorkingDirectory(); - void updateArguments(); void updateEnvironment(); void updateTargetNimFile(); diff --git a/src/plugins/nim/project/nimcompilerbuildstepconfigwidget.cpp b/src/plugins/nim/project/nimcompilerbuildstepconfigwidget.cpp index 27acf21726..fa72bfb594 100644 --- a/src/plugins/nim/project/nimcompilerbuildstepconfigwidget.cpp +++ b/src/plugins/nim/project/nimcompilerbuildstepconfigwidget.cpp @@ -34,6 +34,7 @@ #include <projectexplorer/processparameters.h> #include <utils/qtcassert.h> +#include <utils/qtcprocess.h> using namespace ProjectExplorer; using namespace Utils; @@ -103,16 +104,10 @@ void NimCompilerBuildStepConfigWidget::updateCommandLineText() { ProcessParameters *parameters = m_buildStep->processParameters(); - QStringList command; - command << parameters->command().toString(); - command << parameters->arguments(); + const CommandLine cmd = parameters->command(); + const QStringList parts = QtcProcess::splitArgs(cmd.toUserOutput()); - // Remove empty args - auto predicate = [](const QString & str) { return str.isEmpty(); }; - auto it = std::remove_if(command.begin(), command.end(), predicate); - command.erase(it, command.end()); - - m_ui->commandTextEdit->setText(command.join(QChar::LineFeed)); + m_ui->commandTextEdit->setText(parts.join(QChar::LineFeed)); } void NimCompilerBuildStepConfigWidget::updateTargetComboBox() diff --git a/src/plugins/projectexplorer/makestep.cpp b/src/plugins/projectexplorer/makestep.cpp index 405498a85f..3c3a0304e7 100644 --- a/src/plugins/projectexplorer/makestep.cpp +++ b/src/plugins/projectexplorer/makestep.cpp @@ -488,7 +488,7 @@ void MakeStepConfigWidget::updateDetails() if (param.commandMissing()) setSummaryText(tr("<b>Make:</b> %1 not found in the environment.") - .arg(param.command().toString())); // Override display text + .arg(param.command().executable().toUserOutput())); // Override display text else setSummaryText(param.summaryInWorkdir(displayName())); } diff --git a/src/plugins/projectexplorer/processparameters.cpp b/src/plugins/projectexplorer/processparameters.cpp index f535cc120e..d8b91e49b9 100644 --- a/src/plugins/projectexplorer/processparameters.cpp +++ b/src/plugins/projectexplorer/processparameters.cpp @@ -54,34 +54,18 @@ ProcessParameters::ProcessParameters() : { } -void ProcessParameters::setCommandLine(const CommandLine &cmdLine) -{ - m_command = cmdLine.executable(); - m_arguments = cmdLine.arguments(); - m_effectiveCommand.clear(); - m_effectiveArguments.clear(); -} - /*! - Sets the executable to run. + Sets the command to run. */ - -void ProcessParameters::setCommand(const Utils::FilePath &cmd) +void ProcessParameters::setCommandLine(const CommandLine &cmdLine) { - m_command = cmd; + m_command = cmdLine; m_effectiveCommand.clear(); -} - -/*! - Sets the command line arguments used by the process. -*/ - -void ProcessParameters::setArguments(const QString &arguments) -{ - m_arguments = arguments; m_effectiveArguments.clear(); + resolveAll(); } + /*! Sets the \a workingDirectory for the process for a build configuration. @@ -132,7 +116,7 @@ FilePath ProcessParameters::effectiveWorkingDirectory() const FilePath ProcessParameters::effectiveCommand() const { if (m_effectiveCommand.isEmpty()) { - FilePath cmd = m_command; + FilePath cmd = m_command.executable(); if (m_macroExpander) cmd = m_macroExpander->expand(cmd); m_effectiveCommand = @@ -158,7 +142,7 @@ bool ProcessParameters::commandMissing() const QString ProcessParameters::effectiveArguments() const { if (m_effectiveArguments.isEmpty()) { - m_effectiveArguments = m_arguments; + m_effectiveArguments = m_command.arguments(); if (m_macroExpander) m_effectiveArguments = m_macroExpander->expand(m_effectiveArguments); } @@ -167,7 +151,7 @@ QString ProcessParameters::effectiveArguments() const QString ProcessParameters::prettyCommand() const { - QString cmd = m_command.toString(); + QString cmd = m_command.executable().toString(); if (m_macroExpander) cmd = m_macroExpander->expand(cmd); return Utils::FilePath::fromString(cmd).fileName(); diff --git a/src/plugins/projectexplorer/processparameters.h b/src/plugins/projectexplorer/processparameters.h index c87ede7d5b..3742387d81 100644 --- a/src/plugins/projectexplorer/processparameters.h +++ b/src/plugins/projectexplorer/processparameters.h @@ -31,7 +31,6 @@ #include <utils/fileutils.h> namespace Utils { -class CommandLine; class MacroExpander; } // Utils @@ -44,12 +43,7 @@ public: ProcessParameters(); void setCommandLine(const Utils::CommandLine &cmdLine); - - void setCommand(const Utils::FilePath &cmd); - Utils::FilePath command() const { return m_command; } - - void setArguments(const QString &arguments); - QString arguments() const { return m_arguments; } + Utils::CommandLine command() const { return m_command; } void setWorkingDirectory(const Utils::FilePath &workingDirectory); Utils::FilePath workingDirectory() const { return m_workingDirectory; } @@ -78,8 +72,7 @@ public: void resolveAll(); private: Utils::FilePath m_workingDirectory; - Utils::FilePath m_command; - QString m_arguments; + Utils::CommandLine m_command; Utils::Environment m_environment; Utils::MacroExpander *m_macroExpander; diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp index 231cb831bb..98957d0614 100644 --- a/src/plugins/projectexplorer/processstep.cpp +++ b/src/plugins/projectexplorer/processstep.cpp @@ -33,10 +33,13 @@ #include <coreplugin/variablechooser.h> +#include <utils/fileutils.h> #include <utils/macroexpander.h> #include <QFormLayout> +using namespace Utils; + namespace ProjectExplorer { const char PROCESS_STEP_ID[] = "ProjectExplorer.ProcessStep"; @@ -81,8 +84,6 @@ void ProcessStep::setupProcessParameters(ProcessParameters *pp) { BuildConfiguration *bc = buildConfiguration(); - QString command = m_command->value(); - QString arguments = m_arguments->value(); QString workingDirectory = m_workingDirectory->value(); if (workingDirectory.isEmpty()) { if (bc) @@ -94,8 +95,7 @@ void ProcessStep::setupProcessParameters(ProcessParameters *pp) pp->setMacroExpander(bc ? bc->macroExpander() : Utils::globalMacroExpander()); pp->setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment()); pp->setWorkingDirectory(Utils::FilePath::fromString(workingDirectory)); - pp->setCommand(Utils::FilePath::fromString(command)); - pp->setArguments(arguments); + pp->setCommandLine({m_command->fileName(), m_arguments->value(), CommandLine::Raw}); pp->resolveAll(); } diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 92d10cd323..6aff639a64 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -182,8 +182,7 @@ bool QMakeStep::init() else workingDirectory = qmakeBc->buildDirectory().toString(); - m_qmakeExecutable = qtVersion->qmakeCommand(); - m_qmakeArguments = allArguments(qtVersion); + m_qmakeCommand = CommandLine{qtVersion->qmakeCommand(), allArguments(qtVersion), CommandLine::Raw}; m_runMakeQmake = (qtVersion->qtVersion() >= QtVersionNumber(5, 0 ,0)); QString makefile = workingDirectory + '/'; @@ -201,17 +200,16 @@ bool QMakeStep::init() } if (m_runMakeQmake) { - m_makeExecutable = makeCommand(); - if (m_makeExecutable.isEmpty()) { + const FilePath make = makeCommand(); + if (make.isEmpty()) { emit addOutput(tr("Could not determine which \"make\" command to run. " "Check the \"make\" step in the build configuration."), BuildStep::OutputFormat::ErrorMessage); return false; } - m_makeArguments = makeArguments(makefile); + m_makeCommand = CommandLine{make, makeArguments(makefile), CommandLine::Raw}; } else { - m_makeExecutable.clear(); - m_makeArguments.clear(); + m_makeCommand = {}; } // Check whether we need to run qmake @@ -311,12 +309,10 @@ void QMakeStep::finish(bool success) runNextCommand(); } -void QMakeStep::startOneCommand(const FilePath &command, const QString &args) +void QMakeStep::startOneCommand(const CommandLine &command) { ProcessParameters *pp = processParameters(); - pp->setCommand(command); - pp->setArguments(args); - pp->resolveAll(); + pp->setCommandLine(command); AbstractProcessStep::doRun(); } @@ -338,7 +334,7 @@ void QMakeStep::runNextCommand() case State::RUN_QMAKE: setOutputParser(new QMakeParser); m_nextState = (m_runMakeQmake ? State::RUN_MAKE_QMAKE_ALL : State::POST_PROCESS); - startOneCommand(m_qmakeExecutable, m_qmakeArguments); + startOneCommand(m_qmakeCommand); return; case State::RUN_MAKE_QMAKE_ALL: { @@ -346,7 +342,7 @@ void QMakeStep::runNextCommand() parser->setWorkingDirectory(processParameters()->workingDirectory().toString()); setOutputParser(parser); m_nextState = State::POST_PROCESS; - startOneCommand(m_makeExecutable, m_makeArguments); + startOneCommand(m_makeCommand); } return; case State::POST_PROCESS: diff --git a/src/plugins/qmakeprojectmanager/qmakestep.h b/src/plugins/qmakeprojectmanager/qmakestep.h index 1a4bc66f39..b9c7fd0b49 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.h +++ b/src/plugins/qmakeprojectmanager/qmakestep.h @@ -170,13 +170,11 @@ private: void doCancel() override; void finish(bool success) override; - void startOneCommand(const Utils::FilePath &command, const QString &args); + void startOneCommand(const Utils::CommandLine &command); void runNextCommand(); - Utils::FilePath m_qmakeExecutable; - QString m_qmakeArguments; - Utils::FilePath m_makeExecutable; - QString m_makeArguments; + Utils::CommandLine m_qmakeCommand; + Utils::CommandLine m_makeCommand; QString m_userArgs; // Extra arguments for qmake and pro file parser QStringList m_extraArgs; diff --git a/src/plugins/remotelinux/makeinstallstep.cpp b/src/plugins/remotelinux/makeinstallstep.cpp index ae3d023179..96c41218e8 100644 --- a/src/plugins/remotelinux/makeinstallstep.cpp +++ b/src/plugins/remotelinux/makeinstallstep.cpp @@ -146,7 +146,8 @@ bool MakeInstallStep::init() const auto buildStep = buildConfiguration() ->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD) ->firstOfType<AbstractProcessStep>(); - m_isCmakeProject = buildStep && buildStep->processParameters()->command().toString() + m_isCmakeProject = buildStep + && buildStep->processParameters()->command().executable().toString() .contains("cmake"); return true; } diff --git a/src/plugins/winrt/winrtpackagedeploymentstep.cpp b/src/plugins/winrt/winrtpackagedeploymentstep.cpp index 357a306177..ea03ccc043 100644 --- a/src/plugins/winrt/winrtpackagedeploymentstep.cpp +++ b/src/plugins/winrt/winrtpackagedeploymentstep.cpp @@ -47,7 +47,7 @@ #include <QToolButton> using namespace ProjectExplorer; -using Utils::QtcProcess; +using namespace Utils; namespace WinRt { namespace Internal { @@ -91,24 +91,24 @@ bool WinRtPackageDeploymentStep::init() if (!qt) return false; - QString args = QtcProcess::quoteArg(QDir::toNativeSeparators(m_targetFilePath)); - args += ' ' + m_argsAspect->value(); + const QString windeployqtPath = FileUtils::resolvePath(qt->binPath().toString(), "windeployqt.exe"); - if (qt->type() == QLatin1String(Constants::WINRT_WINPHONEQT)) { + CommandLine windeployqt{FilePath::fromString(windeployqtPath)}; + windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath)); + windeployqt.addArgs(m_argsAspect->value(), CommandLine::Raw); + + if (qt->type() == Constants::WINRT_WINPHONEQT) { m_createMappingFile = true; - args += QLatin1String(" -list mapping"); + windeployqt.addArgs({"-list", "mapping"}); } ProcessParameters *params = processParameters(); - const QString windeployqtPath - = Utils::FileUtils::resolvePath(qt->binPath().toString(), "windeployqt.exe"); if (!QFile::exists(windeployqtPath)) { raiseError(tr("Cannot find windeployqt.exe in \"%1\".").arg( QDir::toNativeSeparators(qt->binPath().toString()))); return false; } - params->setCommand(Utils::FilePath::fromString(windeployqtPath)); - params->setArguments(args); + params->setCommandLine(windeployqt); params->setEnvironment(buildConfiguration()->environment()); return AbstractProcessStep::init(); |
