Commit 79f82d0d authored by Tobias Hunger's avatar Tobias Hunger

BuildManager: Provide context of earlier build steps to init

This information can be used to get information from earlier steps,
which e.g. queried for android devices to deploy to.

Change-Id: Iefe1c9443915cb6211f86f98ff7aaf3cb75145ba
Reviewed-by: default avatarNiels Weber <niels.weber@theqtcompany.com>
parent cedf015c
......@@ -97,7 +97,7 @@ AndroidBuildApkStep::AndroidBuildApkStep(ProjectExplorer::BuildStepList *parent,
}
}
bool AndroidBuildApkStep::init()
bool AndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
......@@ -132,7 +132,7 @@ bool AndroidBuildApkStep::init()
m_openPackageLocationForRun = m_openPackageLocation;
m_apkPath = AndroidManager::androidQtSupport(target())->apkPath(target()).toString();
bool result = AbstractProcessStep::init();
bool result = AbstractProcessStep::init(earlierSteps);
if (!result)
return false;
......
......@@ -97,7 +97,7 @@ protected:
bool keystorePassword();
bool certificatePassword();
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override { return true; }
void processFinished(int exitCode, QProcess::ExitStatus status) override;
......
......@@ -166,8 +166,9 @@ void AndroidDeployQtStep::ctor()
this, &AndroidDeployQtStep::slotSetSerialNumber);
}
bool AndroidDeployQtStep::init()
bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
m_androiddeployqtArgs.clear();
if (AndroidManager::checkForQt51Files(project()->projectDirectory()))
......
......@@ -103,7 +103,7 @@ private:
void ctor();
void runCommand(const QString &program, const QStringList &arguments);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
enum DeployResult { Success, Failure, AskUinstall };
DeployResult runDeploy(QFutureInterface<bool> &fi);
......
......@@ -152,7 +152,7 @@ void AutogenStep::ctor()
setDefaultDisplayName(tr("Autogen"));
}
bool AutogenStep::init()
bool AutogenStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
......@@ -165,7 +165,7 @@ bool AutogenStep::init()
pp->setArguments(additionalArguments());
pp->resolveAll();
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void AutogenStep::run(QFutureInterface<bool> &interface)
......
......@@ -96,7 +96,7 @@ class AutogenStep : public ProjectExplorer::AbstractProcessStep
public:
explicit AutogenStep(ProjectExplorer::BuildStepList *bsl);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &interface) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
......
......@@ -151,7 +151,7 @@ void AutoreconfStep::ctor()
setDefaultDisplayName(tr("Autoreconf"));
}
bool AutoreconfStep::init()
bool AutoreconfStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
......@@ -164,7 +164,7 @@ bool AutoreconfStep::init()
pp->setArguments(additionalArguments());
pp->resolveAll();
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void AutoreconfStep::run(QFutureInterface<bool> &interface)
......
......@@ -96,7 +96,7 @@ class AutoreconfStep : public ProjectExplorer::AbstractProcessStep
public:
explicit AutoreconfStep(ProjectExplorer::BuildStepList *bsl);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &interface) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
......
......@@ -166,7 +166,7 @@ void ConfigureStep::ctor()
setDefaultDisplayName(tr("Configure"));
}
bool ConfigureStep::init()
bool ConfigureStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
......@@ -178,7 +178,7 @@ bool ConfigureStep::init()
pp->setArguments(additionalArguments());
pp->resolveAll();
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void ConfigureStep::run(QFutureInterface<bool>& interface)
......
......@@ -95,7 +95,7 @@ class ConfigureStep : public ProjectExplorer::AbstractProcessStep
public:
explicit ConfigureStep(ProjectExplorer::BuildStepList *bsl);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &interface) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
......
......@@ -160,7 +160,7 @@ void MakeStep::setClean(bool clean)
m_clean = clean;
}
bool MakeStep::init()
bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
......@@ -200,7 +200,7 @@ bool MakeStep::init()
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void MakeStep::run(QFutureInterface<bool> &interface)
......
......@@ -94,7 +94,7 @@ class MakeStep : public ProjectExplorer::AbstractProcessStep
public:
explicit MakeStep(ProjectExplorer::BuildStepList *bsl);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &interface) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
void setClean(bool clean);
......
......@@ -132,8 +132,9 @@ QString BareMetalGdbCommandsDeployStep::gdbCommands() const
return m_gdbCommands;
}
bool BareMetalGdbCommandsDeployStep::init()
bool BareMetalGdbCommandsDeployStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
return true;
}
......
......@@ -48,7 +48,7 @@ public:
BareMetalGdbCommandsDeployStep(ProjectExplorer::BuildStepList *bsl,
BareMetalGdbCommandsDeployStep *other);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
bool runInGuiThread() const override { return true;}
......
......@@ -174,7 +174,7 @@ bool MakeStep::fromMap(const QVariantMap &map)
}
bool MakeStep::init()
bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
{
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
if (!bc)
......@@ -219,7 +219,7 @@ bool MakeStep::init()
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void MakeStep::run(QFutureInterface<bool> &fi)
......
......@@ -59,7 +59,7 @@ public:
CMakeBuildConfiguration *cmakeBuildConfiguration() const;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
......
......@@ -94,7 +94,7 @@ void GenericMakeStep::ctor()
GENERIC_MS_DISPLAY_NAME));
}
bool GenericMakeStep::init()
bool GenericMakeStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
......@@ -134,7 +134,7 @@ bool GenericMakeStep::init()
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void GenericMakeStep::setClean(bool clean)
......
......@@ -54,7 +54,7 @@ class GenericMakeStep : public ProjectExplorer::AbstractProcessStep
public:
explicit GenericMakeStep(ProjectExplorer::BuildStepList *parent);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
......
......@@ -95,7 +95,7 @@ void IosBuildStep::ctor()
IOS_BUILD_STEP_DISPLAY_NAME));
}
bool IosBuildStep::init()
bool IosBuildStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
......@@ -135,7 +135,7 @@ bool IosBuildStep::init()
appendOutputParser(parser);
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void IosBuildStep::setClean(bool clean)
......
......@@ -53,7 +53,7 @@ class IosBuildStep : public ProjectExplorer::AbstractProcessStep
public:
explicit IosBuildStep(ProjectExplorer::BuildStepList *parent);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
......
......@@ -97,8 +97,9 @@ void IosDeployStep::updateDisplayNames()
setDisplayName(tr("Deploy to %1").arg(devName));
}
bool IosDeployStep::init()
bool IosDeployStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
QTC_ASSERT(m_transferStatus == NoTransfer, return false);
m_device = DeviceKitInformation::device(target()->kit());
IosRunConfiguration * runConfig = qobject_cast<IosRunConfiguration *>(
......
......@@ -88,7 +88,7 @@ private slots:
private:
IosDeployStep(ProjectExplorer::BuildStepList *bc,
IosDeployStep *other);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override { return true; }
bool runInGuiThread() const override { return true; }
......
......@@ -84,7 +84,7 @@ bool IosPresetBuildStep::completeSetupWithStep(BuildStep *bs)
return true;
}
bool IosPresetBuildStep::init()
bool IosPresetBuildStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
......@@ -111,7 +111,7 @@ bool IosPresetBuildStep::init()
if (outputParser())
outputParser()->setWorkingDirectory(pp->effectiveWorkingDirectory());
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
QVariantMap IosPresetBuildStep::toMap() const
......
......@@ -47,7 +47,7 @@ class IosPresetBuildStep : public ProjectExplorer::AbstractProcessStep
friend class IosPresetBuildStepFactory;
public:
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
......
......@@ -178,8 +178,9 @@ void AbstractProcessStep::setIgnoreReturnValue(bool b)
YourBuildStep::init().
*/
bool AbstractProcessStep::init()
bool AbstractProcessStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
return true;
}
......
......@@ -54,7 +54,7 @@ class PROJECTEXPLORER_EXPORT AbstractProcessStep : public BuildStep
public:
~AbstractProcessStep() override;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &) override;
bool runInGuiThread() const override { return true; }
......
......@@ -491,6 +491,7 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps, QStringList names,
addToOutputWindow(str, BuildStep::MessageOutput, BuildStep::DontAppendNewline);
}
QList<const BuildStep *> earlierSteps;
int count = steps.size();
bool init = true;
int i = 0;
......@@ -501,9 +502,10 @@ bool BuildManager::buildQueueAppend(QList<BuildStep *> steps, QStringList names,
connect(bs, SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat,ProjectExplorer::BuildStep::OutputNewlineSetting)),
m_instance, SLOT(addToOutputWindow(QString,ProjectExplorer::BuildStep::OutputFormat,ProjectExplorer::BuildStep::OutputNewlineSetting)));
if (bs->enabled()) {
init = bs->init();
init = bs->init(earlierSteps);
if (!init)
break;
earlierSteps.append(bs);
}
}
if (!init) {
......
......@@ -56,7 +56,7 @@ protected:
BuildStep(BuildStepList *bsl, BuildStep *bs);
public:
virtual bool init() = 0;
virtual bool init(QList<const BuildStep *> &earlierSteps) = 0;
virtual void run(QFutureInterface<bool> &fi) = 0;
......
......@@ -54,8 +54,9 @@ DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, DeviceCheckBuildS
setDefaultDisplayName(stepDisplayName());
}
bool DeviceCheckBuildStep::init()
bool DeviceCheckBuildStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
IDevice::ConstPtr device = DeviceKitInformation::device(target()->kit());
if (!device) {
Core::Id deviceTypeId = DeviceTypeKitInformation::deviceTypeId(target()->kit());
......
......@@ -47,7 +47,7 @@ public:
DeviceCheckBuildStep(BuildStepList *bsl, Core::Id id);
DeviceCheckBuildStep(BuildStepList *bsl, DeviceCheckBuildStep *bs);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
......
......@@ -72,7 +72,7 @@ void ProcessStep::ctor()
m_workingDirectory = QLatin1String(Constants::DEFAULT_WORKING_DIR);
}
bool ProcessStep::init()
bool ProcessStep::init(QList<const BuildStep *> &earlierSteps)
{
BuildConfiguration *bc = buildConfiguration();
if (!bc)
......@@ -86,7 +86,7 @@ bool ProcessStep::init()
pp->resolveAll();
setOutputParser(target()->kit()->createOutputParser());
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void ProcessStep::run(QFutureInterface<bool> & fi)
......
......@@ -65,7 +65,7 @@ class ProcessStep : public AbstractProcessStep
public:
explicit ProcessStep(BuildStepList *bsl);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &) override;
BuildStepConfigWidget *createConfigWidget() override;
......
......@@ -95,8 +95,9 @@ QbsBuildStep::~QbsBuildStep()
delete m_parser;
}
bool QbsBuildStep::init()
bool QbsBuildStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
if (static_cast<QbsProject *>(project())->isParsing() || m_job)
return false;
......
......@@ -55,7 +55,7 @@ public:
QbsBuildStep(ProjectExplorer::BuildStepList *bsl, const QbsBuildStep *other);
~QbsBuildStep() override;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
......
......@@ -80,8 +80,9 @@ QbsCleanStep::~QbsCleanStep()
}
}
bool QbsCleanStep::init()
bool QbsCleanStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
if (static_cast<QbsProject *>(project())->isParsing() || m_job)
return false;
......
......@@ -52,7 +52,7 @@ public:
QbsCleanStep(ProjectExplorer::BuildStepList *bsl, const QbsCleanStep *other);
~QbsCleanStep() override;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
......
......@@ -83,8 +83,9 @@ QbsInstallStep::~QbsInstallStep()
m_job = 0;
}
bool QbsInstallStep::init()
bool QbsInstallStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);
QTC_ASSERT(!static_cast<QbsProject *>(project())->isParsing() && !m_job, return false);
return true;
}
......
......@@ -52,7 +52,7 @@ public:
QbsInstallStep(ProjectExplorer::BuildStepList *bsl, const QbsInstallStep *other);
~QbsInstallStep() override;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
......
......@@ -60,7 +60,7 @@ AndroidPackageInstallationStep::AndroidPackageInstallationStep(ProjectExplorer::
: AbstractProcessStep(bc, other)
{ }
bool AndroidPackageInstallationStep::init()
bool AndroidPackageInstallationStep::init(QList<const BuildStep *> &earlierSteps)
{
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
QString dirPath = bc->buildDirectory().appendPath(QLatin1String(Android::Constants::ANDROID_BUILDDIRECTORY)).toString();
......@@ -100,7 +100,7 @@ bool AndroidPackageInstallationStep::init()
m_androidDirsToClean << dirPath;
}
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void AndroidPackageInstallationStep::run(QFutureInterface<bool> &fi)
......
......@@ -44,7 +44,7 @@ class AndroidPackageInstallationStep : public ProjectExplorer::AbstractProcessSt
public:
explicit AndroidPackageInstallationStep(ProjectExplorer::BuildStepList *bsl);
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
......
......@@ -168,12 +168,12 @@ void QmakeAndroidBuildApkStep::ctor()
{
}
bool QmakeAndroidBuildApkStep::init()
bool QmakeAndroidBuildApkStep::init(QList<const BuildStep *> &earlierSteps)
{
if (AndroidManager::checkForQt51Files(project()->projectDirectory()))
emit addOutput(tr("Found old folder \"android\" in source directory. Qt 5.2 does not use that folder by default."), ErrorOutput);
if (!AndroidBuildApkStep::init())
if (!AndroidBuildApkStep::init(earlierSteps))
return false;
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target()->kit());
......
......@@ -77,7 +77,7 @@ protected:
protected:
void ctor();
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
void processStarted() override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
......
......@@ -147,7 +147,7 @@ bool MakeStep::fromMap(const QVariantMap &map)
return AbstractProcessStep::fromMap(map);
}
bool MakeStep::init()
bool MakeStep::init(QList<const BuildStep *> &earlierSteps)
{
QmakeBuildConfiguration *bc = qmakeBuildConfiguration();
if (!bc)
......@@ -266,7 +266,7 @@ bool MakeStep::init()
m_scriptTarget = (static_cast<QmakeProject *>(bc->target()->project())->rootQmakeProjectNode()->projectType() == ScriptTemplate);
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void MakeStep::run(QFutureInterface<bool> & fi)
......
......@@ -83,7 +83,7 @@ public:
QmakeBuildConfiguration *qmakeBuildConfiguration() const;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
......
......@@ -180,7 +180,7 @@ QMakeStepConfig QMakeStep::deducedArguments()
}
bool QMakeStep::init()
bool QMakeStep::init(QList<const BuildStep *> &earlierSteps)
{
QmakeBuildConfiguration *qt4bc = qmakeBuildConfiguration();
const QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
......@@ -251,7 +251,7 @@ bool QMakeStep::init()
m_scriptTemplate = node->projectType() == ScriptTemplate;
return AbstractProcessStep::init();
return AbstractProcessStep::init(earlierSteps);
}
void QMakeStep::run(QFutureInterface<bool> &fi)
......
......@@ -131,7 +131,7 @@ public:
explicit QMakeStep(ProjectExplorer::BuildStepList *parent);
QmakeBuildConfiguration *qmakeBuildConfiguration() const;
bool init() override;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
......
......@@ -139,8 +139,9 @@ bool AbstractPackagingStep::isPackagingNeeded() const
return false;
}
bool AbstractPackagingStep::init()
bool AbstractPackagingStep::init(QList<const BuildStep *> &earlierSteps)
{
Q_UNUSED(earlierSteps);