forked from qt-creator/qt-creator
ProjectExplorer: Introduce some BuildStep convenience accessors
... and use in ProcessStep and related classes. Change-Id: Ie6f1403d0aa2b9f5bcde06e994809466700b1357 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -86,13 +86,13 @@ const char VerboseOutputKey[] = "VerboseOutput";
|
||||
const char UseMinistroKey[] = "UseMinistro";
|
||||
|
||||
static void setupProcessParameters(ProcessParameters *pp,
|
||||
BuildConfiguration *bc,
|
||||
BuildStep *step,
|
||||
const QStringList &arguments,
|
||||
const QString &command)
|
||||
{
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
Utils::Environment env = bc->environment();
|
||||
pp->setMacroExpander(step->macroExpander());
|
||||
pp->setWorkingDirectory(step->buildDirectory());
|
||||
Utils::Environment env = step->buildEnvironment();
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommandLine({command, arguments});
|
||||
}
|
||||
@@ -152,8 +152,6 @@ AndroidBuildApkStep::AndroidBuildApkStep(BuildStepList *parent, Core::Id id)
|
||||
|
||||
bool AndroidBuildApkStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
if (m_signPackage) {
|
||||
qCDebug(buildapkstepLog) << "Signing enabled";
|
||||
// check keystore and certificate passwords
|
||||
@@ -162,7 +160,7 @@ bool AndroidBuildApkStep::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bc->buildType() != ProjectExplorer::BuildConfiguration::Release)
|
||||
if (buildType() != BuildConfiguration::Release)
|
||||
emit addOutput(tr("Warning: Signing a debug or profile package."),
|
||||
OutputFormat::ErrorMessage);
|
||||
}
|
||||
@@ -208,7 +206,7 @@ bool AndroidBuildApkStep::init()
|
||||
|
||||
QFileInfo sourceDirInfo(sourceDirName);
|
||||
parser->setSourceDirectory(Utils::FilePath::fromString(sourceDirInfo.canonicalFilePath()));
|
||||
parser->setBuildDirectory(bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY));
|
||||
parser->setBuildDirectory(buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY));
|
||||
setOutputParser(parser);
|
||||
|
||||
m_openPackageLocationForRun = m_openPackageLocation;
|
||||
@@ -224,7 +222,7 @@ bool AndroidBuildApkStep::init()
|
||||
command += '/';
|
||||
command += Utils::HostOsInfo::withExecutableSuffix("androiddeployqt");
|
||||
|
||||
QString outputDir = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY).toString();
|
||||
QString outputDir = buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY).toString();
|
||||
|
||||
if (node)
|
||||
m_inputFile = node->data(Constants::AndroidDeploySettingsFile).toString();
|
||||
@@ -273,18 +271,18 @@ bool AndroidBuildApkStep::init()
|
||||
// Must be the last option, otherwise androiddeployqt might use the other
|
||||
// params (e.g. --sign) to choose not to add gdbserver
|
||||
if (version->qtVersion() >= QtSupport::QtVersionNumber(5, 6, 0)) {
|
||||
if (m_addDebugger || bc->buildType() == ProjectExplorer::BuildConfiguration::Debug)
|
||||
if (m_addDebugger || buildType() == ProjectExplorer::BuildConfiguration::Debug)
|
||||
arguments << "--gdbserver";
|
||||
else
|
||||
arguments << "--no-gdbserver";
|
||||
}
|
||||
|
||||
ProjectExplorer::ProcessParameters *pp = processParameters();
|
||||
setupProcessParameters(pp, bc, arguments, command);
|
||||
setupProcessParameters(pp, this, arguments, command);
|
||||
|
||||
// Generate arguments with keystore password concealed
|
||||
ProjectExplorer::ProcessParameters pp2;
|
||||
setupProcessParameters(&pp2, bc, argumentsPasswordConcealed, command);
|
||||
setupProcessParameters(&pp2, this, argumentsPasswordConcealed, command);
|
||||
m_command = pp2.effectiveCommand().toString();
|
||||
m_argumentsPasswordConcealed = pp2.prettyArguments();
|
||||
|
||||
@@ -381,13 +379,12 @@ void AndroidBuildApkStep::doRun()
|
||||
}
|
||||
|
||||
auto setup = [this] {
|
||||
auto bc = buildConfiguration();
|
||||
const auto androidAbis = AndroidManager::applicationAbis(target());
|
||||
for (const auto &abi : androidAbis) {
|
||||
Utils::FilePath androidLibsDir = bc->buildDirectory()
|
||||
Utils::FilePath androidLibsDir = buildDirectory()
|
||||
.pathAppended("android-build/libs")
|
||||
.pathAppended(abi);
|
||||
if (!androidLibsDir.exists() && !QDir{bc->buildDirectory().toString()}.mkpath(androidLibsDir.toString()))
|
||||
if (!androidLibsDir.exists() && !QDir{buildDirectory().toString()}.mkpath(androidLibsDir.toString()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -416,7 +413,7 @@ void AndroidBuildApkStep::doRun()
|
||||
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 14, 0)) {
|
||||
QTC_ASSERT(androidAbis.size() == 1, return false);
|
||||
applicationBinary = target()->activeRunConfiguration()->buildTargetInfo().targetFilePath.toString();
|
||||
Utils::FilePath androidLibsDir = bc->buildDirectory().pathAppended("android-build/libs").pathAppended(androidAbis.first());
|
||||
Utils::FilePath androidLibsDir = buildDirectory().pathAppended("android-build/libs").pathAppended(androidAbis.first());
|
||||
for (const auto &target : targets) {
|
||||
if (!copyFileIfNewer(target, androidLibsDir.pathAppended(QFileInfo{target}.fileName()).toString()))
|
||||
return false;
|
||||
@@ -434,7 +431,7 @@ void AndroidBuildApkStep::doRun()
|
||||
applicationBinary.remove(0, 3).chop(targetSuffix.size());
|
||||
}
|
||||
|
||||
Utils::FilePath androidLibsDir = bc->buildDirectory()
|
||||
Utils::FilePath androidLibsDir = buildDirectory()
|
||||
.pathAppended("android-build/libs")
|
||||
.pathAppended(abi);
|
||||
for (const auto &target : targets) {
|
||||
|
@@ -256,7 +256,7 @@ QWidget *AndroidBuildApkWidget::createCreateTemplatesGroup()
|
||||
|
||||
auto createAndroidTemplatesButton = new QPushButton(tr("Create Templates"));
|
||||
connect(createAndroidTemplatesButton, &QAbstractButton::clicked, this, [this] {
|
||||
CreateAndroidManifestWizard wizard(m_step->buildConfiguration()->buildSystem());
|
||||
CreateAndroidManifestWizard wizard(m_step->buildSystem());
|
||||
wizard.exec();
|
||||
});
|
||||
|
||||
@@ -348,7 +348,7 @@ void AndroidBuildApkWidget::setCertificates()
|
||||
|
||||
void AndroidBuildApkWidget::updateSigningWarning()
|
||||
{
|
||||
bool nonRelease = m_step->buildConfiguration()->buildType() != BuildConfiguration::Release;
|
||||
bool nonRelease = m_step->buildType() != BuildConfiguration::Release;
|
||||
bool visible = m_step->signPackage() && nonRelease;
|
||||
m_signingDebugWarningLabel->setVisible(visible);
|
||||
}
|
||||
|
@@ -60,24 +60,23 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(BuildStepList *bs
|
||||
|
||||
bool AndroidPackageInstallationStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
QString dirPath = bc->buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY).toString();
|
||||
QString dirPath = buildDirectory().pathAppended(Constants::ANDROID_BUILDDIRECTORY).toString();
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
if (bc->environment().searchInPath("sh.exe").isEmpty())
|
||||
if (buildEnvironment().searchInPath("sh.exe").isEmpty())
|
||||
dirPath = QDir::toNativeSeparators(dirPath);
|
||||
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(target()->kit());
|
||||
QTC_ASSERT(tc, return false);
|
||||
|
||||
CommandLine cmd{tc->makeCommand(bc->environment())};
|
||||
CommandLine cmd{tc->makeCommand(buildEnvironment())};
|
||||
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());
|
||||
Environment env = bc->environment();
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setWorkingDirectory(buildDirectory());
|
||||
Environment env = buildEnvironment();
|
||||
Environment::setupEnglishOutput(&env);
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommandLine(cmd);
|
||||
|
@@ -86,12 +86,10 @@ AutogenStep::AutogenStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(
|
||||
});
|
||||
|
||||
setSummaryUpdater([this] {
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
param.setMacroExpander(macroExpander());
|
||||
param.setEnvironment(buildEnvironment());
|
||||
param.setWorkingDirectory(project()->projectDirectory());
|
||||
param.setCommandLine({FilePath::fromString("./autogen.sh"),
|
||||
m_additionalArgumentsAspect->value(),
|
||||
CommandLine::Raw});
|
||||
@@ -102,12 +100,10 @@ AutogenStep::AutogenStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(
|
||||
|
||||
bool AutogenStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setEnvironment(buildEnvironment());
|
||||
pp->setWorkingDirectory(project()->projectDirectory());
|
||||
pp->setCommandLine({FilePath::fromString("./autogen.sh"),
|
||||
m_additionalArgumentsAspect->value(),
|
||||
CommandLine::Raw});
|
||||
@@ -117,10 +113,8 @@ bool AutogenStep::init()
|
||||
|
||||
void AutogenStep::doRun()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
// Check whether we need to run autogen.sh
|
||||
const QString projectDir = bc->target()->project()->projectDirectory().toString();
|
||||
const QString projectDir = project()->projectDirectory().toString();
|
||||
const QFileInfo configureInfo(projectDir + "/configure");
|
||||
const QFileInfo configureAcInfo(projectDir + "/configure.ac");
|
||||
const QFileInfo makefileAmInfo(projectDir + "/Makefile.am");
|
||||
|
@@ -84,12 +84,10 @@ AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Core::Id id)
|
||||
});
|
||||
|
||||
setSummaryUpdater([this] {
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
param.setMacroExpander(macroExpander());
|
||||
param.setEnvironment(buildEnvironment());
|
||||
param.setWorkingDirectory(project()->projectDirectory());
|
||||
param.setCommandLine({Utils::FilePath::fromString("autoreconf"),
|
||||
m_additionalArgumentsAspect->value(),
|
||||
Utils::CommandLine::Raw});
|
||||
@@ -100,12 +98,10 @@ AutoreconfStep::AutoreconfStep(BuildStepList *bsl, Core::Id id)
|
||||
|
||||
bool AutoreconfStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->target()->project()->projectDirectory());
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setEnvironment(buildEnvironment());
|
||||
pp->setWorkingDirectory(project()->projectDirectory());
|
||||
pp->setCommandLine({Utils::FilePath::fromString("autoreconf"),
|
||||
m_additionalArgumentsAspect->value(), Utils::CommandLine::Raw});
|
||||
|
||||
@@ -114,10 +110,8 @@ bool AutoreconfStep::init()
|
||||
|
||||
void AutoreconfStep::doRun()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
// Check whether we need to run autoreconf
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
const QString projectDir(project()->projectDirectory().toString());
|
||||
|
||||
if (!QFileInfo::exists(projectDir + "/configure"))
|
||||
m_runAutoreconf = true;
|
||||
|
@@ -109,9 +109,9 @@ ConfigureStep::ConfigureStep(BuildStepList *bsl, Core::Id id)
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setMacroExpander(macroExpander());
|
||||
param.setEnvironment(buildEnvironment());
|
||||
param.setWorkingDirectory(buildDirectory());
|
||||
param.setCommandLine({FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"),
|
||||
m_additionalArgumentsAspect->value(),
|
||||
CommandLine::Raw});
|
||||
@@ -125,9 +125,9 @@ bool ConfigureStep::init()
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setEnvironment(bc->environment());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setEnvironment(buildEnvironment());
|
||||
pp->setWorkingDirectory(buildDirectory());
|
||||
pp->setCommandLine({FilePath::fromString(projectDirRelativeToBuildDir(bc) + "configure"),
|
||||
m_additionalArgumentsAspect->value(),
|
||||
CommandLine::Raw});
|
||||
@@ -137,12 +137,10 @@ bool ConfigureStep::init()
|
||||
|
||||
void ConfigureStep::doRun()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
//Check whether we need to run configure
|
||||
const QString projectDir(bc->target()->project()->projectDirectory().toString());
|
||||
const QString projectDir(project()->projectDirectory().toString());
|
||||
const QFileInfo configureInfo(projectDir + "/configure");
|
||||
const QFileInfo configStatusInfo(bc->buildDirectory().toString() + "/config.status");
|
||||
const QFileInfo configStatusInfo(buildDirectory().toString() + "/config.status");
|
||||
|
||||
if (!configStatusInfo.exists()
|
||||
|| configStatusInfo.lastModified() < configureInfo.lastModified()) {
|
||||
|
@@ -213,11 +213,11 @@ void CMakeBuildStep::doRun()
|
||||
QTC_ASSERT(bc, return);
|
||||
|
||||
m_waiting = false;
|
||||
auto bs = static_cast<CMakeBuildSystem *>(buildConfiguration()->buildSystem());
|
||||
auto bs = static_cast<CMakeBuildSystem *>(buildSystem());
|
||||
if (bs->persistCMakeState()) {
|
||||
emit addOutput(tr("Persisting CMake state..."), BuildStep::OutputFormat::NormalMessage);
|
||||
m_waiting = true;
|
||||
} else if (buildConfiguration()->buildSystem()->isWaitingForParse()) {
|
||||
} else if (buildSystem()->isWaitingForParse()) {
|
||||
emit addOutput(tr("Running CMake in preparation to build..."), BuildStep::OutputFormat::NormalMessage);
|
||||
m_waiting = true;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ Utils::CommandLine CMakeBuildStep::cmakeCommand(RunConfiguration *rc) const
|
||||
|
||||
QStringList CMakeBuildStep::knownBuildTargets()
|
||||
{
|
||||
auto bc = qobject_cast<CMakeBuildSystem *>(buildConfiguration()->buildSystem());
|
||||
auto bc = qobject_cast<CMakeBuildSystem *>(buildSystem());
|
||||
return bc ? bc->buildTargetTitles() : QStringList();
|
||||
}
|
||||
|
||||
@@ -535,9 +535,9 @@ void CMakeBuildStepConfigWidget::updateDetails()
|
||||
}
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setMacroExpander(m_buildStep->macroExpander());
|
||||
param.setEnvironment(m_buildStep->buildEnvironment());
|
||||
param.setWorkingDirectory(m_buildStep->buildDirectory());
|
||||
param.setCommandLine(m_buildStep->cmakeCommand(nullptr));
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
|
@@ -145,12 +145,10 @@ private:
|
||||
|
||||
void updateDetails()
|
||||
{
|
||||
BuildConfiguration *bc = m_buildStep->buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setMacroExpander(m_buildStep->macroExpander());
|
||||
param.setWorkingDirectory(m_buildStep->buildDirectory());
|
||||
param.setEnvironment(m_buildStep->buildEnvironment());
|
||||
param.setCommandLine({m_buildStep->buildCommand(), m_buildStep->allArguments()});
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
@@ -252,8 +250,7 @@ QStringList IosBuildStep::defaultArguments() const
|
||||
case BuildConfiguration::Unknown :
|
||||
break;
|
||||
default:
|
||||
qCWarning(iosLog) << "IosBuildStep had an unknown buildType "
|
||||
<< buildConfiguration()->buildType();
|
||||
qCWarning(iosLog) << "IosBuildStep had an unknown buildType " << buildType();
|
||||
}
|
||||
if (tc->typeId() == ProjectExplorer::Constants::GCC_TOOLCHAIN_TYPEID
|
||||
|| tc->typeId() == ProjectExplorer::Constants::CLANG_TOOLCHAIN_TYPEID) {
|
||||
@@ -262,7 +259,7 @@ QStringList IosBuildStep::defaultArguments() const
|
||||
}
|
||||
if (!SysRootKitAspect::sysRoot(kit).isEmpty())
|
||||
res << "-sdk" << SysRootKitAspect::sysRoot(kit).toString();
|
||||
res << "SYMROOT=" + buildConfiguration()->buildDirectory().toString();
|
||||
res << "SYMROOT=" + buildDirectory().toString();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@@ -67,12 +67,10 @@ IosDsymBuildStep::IosDsymBuildStep(BuildStepList *parent, Id id) :
|
||||
|
||||
bool IosDsymBuildStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
Utils::Environment env = bc->environment();
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setWorkingDirectory(buildDirectory());
|
||||
Utils::Environment env = buildEnvironment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
pp->setEnvironment(env);
|
||||
pp->setCommandLine({command(), arguments()});
|
||||
@@ -255,12 +253,10 @@ IosDsymBuildStepConfigWidget::~IosDsymBuildStepConfigWidget()
|
||||
|
||||
void IosDsymBuildStepConfigWidget::updateDetails()
|
||||
{
|
||||
BuildConfiguration *bc = m_buildStep->buildConfiguration();
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setEnvironment(bc->environment());
|
||||
param.setMacroExpander(m_buildStep->macroExpander());
|
||||
param.setWorkingDirectory(m_buildStep->buildDirectory());
|
||||
param.setEnvironment(m_buildStep->buildEnvironment());
|
||||
param.setCommandLine({m_buildStep->command(), m_buildStep->arguments()});
|
||||
|
||||
setSummaryText(param.summary(displayName()));
|
||||
|
@@ -111,8 +111,8 @@ bool NimbleBuildStep::init()
|
||||
setOutputParser(parser);
|
||||
|
||||
ProcessParameters* params = processParameters();
|
||||
params->setEnvironment(buildConfiguration()->environment());
|
||||
params->setMacroExpander(buildConfiguration()->macroExpander());
|
||||
params->setEnvironment(buildEnvironment());
|
||||
params->setMacroExpander(macroExpander());
|
||||
params->setWorkingDirectory(project()->projectDirectory());
|
||||
params->setCommandLine({QStandardPaths::findExecutable("nimble"), {"build", m_arguments}});
|
||||
return AbstractProcessStep::init();
|
||||
@@ -156,13 +156,12 @@ QVariantMap NimbleBuildStep::toMap() const
|
||||
|
||||
QString NimbleBuildStep::defaultArguments() const
|
||||
{
|
||||
QTC_ASSERT(buildConfiguration(), return {}; );
|
||||
switch (buildConfiguration()->buildType()) {
|
||||
case ProjectExplorer::BuildConfiguration::Debug:
|
||||
switch (buildType()) {
|
||||
case BuildConfiguration::Debug:
|
||||
return {"--debugger:native"};
|
||||
case ProjectExplorer::BuildConfiguration::Unknown:
|
||||
case ProjectExplorer::BuildConfiguration::Profile:
|
||||
case ProjectExplorer::BuildConfiguration::Release:
|
||||
case BuildConfiguration::Unknown:
|
||||
case BuildConfiguration::Profile:
|
||||
case BuildConfiguration::Release:
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ NimbleTaskStep::NimbleTaskStep(BuildStepList *parentList, Core::Id id)
|
||||
|
||||
bool NimbleTaskStep::init()
|
||||
{
|
||||
processParameters()->setEnvironment(buildConfiguration()->environment());
|
||||
processParameters()->setEnvironment(buildEnvironment());
|
||||
processParameters()->setWorkingDirectory(project()->projectDirectory());
|
||||
return validate() && AbstractProcessStep::init();
|
||||
}
|
||||
|
@@ -106,7 +106,7 @@ NimCompilerBuildStep::NimCompilerBuildStep(BuildStepList *parentList, Core::Id i
|
||||
this, &NimCompilerBuildStep::updateProcessParameters);
|
||||
connect(this, &NimCompilerBuildStep::outFilePathChanged,
|
||||
bc, &NimBuildConfiguration::outFilePathChanged);
|
||||
connect(bc->target()->project(), &ProjectExplorer::Project::fileListChanged,
|
||||
connect(project(), &ProjectExplorer::Project::fileListChanged,
|
||||
this, &NimCompilerBuildStep::updateTargetNimFile);
|
||||
updateProcessParameters();
|
||||
}
|
||||
@@ -208,17 +208,13 @@ void NimCompilerBuildStep::updateProcessParameters()
|
||||
|
||||
void NimCompilerBuildStep::updateOutFilePath()
|
||||
{
|
||||
auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration());
|
||||
QTC_ASSERT(bc, return);
|
||||
const QString targetName = Utils::HostOsInfo::withExecutableSuffix(m_targetNimFile.toFileInfo().baseName());
|
||||
setOutFilePath(bc->buildDirectory().pathAppended(targetName));
|
||||
setOutFilePath(buildDirectory().pathAppended(targetName));
|
||||
}
|
||||
|
||||
void NimCompilerBuildStep::updateWorkingDirectory()
|
||||
{
|
||||
auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration());
|
||||
QTC_ASSERT(bc, return);
|
||||
processParameters()->setWorkingDirectory(bc->buildDirectory());
|
||||
processParameters()->setWorkingDirectory(buildDirectory());
|
||||
}
|
||||
|
||||
void NimCompilerBuildStep::updateCommand()
|
||||
@@ -257,9 +253,7 @@ void NimCompilerBuildStep::updateCommand()
|
||||
|
||||
void NimCompilerBuildStep::updateEnvironment()
|
||||
{
|
||||
auto bc = qobject_cast<NimBuildConfiguration *>(buildConfiguration());
|
||||
QTC_ASSERT(bc, return);
|
||||
processParameters()->setEnvironment(bc->environment());
|
||||
processParameters()->setEnvironment(buildEnvironment());
|
||||
}
|
||||
|
||||
void NimCompilerBuildStep::updateTargetNimFile()
|
||||
|
@@ -51,14 +51,14 @@ NimCompilerCleanStep::NimCompilerCleanStep(BuildStepList *parentList, Core::Id i
|
||||
workingDirectory->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||
|
||||
setSummaryUpdater([this, workingDirectory] {
|
||||
workingDirectory->setFilePath(buildConfiguration()->buildDirectory());
|
||||
workingDirectory->setFilePath(buildDirectory());
|
||||
return displayName();
|
||||
});
|
||||
}
|
||||
|
||||
bool NimCompilerCleanStep::init()
|
||||
{
|
||||
FilePath buildDir = buildConfiguration()->buildDirectory();
|
||||
FilePath buildDir = buildDirectory();
|
||||
bool result = buildDir.exists();
|
||||
if (result)
|
||||
m_buildDir = buildDir;
|
||||
|
@@ -349,10 +349,7 @@ void AbstractProcessStep::processReadyReadStdOutput()
|
||||
if (!d->m_process)
|
||||
return;
|
||||
d->m_process->setReadChannel(QProcess::StandardOutput);
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
if (!bc)
|
||||
bc = target()->activeBuildConfiguration();
|
||||
const bool utf8Output = bc && bc->environment().hasKey("VSLANG");
|
||||
const bool utf8Output = buildEnvironment().hasKey("VSLANG");
|
||||
d->readData(&AbstractProcessStep::stdOutput, utf8Output);
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "deployconfiguration.h"
|
||||
#include "kitinformation.h"
|
||||
#include "project.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <coreplugin/variablechooser.h>
|
||||
@@ -117,6 +118,8 @@
|
||||
This signal needs to be emitted if the build step runs in the GUI thread.
|
||||
*/
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
static const char buildStepEnabledKey[] = "ProjectExplorer.BuildStep.Enabled";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -216,6 +219,27 @@ BuildSystem *BuildStep::buildSystem() const
|
||||
return target()->buildSystem();
|
||||
}
|
||||
|
||||
Environment BuildStep::buildEnvironment() const
|
||||
{
|
||||
if (auto bc = buildConfiguration())
|
||||
return bc->environment();
|
||||
return Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
FilePath BuildStep::buildDirectory() const
|
||||
{
|
||||
if (auto bc = buildConfiguration())
|
||||
return bc->buildDirectory();
|
||||
return {};
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildType BuildStep::buildType() const
|
||||
{
|
||||
if (auto bc = buildConfiguration())
|
||||
return bc->buildType();
|
||||
return BuildConfiguration::Unknown;
|
||||
}
|
||||
|
||||
Utils::MacroExpander *BuildStep::macroExpander() const
|
||||
{
|
||||
if (auto bc = buildConfiguration())
|
||||
@@ -223,6 +247,13 @@ Utils::MacroExpander *BuildStep::macroExpander() const
|
||||
return Utils::globalMacroExpander();
|
||||
}
|
||||
|
||||
QString BuildStep::fallbackWorkingDirectory() const
|
||||
{
|
||||
if (auto bc = buildConfiguration())
|
||||
return Constants::DEFAULT_WORKING_DIR;
|
||||
return Constants::DEFAULT_WORKING_DIR_ALTERNATE;
|
||||
}
|
||||
|
||||
void BuildStep::reportRunResult(QFutureInterface<bool> &fi, bool success)
|
||||
{
|
||||
fi.reportResult(success);
|
||||
|
@@ -26,6 +26,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "projectconfiguration.h"
|
||||
|
||||
#include "buildconfiguration.h"
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <utils/optional.h>
|
||||
@@ -38,7 +40,11 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace Utils { class MacroExpander; }
|
||||
namespace Utils {
|
||||
class Environment;
|
||||
class FilePath;
|
||||
class MacroExpander;
|
||||
} // Utils
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
@@ -79,7 +85,11 @@ public:
|
||||
ProjectConfiguration *projectConfiguration() const;
|
||||
|
||||
BuildSystem *buildSystem() const;
|
||||
Utils::Environment buildEnvironment() const;
|
||||
Utils::FilePath buildDirectory() const;
|
||||
BuildConfiguration::BuildType buildType() const;
|
||||
Utils::MacroExpander *macroExpander() const;
|
||||
QString fallbackWorkingDirectory() const;
|
||||
|
||||
enum class OutputFormat {
|
||||
Stdout, Stderr, // These are for forwarded output from external tools
|
||||
|
@@ -95,9 +95,9 @@ bool MakeStep::init()
|
||||
}
|
||||
|
||||
ProcessParameters *pp = processParameters();
|
||||
pp->setMacroExpander(bc->macroExpander());
|
||||
pp->setWorkingDirectory(bc->buildDirectory());
|
||||
pp->setEnvironment(environment(bc));
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setWorkingDirectory(buildDirectory());
|
||||
pp->setEnvironment(buildEnvironment());
|
||||
pp->setCommandLine(make);
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -153,7 +153,7 @@ FilePath MakeStep::defaultMakeCommand() const
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
if (!bc)
|
||||
return {};
|
||||
const Utils::Environment env = environment(bc);
|
||||
const Utils::Environment env = makeEnvironment();
|
||||
for (const ToolChain *tc : preferredToolChains(target()->kit())) {
|
||||
FilePath make = tc->makeCommand(env);
|
||||
if (!make.isEmpty())
|
||||
@@ -225,7 +225,7 @@ static Utils::optional<int> argsJobCount(const QString &str)
|
||||
|
||||
bool MakeStep::makeflagsJobCountMismatch() const
|
||||
{
|
||||
const Utils::Environment env = environment(buildConfiguration());
|
||||
const Environment env = makeEnvironment();
|
||||
if (!env.hasKey(MAKEFLAGS))
|
||||
return false;
|
||||
Utils::optional<int> makeFlagsJobCount = argsJobCount(env.expandedValueForKey(MAKEFLAGS));
|
||||
@@ -234,7 +234,7 @@ bool MakeStep::makeflagsJobCountMismatch() const
|
||||
|
||||
bool MakeStep::makeflagsContainsJobCount() const
|
||||
{
|
||||
const Utils::Environment env = environment(buildConfiguration());
|
||||
const Environment env = makeEnvironment();
|
||||
if (!env.hasKey(MAKEFLAGS))
|
||||
return false;
|
||||
return argsJobCount(env.expandedValueForKey(MAKEFLAGS)).has_value();
|
||||
@@ -245,9 +245,9 @@ bool MakeStep::userArgsContainsJobCount() const
|
||||
return argsJobCount(m_userArguments).has_value();
|
||||
}
|
||||
|
||||
Utils::Environment MakeStep::environment(BuildConfiguration *bc) const
|
||||
Environment MakeStep::makeEnvironment() const
|
||||
{
|
||||
Utils::Environment env = bc ? bc->environment() : Utils::Environment::systemEnvironment();
|
||||
Environment env = buildEnvironment();
|
||||
Utils::Environment::setupEnglishOutput(&env);
|
||||
if (makeCommand().isEmpty()) {
|
||||
// We also prepend "L" to the MAKEFLAGS, so that nmake / jom are less verbose
|
||||
@@ -494,10 +494,10 @@ void MakeStepConfigWidget::updateDetails()
|
||||
m_ui->disableInSubDirsCheckBox->setChecked(!m_makeStep->enabledForSubDirs());
|
||||
|
||||
ProcessParameters param;
|
||||
param.setMacroExpander(bc->macroExpander());
|
||||
param.setWorkingDirectory(bc->buildDirectory());
|
||||
param.setMacroExpander(m_makeStep->macroExpander());
|
||||
param.setWorkingDirectory(m_makeStep->buildDirectory());
|
||||
param.setCommandLine(make);
|
||||
param.setEnvironment(m_makeStep->environment(bc));
|
||||
param.setEnvironment(m_makeStep->buildEnvironment());
|
||||
|
||||
if (param.commandMissing())
|
||||
setSummaryText(tr("<b>Make:</b> %1 not found in the environment.")
|
||||
|
@@ -87,7 +87,7 @@ public:
|
||||
bool enabledForSubDirs() const { return m_enabledForSubDirs; }
|
||||
void setEnabledForSubDirs(bool enabled) { m_enabledForSubDirs = enabled; }
|
||||
|
||||
Utils::Environment environment(BuildConfiguration *bc) const;
|
||||
Utils::Environment makeEnvironment() const;
|
||||
|
||||
protected:
|
||||
bool fromMap(const QVariantMap &map) override;
|
||||
|
@@ -92,19 +92,13 @@ bool ProcessStep::init()
|
||||
|
||||
void ProcessStep::setupProcessParameters(ProcessParameters *pp)
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
|
||||
QString workingDirectory = m_workingDirectory->value();
|
||||
if (workingDirectory.isEmpty()) {
|
||||
if (bc)
|
||||
workingDirectory = Constants::DEFAULT_WORKING_DIR;
|
||||
else
|
||||
workingDirectory = Constants::DEFAULT_WORKING_DIR_ALTERNATE;
|
||||
}
|
||||
if (workingDirectory.isEmpty())
|
||||
workingDirectory = fallbackWorkingDirectory();
|
||||
|
||||
pp->setMacroExpander(bc ? bc->macroExpander() : Utils::globalMacroExpander());
|
||||
pp->setEnvironment(bc ? bc->environment() : Utils::Environment::systemEnvironment());
|
||||
pp->setWorkingDirectory(Utils::FilePath::fromString(workingDirectory));
|
||||
pp->setMacroExpander(macroExpander());
|
||||
pp->setEnvironment(buildEnvironment());
|
||||
pp->setWorkingDirectory(FilePath::fromString(workingDirectory));
|
||||
pp->setCommandLine({m_command->filePath(), m_arguments->value(), CommandLine::Raw});
|
||||
pp->resolveAll();
|
||||
}
|
||||
|
@@ -234,7 +234,7 @@ QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) co
|
||||
Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
|
||||
|
||||
if (variableHandling == ExpandVariables) {
|
||||
const MacroExpander * const expander = buildConfiguration()->macroExpander();
|
||||
const MacroExpander * const expander = macroExpander();
|
||||
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
|
||||
const QString rawString = it.value().toString();
|
||||
const QString expandedString = expander->expand(rawString);
|
||||
@@ -273,7 +273,7 @@ Utils::FilePath QbsBuildStep::installRoot(VariableHandling variableHandling) con
|
||||
return Utils::FilePath::fromString(root);
|
||||
QString defaultInstallDir = QbsSettings::defaultInstallDirTemplate();
|
||||
if (variableHandling == VariableHandling::ExpandVariables)
|
||||
defaultInstallDir = buildConfiguration()->macroExpander()->expand(defaultInstallDir);
|
||||
defaultInstallDir = macroExpander()->expand(defaultInstallDir);
|
||||
return FilePath::fromString(defaultInstallDir);
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ QString QbsBuildStep::buildVariant() const
|
||||
|
||||
QbsBuildSystem *QbsBuildStep::qbsBuildSystem() const
|
||||
{
|
||||
return static_cast<QbsBuildSystem *>(buildConfiguration()->buildSystem());
|
||||
return static_cast<QbsBuildSystem *>(buildSystem());
|
||||
}
|
||||
|
||||
void QbsBuildStep::setBuildVariant(const QString &variant)
|
||||
@@ -644,9 +644,7 @@ QbsBuildStepConfigWidget::QbsBuildStepConfigWidget(QbsBuildStep *step) :
|
||||
auto chooser = new Core::VariableChooser(this);
|
||||
chooser->addSupportedWidget(propertyEdit);
|
||||
chooser->addSupportedWidget(installDirChooser->lineEdit());
|
||||
chooser->addMacroExpanderProvider([step] {
|
||||
return step->buildConfiguration()->macroExpander();
|
||||
});
|
||||
chooser->addMacroExpanderProvider([step] { return step->macroExpander(); });
|
||||
propertyEdit->setValidationFunction([this](FancyLineEdit *edit, QString *errorMessage) {
|
||||
return validateProperties(edit, errorMessage);
|
||||
});
|
||||
@@ -868,7 +866,7 @@ bool QbsBuildStepConfigWidget::validateProperties(Utils::FancyLineEdit *edit, QS
|
||||
}
|
||||
|
||||
QList<Property> properties;
|
||||
const MacroExpander * const expander = step()->buildConfiguration()->macroExpander();
|
||||
const MacroExpander * const expander = step()->macroExpander();
|
||||
foreach (const QString &rawArg, argList) {
|
||||
int pos = rawArg.indexOf(':');
|
||||
if (pos > 0) {
|
||||
|
@@ -109,7 +109,7 @@ QbsInstallStep::~QbsInstallStep()
|
||||
|
||||
bool QbsInstallStep::init()
|
||||
{
|
||||
QTC_ASSERT(!buildConfiguration()->buildSystem()->isParsing() && !m_session, return false);
|
||||
QTC_ASSERT(!buildSystem()->isParsing() && !m_session, return false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -107,7 +107,7 @@ bool QmakeMakeStep::init()
|
||||
// for file builds, since the rules for that are
|
||||
// only in those files.
|
||||
if (subProFile->isDebugAndRelease() && bc->fileNodeBuild()) {
|
||||
if (bc->buildType() == QmakeBuildConfiguration::Debug)
|
||||
if (buildType() == QmakeBuildConfiguration::Debug)
|
||||
makefile += ".Debug";
|
||||
else
|
||||
makefile += ".Release";
|
||||
@@ -162,7 +162,7 @@ bool QmakeMakeStep::init()
|
||||
makeCmd.addArg(objectFile);
|
||||
}
|
||||
|
||||
pp->setEnvironment(environment(bc));
|
||||
pp->setEnvironment(makeEnvironment());
|
||||
pp->setCommandLine(makeCmd);
|
||||
pp->resolveAll();
|
||||
|
||||
@@ -177,7 +177,7 @@ bool QmakeMakeStep::init()
|
||||
appendOutputParser(new QMakeParser); // make may cause qmake to be run, add last to make sure
|
||||
// it has a low priority.
|
||||
|
||||
auto rootNode = dynamic_cast<QmakeProFileNode *>(bc->project()->rootProjectNode());
|
||||
auto rootNode = dynamic_cast<QmakeProFileNode *>(project()->rootProjectNode());
|
||||
QTC_ASSERT(rootNode, return false);
|
||||
m_scriptTarget = rootNode->projectType() == ProjectType::ScriptTemplate;
|
||||
m_unalignedBuildDir = !bc->isBuildDirAtSafeLocation();
|
||||
|
@@ -86,7 +86,7 @@ QString AbstractPackagingStep::cachedPackageDirectory() const
|
||||
|
||||
QString AbstractPackagingStep::packageDirectory() const
|
||||
{
|
||||
return buildConfiguration()->buildDirectory().toString();
|
||||
return buildDirectory().toString();
|
||||
}
|
||||
|
||||
bool AbstractPackagingStep::isPackagingNeeded() const
|
||||
|
@@ -187,7 +187,7 @@ bool WinRtPackageDeploymentStep::init()
|
||||
return false;
|
||||
}
|
||||
params->setCommandLine(windeployqt);
|
||||
params->setEnvironment(buildConfiguration()->environment());
|
||||
params->setEnvironment(buildEnvironment());
|
||||
|
||||
return AbstractProcessStep::init();
|
||||
}
|
||||
|
Reference in New Issue
Block a user