forked from qt-creator/qt-creator
server-mode: Always try to read CMakeCache, even after error
Change-Id: Ib3d4fb5ac14340a7f706e4a1d8a0cbdc420d01d1 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -356,8 +356,6 @@ QList<CMakeBuildTarget> BuildDirManager::takeBuildTargets() const
|
|||||||
|
|
||||||
CMakeConfig BuildDirManager::takeCMakeConfiguration() const
|
CMakeConfig BuildDirManager::takeCMakeConfiguration() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_isHandlingError, return {});
|
|
||||||
|
|
||||||
if (!m_reader)
|
if (!m_reader)
|
||||||
return CMakeConfig();
|
return CMakeConfig();
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
|
|||||||
CMakeBuildConfiguration *bc = activeBc(this);
|
CMakeBuildConfiguration *bc = activeBc(this);
|
||||||
if (bc && bc == m_buildDirManager.buildConfiguration()) {
|
if (bc && bc == m_buildDirManager.buildConfiguration()) {
|
||||||
bc->setError(msg);
|
bc->setError(msg);
|
||||||
|
bc->setConfigurationFromCMake(m_buildDirManager.takeCMakeConfiguration());
|
||||||
handleParsingError(bc);
|
handleParsingError(bc);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ void ServerModeReader::parse(bool forceConfiguration)
|
|||||||
tr("Configuring \"%1\"").arg(m_parameters.projectName),
|
tr("Configuring \"%1\"").arg(m_parameters.projectName),
|
||||||
"CMake.Configure");
|
"CMake.Configure");
|
||||||
|
|
||||||
|
m_delayedErrorMessage.clear();
|
||||||
m_cmakeServer->sendRequest(CONFIGURE_TYPE, extra);
|
m_cmakeServer->sendRequest(CONFIGURE_TYPE, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,42 +387,49 @@ void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
|||||||
|
|
||||||
void ServerModeReader::handleReply(const QVariantMap &data, const QString &inReplyTo)
|
void ServerModeReader::handleReply(const QVariantMap &data, const QString &inReplyTo)
|
||||||
{
|
{
|
||||||
Q_UNUSED(data);
|
if (!m_delayedErrorMessage.isEmpty()) {
|
||||||
if (inReplyTo == CONFIGURE_TYPE) {
|
// Handle reply to cache after error:
|
||||||
m_cmakeServer->sendRequest(COMPUTE_TYPE);
|
if (inReplyTo == CACHE_TYPE)
|
||||||
if (m_future)
|
extractCacheData(data);
|
||||||
m_future->setProgressValue(1000);
|
reportError();
|
||||||
m_progressStepMinimum = m_progressStepMaximum;
|
} else {
|
||||||
m_progressStepMaximum = 1100;
|
// No error yet:
|
||||||
} else if (inReplyTo == COMPUTE_TYPE) {
|
if (inReplyTo == CONFIGURE_TYPE) {
|
||||||
m_cmakeServer->sendRequest(CODEMODEL_TYPE);
|
m_cmakeServer->sendRequest(COMPUTE_TYPE);
|
||||||
if (m_future)
|
if (m_future)
|
||||||
m_future->setProgressValue(1100);
|
m_future->setProgressValue(1000);
|
||||||
m_progressStepMinimum = m_progressStepMaximum;
|
m_progressStepMinimum = m_progressStepMaximum;
|
||||||
m_progressStepMaximum = 1200;
|
m_progressStepMaximum = 1100;
|
||||||
} else if (inReplyTo == CODEMODEL_TYPE) {
|
} else if (inReplyTo == COMPUTE_TYPE) {
|
||||||
extractCodeModelData(data);
|
m_cmakeServer->sendRequest(CODEMODEL_TYPE);
|
||||||
m_cmakeServer->sendRequest(CMAKE_INPUTS_TYPE);
|
if (m_future)
|
||||||
if (m_future)
|
m_future->setProgressValue(1100);
|
||||||
m_future->setProgressValue(1200);
|
m_progressStepMinimum = m_progressStepMaximum;
|
||||||
m_progressStepMinimum = m_progressStepMaximum;
|
m_progressStepMaximum = 1200;
|
||||||
m_progressStepMaximum = 1300;
|
} else if (inReplyTo == CODEMODEL_TYPE) {
|
||||||
} else if (inReplyTo == CMAKE_INPUTS_TYPE) {
|
extractCodeModelData(data);
|
||||||
extractCMakeInputsData(data);
|
m_cmakeServer->sendRequest(CMAKE_INPUTS_TYPE);
|
||||||
m_cmakeServer->sendRequest(CACHE_TYPE);
|
if (m_future)
|
||||||
if (m_future)
|
m_future->setProgressValue(1200);
|
||||||
m_future->setProgressValue(1300);
|
m_progressStepMinimum = m_progressStepMaximum;
|
||||||
m_progressStepMinimum = m_progressStepMaximum;
|
m_progressStepMaximum = 1300;
|
||||||
m_progressStepMaximum = 1400;
|
} else if (inReplyTo == CMAKE_INPUTS_TYPE) {
|
||||||
} else if (inReplyTo == CACHE_TYPE) {
|
extractCMakeInputsData(data);
|
||||||
extractCacheData(data);
|
m_cmakeServer->sendRequest(CACHE_TYPE);
|
||||||
if (m_future) {
|
if (m_future)
|
||||||
m_future->setProgressValue(MAX_PROGRESS);
|
m_future->setProgressValue(1300);
|
||||||
m_future->reportFinished();
|
m_progressStepMinimum = m_progressStepMaximum;
|
||||||
m_future.reset();
|
m_progressStepMaximum = 1400;
|
||||||
|
} else if (inReplyTo == CACHE_TYPE) {
|
||||||
|
extractCacheData(data);
|
||||||
|
if (m_future) {
|
||||||
|
m_future->setProgressValue(MAX_PROGRESS);
|
||||||
|
m_future->reportFinished();
|
||||||
|
m_future.reset();
|
||||||
|
}
|
||||||
|
Core::MessageManager::write(tr("CMake Project was parsed successfully."));
|
||||||
|
emit dataAvailable();
|
||||||
}
|
}
|
||||||
Core::MessageManager::write(tr("CMake Project was parsed successfully."));
|
|
||||||
emit dataAvailable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,9 +437,17 @@ void ServerModeReader::handleError(const QString &message)
|
|||||||
{
|
{
|
||||||
TaskHub::addTask(Task::Error, message, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
TaskHub::addTask(Task::Error, message, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||||
Utils::FileName(), -1);
|
Utils::FileName(), -1);
|
||||||
stop();
|
if (!m_delayedErrorMessage.isEmpty()) {
|
||||||
Core::MessageManager::write(tr("CMake Project parsing failed."));
|
reportError();
|
||||||
emit errorOccured(message);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_delayedErrorMessage = message;
|
||||||
|
|
||||||
|
// Always try to read CMakeCache, even after an error!
|
||||||
|
m_cmakeServer->sendRequest(CACHE_TYPE);
|
||||||
|
if (m_future)
|
||||||
|
m_future->setProgressValue(1300);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerModeReader::handleProgress(int min, int cur, int max, const QString &inReplyTo)
|
void ServerModeReader::handleProgress(int min, int cur, int max, const QString &inReplyTo)
|
||||||
@@ -452,6 +468,18 @@ void ServerModeReader::handleSignal(const QString &signal, const QVariantMap &da
|
|||||||
emit dirty();
|
emit dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerModeReader::reportError()
|
||||||
|
{
|
||||||
|
stop();
|
||||||
|
Core::MessageManager::write(tr("CMake Project parsing failed."));
|
||||||
|
emit errorOccured(m_delayedErrorMessage);
|
||||||
|
|
||||||
|
if (m_future)
|
||||||
|
m_future->reportCanceled();
|
||||||
|
|
||||||
|
m_delayedErrorMessage.clear();
|
||||||
|
}
|
||||||
|
|
||||||
int ServerModeReader::calculateProgress(const int minRange, const int min, const int cur, const int max, const int maxRange)
|
int ServerModeReader::calculateProgress(const int minRange, const int min, const int cur, const int max, const int maxRange)
|
||||||
{
|
{
|
||||||
if (minRange == maxRange || min == max)
|
if (minRange == maxRange || min == max)
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ private:
|
|||||||
void handleProgress(int min, int cur, int max, const QString &inReplyTo);
|
void handleProgress(int min, int cur, int max, const QString &inReplyTo);
|
||||||
void handleSignal(const QString &signal, const QVariantMap &data);
|
void handleSignal(const QString &signal, const QVariantMap &data);
|
||||||
|
|
||||||
|
void reportError();
|
||||||
|
|
||||||
int calculateProgress(const int minRange, const int min,
|
int calculateProgress(const int minRange, const int min,
|
||||||
const int cur,
|
const int cur,
|
||||||
const int max, const int maxRange);
|
const int max, const int maxRange);
|
||||||
@@ -166,6 +168,8 @@ private:
|
|||||||
int m_progressStepMinimum = 0;
|
int m_progressStepMinimum = 0;
|
||||||
int m_progressStepMaximum = 1000;
|
int m_progressStepMaximum = 1000;
|
||||||
|
|
||||||
|
QString m_delayedErrorMessage;
|
||||||
|
|
||||||
CMakeConfig m_cmakeConfiguration;
|
CMakeConfig m_cmakeConfiguration;
|
||||||
|
|
||||||
QSet<Utils::FileName> m_cmakeFiles;
|
QSet<Utils::FileName> m_cmakeFiles;
|
||||||
|
|||||||
Reference in New Issue
Block a user