forked from qt-creator/qt-creator
QbsBuildSystem: Do some cleanup
Get rid of CancelStatus enum and checkCancelStatus() method. Change-Id: If703c78c8c3d82a5e6a5976c7c42c1da238744db Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -62,8 +62,7 @@ BuildSystem::BuildSystem(Target *target)
|
|||||||
// Timer:
|
// Timer:
|
||||||
d->m_delayedParsingTimer.setSingleShot(true);
|
d->m_delayedParsingTimer.setSingleShot(true);
|
||||||
|
|
||||||
connect(&d->m_delayedParsingTimer, &QTimer::timeout, this,
|
connect(&d->m_delayedParsingTimer, &QTimer::timeout, this, [this] {
|
||||||
[this] {
|
|
||||||
if (ProjectManager::hasProject(project()))
|
if (ProjectManager::hasProject(project()))
|
||||||
triggerParsing();
|
triggerParsing();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -425,21 +425,6 @@ QString QbsBuildSystem::profile() const
|
|||||||
return QbsProfileManager::ensureProfileForKit(target()->kit());
|
return QbsProfileManager::ensureProfileForKit(target()->kit());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsBuildSystem::checkCancelStatus()
|
|
||||||
{
|
|
||||||
const CancelStatus cancelStatus = m_cancelStatus;
|
|
||||||
m_cancelStatus = CancelStatusNone;
|
|
||||||
if (cancelStatus != CancelStatusCancelingForReparse)
|
|
||||||
return false;
|
|
||||||
qCDebug(qbsPmLog) << "Cancel request while parsing, starting re-parse";
|
|
||||||
m_qbsProjectParser->deleteLater();
|
|
||||||
m_qbsProjectParser = nullptr;
|
|
||||||
m_treeCreationWatcher = nullptr;
|
|
||||||
m_guard = {};
|
|
||||||
startParsing();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QbsBuildSystem::updateAfterParse()
|
void QbsBuildSystem::updateAfterParse()
|
||||||
{
|
{
|
||||||
qCDebug(qbsPmLog) << "Updating data after parse";
|
qCDebug(qbsPmLog) << "Updating data after parse";
|
||||||
@@ -508,9 +493,6 @@ void QbsBuildSystem::handleQbsParsingDone(bool success)
|
|||||||
|
|
||||||
qCDebug(qbsPmLog) << "Parsing done, success:" << success;
|
qCDebug(qbsPmLog) << "Parsing done, success:" << success;
|
||||||
|
|
||||||
if (checkCancelStatus())
|
|
||||||
return;
|
|
||||||
|
|
||||||
generateErrors(m_qbsProjectParser->error());
|
generateErrors(m_qbsProjectParser->error());
|
||||||
|
|
||||||
bool dataChanged = false;
|
bool dataChanged = false;
|
||||||
@@ -545,9 +527,9 @@ void QbsBuildSystem::handleQbsParsingDone(bool success)
|
|||||||
if (dataChanged) {
|
if (dataChanged) {
|
||||||
updateAfterParse();
|
updateAfterParse();
|
||||||
return;
|
return;
|
||||||
}
|
} else if (envChanged) {
|
||||||
else if (envChanged)
|
|
||||||
updateCppCodeModel();
|
updateCppCodeModel();
|
||||||
|
}
|
||||||
if (success)
|
if (success)
|
||||||
m_guard.markAsSuccess();
|
m_guard.markAsSuccess();
|
||||||
m_guard = {};
|
m_guard = {};
|
||||||
@@ -592,25 +574,7 @@ void QbsBuildSystem::scheduleParsing()
|
|||||||
|
|
||||||
void QbsBuildSystem::startParsing()
|
void QbsBuildSystem::startParsing()
|
||||||
{
|
{
|
||||||
if (m_cancelStatus == CancelStatusCancelingForReparse)
|
QTC_ASSERT(!m_qbsProjectParser, return);
|
||||||
return;
|
|
||||||
|
|
||||||
// The CancelStatusCancelingAltoghether type can only be set by a build job, during
|
|
||||||
// which no other parse requests come through to this point (except by the build job itself,
|
|
||||||
// but of course not while canceling is in progress).
|
|
||||||
QTC_ASSERT(m_cancelStatus == CancelStatusNone, return);
|
|
||||||
|
|
||||||
// New parse requests override old ones.
|
|
||||||
// NOTE: We need to wait for the current operation to finish, since otherwise there could
|
|
||||||
// be a conflict. Consider the case where the old qbs::ProjectSetupJob is writing
|
|
||||||
// to the build graph file when the cancel request comes in. If we don't wait for
|
|
||||||
// acknowledgment, it might still be doing that when the new one already reads from the
|
|
||||||
// same file.
|
|
||||||
if (m_qbsProjectParser) {
|
|
||||||
m_cancelStatus = CancelStatusCancelingForReparse;
|
|
||||||
m_qbsProjectParser->cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap config = m_buildConfiguration->qbsConfiguration();
|
QVariantMap config = m_buildConfiguration->qbsConfiguration();
|
||||||
if (!config.contains(Constants::QBS_INSTALL_ROOT_KEY)) {
|
if (!config.contains(Constants::QBS_INSTALL_ROOT_KEY)) {
|
||||||
@@ -639,7 +603,6 @@ void QbsBuildSystem::startParsing()
|
|||||||
void QbsBuildSystem::cancelParsing()
|
void QbsBuildSystem::cancelParsing()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qbsProjectParser, return);
|
QTC_ASSERT(m_qbsProjectParser, return);
|
||||||
m_cancelStatus = CancelStatusCancelingAltogether;
|
|
||||||
m_qbsProjectParser->cancel();
|
m_qbsProjectParser->cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ private:
|
|||||||
void updateApplicationTargets();
|
void updateApplicationTargets();
|
||||||
void updateDeploymentInfo();
|
void updateDeploymentInfo();
|
||||||
void updateBuildTargetData();
|
void updateBuildTargetData();
|
||||||
bool checkCancelStatus();
|
|
||||||
void updateAfterParse();
|
void updateAfterParse();
|
||||||
void updateProjectNodes(const std::function<void()> &continuation);
|
void updateProjectNodes(const std::function<void()> &continuation);
|
||||||
Utils::FilePath installRoot();
|
Utils::FilePath installRoot();
|
||||||
@@ -137,12 +136,6 @@ private:
|
|||||||
Utils::Environment m_lastParseEnv;
|
Utils::Environment m_lastParseEnv;
|
||||||
std::unique_ptr<QbsRequest> m_parseRequest;
|
std::unique_ptr<QbsRequest> m_parseRequest;
|
||||||
|
|
||||||
enum CancelStatus {
|
|
||||||
CancelStatusNone,
|
|
||||||
CancelStatusCancelingForReparse,
|
|
||||||
CancelStatusCancelingAltogether
|
|
||||||
} m_cancelStatus = CancelStatusNone;
|
|
||||||
|
|
||||||
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
||||||
|
|
||||||
QHash<ProjectExplorer::ExtraCompilerFactory *, QStringList> m_sourcesForGeneratedFiles;
|
QHash<ProjectExplorer::ExtraCompilerFactory *, QStringList> m_sourcesForGeneratedFiles;
|
||||||
|
|||||||
Reference in New Issue
Block a user