forked from qt-creator/qt-creator
Centralize retrieving the "parent" build configuration
If a step is part of a build configuration, that is used, but many steps can be used as part of a deploy configuration. In that case the active build configuration of the step's target must be used, and that logic was duplicated many times. Instead, let BuildStep::buildConfiguration take care of that logic. For steps that are not offered for deploy configurations there is no semantic difference, and for the others this removes code duplication. Change-Id: I02f3bb50226590092cedcec02fce6fde9c7c6e63 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -120,7 +120,7 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
}
|
||||
|
||||
AndroidBuildApkStep *androidBuildApkStep
|
||||
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target()->activeBuildConfiguration());
|
||||
= AndroidGlobal::buildStep<AndroidBuildApkStep>(buildConfiguration());
|
||||
if (!androidBuildApkStep)
|
||||
emit addOutput(tr("Cannot find the android build step."), OutputFormat::Stderr);
|
||||
|
||||
@@ -137,7 +137,7 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
m_avdName = info.avdname;
|
||||
m_serialNumber = info.serialNumber;
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
m_filesToPull.clear();
|
||||
QString buildDir = bc ? bc->buildDirectory().toString() : QString();
|
||||
if (bc && !buildDir.endsWith("/")) {
|
||||
@@ -390,7 +390,7 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
|
||||
emit setSerialNumber(serialNumber);
|
||||
}
|
||||
|
||||
if (!target()->activeBuildConfiguration()) { // nothing to deploy
|
||||
if (!buildConfiguration()) { // nothing to deploy
|
||||
reportRunResult(fi, true);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user