forked from qt-creator/qt-creator
Qbs: Simplify QbsBuildConfig::equivalentCommandLine implementation
Change-Id: I49cf90eb495537e52ad955546510d1df067c0e14 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -304,60 +304,53 @@ private:
|
|||||||
|
|
||||||
QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) const
|
QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep) const
|
||||||
{
|
{
|
||||||
QString commandLine;
|
CommandLine commandLine;
|
||||||
const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR"));
|
const QString qbsInstallDir = QString::fromLocal8Bit(qgetenv("QBS_INSTALL_DIR"));
|
||||||
const QString qbsFilePath = Utils::HostOsInfo::withExecutableSuffix(!qbsInstallDir.isEmpty()
|
const QString qbsFilePath = HostOsInfo::withExecutableSuffix(!qbsInstallDir.isEmpty()
|
||||||
? qbsInstallDir + QLatin1String("/bin/qbs")
|
? qbsInstallDir + QLatin1String("/bin/qbs")
|
||||||
: QCoreApplication::applicationDirPath() + QLatin1String("/qbs"));
|
: QCoreApplication::applicationDirPath() + QLatin1String("/qbs"));
|
||||||
Utils::QtcProcess::addArg(&commandLine, QDir::toNativeSeparators(qbsFilePath));
|
commandLine.addArg(QDir::toNativeSeparators(qbsFilePath));
|
||||||
const StepProxy stepProxy(buildStep);
|
const StepProxy stepProxy(buildStep);
|
||||||
Utils::QtcProcess::addArg(&commandLine, stepProxy.command());
|
commandLine.addArg(stepProxy.command());
|
||||||
const QString buildDir = buildDirectory().toUserOutput();
|
const QString buildDir = buildDirectory().toUserOutput();
|
||||||
Utils::QtcProcess::addArgs(&commandLine, QStringList({"-d", buildDir}));
|
commandLine.addArgs({"-d", buildDir});
|
||||||
Utils::QtcProcess::addArgs(&commandLine, QStringList("-f")
|
commandLine.addArgs({"-f", buildStep->project()->projectFilePath().toUserOutput()});
|
||||||
<< buildStep->project()->projectFilePath().toUserOutput());
|
|
||||||
if (QbsProjectManagerSettings::useCreatorSettingsDirForQbs()) {
|
if (QbsProjectManagerSettings::useCreatorSettingsDirForQbs()) {
|
||||||
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--settings-dir",
|
commandLine.addArgs({"--settings-dir",
|
||||||
QDir::toNativeSeparators(QbsProjectManagerSettings::qbsSettingsBaseDir())}));
|
QDir::toNativeSeparators(QbsProjectManagerSettings::qbsSettingsBaseDir())});
|
||||||
}
|
}
|
||||||
if (stepProxy.dryRun())
|
if (stepProxy.dryRun())
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--dry-run"));
|
commandLine.addArg("--dry-run");
|
||||||
if (stepProxy.keepGoing())
|
if (stepProxy.keepGoing())
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--keep-going"));
|
commandLine.addArg("--keep-going");
|
||||||
if (stepProxy.forceProbeExecution())
|
if (stepProxy.forceProbeExecution())
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--force-probe-execution"));
|
commandLine.addArg("--force-probe-execution");
|
||||||
if (stepProxy.showCommandLines())
|
if (stepProxy.showCommandLines())
|
||||||
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--command-echo-mode",
|
commandLine.addArgs({"--command-echo-mode", "command-line"});
|
||||||
"command-line"}));
|
|
||||||
if (stepProxy.noInstall())
|
if (stepProxy.noInstall())
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--no-install"));
|
commandLine.addArg("--no-install");
|
||||||
if (stepProxy.noBuild())
|
if (stepProxy.noBuild())
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--no-build"));
|
commandLine.addArg("--no-build");
|
||||||
if (stepProxy.cleanInstallRoot())
|
if (stepProxy.cleanInstallRoot())
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("--clean-install-root"));
|
commandLine.addArg("--clean-install-root");
|
||||||
const int jobCount = stepProxy.jobCount();
|
const int jobCount = stepProxy.jobCount();
|
||||||
if (jobCount > 0) {
|
if (jobCount > 0)
|
||||||
Utils::QtcProcess::addArgs(&commandLine, QStringList({"--jobs",
|
commandLine.addArgs({"--jobs", QString::number(jobCount)});
|
||||||
QString::number(jobCount)}));
|
|
||||||
}
|
|
||||||
const QString profileName = QbsManager::profileForKit(buildStep->target()->kit());
|
const QString profileName = QbsManager::profileForKit(buildStep->target()->kit());
|
||||||
const QString buildVariant = qbsConfiguration()
|
const QString buildVariant = qbsConfiguration()
|
||||||
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
|
.value(QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)).toString();
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("config:") + configurationName());
|
commandLine.addArg("config:" + configurationName());
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_CONFIG_VARIANT_KEY)
|
commandLine.addArg(QString(Constants::QBS_CONFIG_VARIANT_KEY) + ':' + buildVariant);
|
||||||
+ QLatin1Char(':') + buildVariant);
|
const FilePath installRoot = stepProxy.installRoot();
|
||||||
const Utils::FilePath installRoot = stepProxy.installRoot();
|
|
||||||
if (!installRoot.isEmpty()) {
|
if (!installRoot.isEmpty()) {
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String(Constants::QBS_INSTALL_ROOT_KEY)
|
commandLine.addArg(QString(Constants::QBS_INSTALL_ROOT_KEY) + ':' + installRoot.toUserOutput());
|
||||||
+ QLatin1Char(':') + installRoot.toUserOutput());
|
if (qobject_cast<const QbsInstallStep *>(buildStep))
|
||||||
if (qobject_cast<const QbsInstallStep *>(buildStep)) {
|
commandLine.addArgs({"--installRoot", installRoot.toUserOutput()});
|
||||||
Utils::QtcProcess::addArgs(&commandLine, QStringList({ QLatin1String("--installRoot"),
|
|
||||||
installRoot.toUserOutput() } ));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Utils::QtcProcess::addArg(&commandLine, QLatin1String("profile:") + profileName);
|
commandLine.addArg("profile:" + profileName);
|
||||||
|
|
||||||
return commandLine;
|
return commandLine.arguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user