forked from qt-creator/qt-creator
Revert "ProjectExplorer: Upstream CMake's handling of outdated builds"
This reverts commit 8536504caa.
Break CustomRunConfigurations.
Change-Id: I43020bd34780cb5fd02bbe640a817370d73cca18
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -76,6 +76,28 @@ void CMakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo
|
|||||||
updateTargetInformation();
|
updateTargetInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMakeRunConfiguration::isBuildTargetValid() const
|
||||||
|
{
|
||||||
|
return Utils::anyOf(target()->applicationTargets().list, [this](const BuildTargetInfo &bti) {
|
||||||
|
return bti.buildKey == buildKey();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeRunConfiguration::updateEnabledState()
|
||||||
|
{
|
||||||
|
if (!isBuildTargetValid())
|
||||||
|
setEnabled(false);
|
||||||
|
else
|
||||||
|
RunConfiguration::updateEnabledState();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeRunConfiguration::disabledReason() const
|
||||||
|
{
|
||||||
|
if (!isBuildTargetValid())
|
||||||
|
return tr("The project no longer builds the target associated with this run configuration.");
|
||||||
|
return RunConfiguration::disabledReason();
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeRunConfiguration::updateTargetInformation()
|
void CMakeRunConfiguration::updateTargetInformation()
|
||||||
{
|
{
|
||||||
BuildTargetInfo bti = buildTargetInfo();
|
BuildTargetInfo bti = buildTargetInfo();
|
||||||
|
|||||||
@@ -38,8 +38,13 @@ public:
|
|||||||
CMakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
CMakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString disabledReason() const override;
|
||||||
|
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
||||||
|
bool isBuildTargetValid() const;
|
||||||
void updateTargetInformation();
|
void updateTargetInformation();
|
||||||
|
|
||||||
|
void updateEnabledState() final;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
class CMakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||||
|
|||||||
@@ -211,8 +211,6 @@ void RunConfiguration::setEnabled(bool enabled)
|
|||||||
|
|
||||||
QString RunConfiguration::disabledReason() const
|
QString RunConfiguration::disabledReason() const
|
||||||
{
|
{
|
||||||
if (!target()->hasBuildTarget(m_buildKey))
|
|
||||||
return tr("The project no longer builds the target associated with this run configuration.");
|
|
||||||
if (target()->project()->isParsing())
|
if (target()->project()->isParsing())
|
||||||
return tr("The Project is currently being parsed.");
|
return tr("The Project is currently being parsed.");
|
||||||
if (!target()->project()->hasParsingData()) {
|
if (!target()->project()->hasParsingData()) {
|
||||||
@@ -247,14 +245,9 @@ QWidget *RunConfiguration::createConfigurationWidget()
|
|||||||
|
|
||||||
void RunConfiguration::updateEnabledState()
|
void RunConfiguration::updateEnabledState()
|
||||||
{
|
{
|
||||||
if (!target()->hasBuildTarget(m_buildKey)) {
|
Project *p = target()->project();
|
||||||
// This apparently may happen for cmake builds where also outdated
|
|
||||||
// RunConfigurations are kept when builds change.
|
setEnabled(!p->isParsing() && p->hasParsingData());
|
||||||
setEnabled(false); // Might happen for CMake.
|
|
||||||
} else {
|
|
||||||
Project *p = target()->project();
|
|
||||||
setEnabled(!p->isParsing() && p->hasParsingData());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunConfiguration::addAspectFactory(const AspectFactory &aspectFactory)
|
void RunConfiguration::addAspectFactory(const AspectFactory &aspectFactory)
|
||||||
|
|||||||
@@ -365,13 +365,6 @@ BuildTargetInfo Target::buildTarget(const QString &buildKey) const
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Target::hasBuildTarget(const QString &buildKey) const
|
|
||||||
{
|
|
||||||
return Utils::anyOf(d->m_appTargets.list, [buildKey](const BuildTargetInfo &bti) {
|
|
||||||
return bti.buildKey == buildKey;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ProjectConfiguration *> Target::projectConfigurations() const
|
QList<ProjectConfiguration *> Target::projectConfigurations() const
|
||||||
{
|
{
|
||||||
QList<ProjectConfiguration *> result;
|
QList<ProjectConfiguration *> result;
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ public:
|
|||||||
void setApplicationTargets(const BuildTargetInfoList &appTargets);
|
void setApplicationTargets(const BuildTargetInfoList &appTargets);
|
||||||
BuildTargetInfoList applicationTargets() const;
|
BuildTargetInfoList applicationTargets() const;
|
||||||
BuildTargetInfo buildTarget(const QString &buildKey) const;
|
BuildTargetInfo buildTarget(const QString &buildKey) const;
|
||||||
bool hasBuildTarget(const QString &buildKey) const;
|
|
||||||
|
|
||||||
QList<ProjectConfiguration *> projectConfigurations() const;
|
QList<ProjectConfiguration *> projectConfigurations() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user