forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.7'
Conflicts: src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h Change-Id: I192b9e88f967182f3275b4b98abed1220c26daac
This commit is contained in:
@@ -356,8 +356,6 @@ QList<CMakeBuildTarget> BuildDirManager::takeBuildTargets() const
|
||||
|
||||
CMakeConfig BuildDirManager::takeCMakeConfiguration() const
|
||||
{
|
||||
QTC_ASSERT(!m_isHandlingError, return {});
|
||||
|
||||
if (!m_reader)
|
||||
return CMakeConfig();
|
||||
|
||||
|
||||
@@ -494,7 +494,7 @@ CMakeConfig CMakeConfigurationKitInformation::configuration(const Kit *k)
|
||||
if (!k)
|
||||
return CMakeConfig();
|
||||
const QStringList tmp = k->value(CONFIGURATION_ID).toStringList();
|
||||
return Utils::transform(tmp, [](const QString &s) { return CMakeConfigItem::fromString(s); });
|
||||
return Utils::transform(tmp, &CMakeConfigItem::fromString);
|
||||
}
|
||||
|
||||
void CMakeConfigurationKitInformation::setConfiguration(Kit *k, const CMakeConfig &config)
|
||||
|
||||
@@ -106,6 +106,7 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM
|
||||
CMakeBuildConfiguration *bc = activeBc(this);
|
||||
if (bc && bc == m_buildDirManager.buildConfiguration()) {
|
||||
bc->setError(msg);
|
||||
bc->setConfigurationFromCMake(m_buildDirManager.takeCMakeConfiguration());
|
||||
handleParsingError(bc);
|
||||
}
|
||||
});
|
||||
@@ -475,7 +476,7 @@ void CMakeProject::startParsing(int reparseParameters)
|
||||
|
||||
QStringList CMakeProject::buildTargetTitles() const
|
||||
{
|
||||
return transform(buildTargets(), [](const CMakeBuildTarget &ct) { return ct.title; });
|
||||
return transform(buildTargets(), &CMakeBuildTarget::title);
|
||||
}
|
||||
|
||||
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
|
||||
@@ -670,7 +671,7 @@ void CMakeProject::createGeneratedCodeModelSupport()
|
||||
ExtraCompilerFactory::extraCompilerFactories();
|
||||
|
||||
const QSet<QString> fileExtensions
|
||||
= Utils::transform<QSet>(factories, [](const ExtraCompilerFactory *f) { return f->sourceTag(); });
|
||||
= Utils::transform<QSet>(factories, &ExtraCompilerFactory::sourceTag);
|
||||
|
||||
// Find all files generated by any of the extra compilers, in a rather crude way.
|
||||
const FileNameList fileList = files([&fileExtensions](const Node *n) {
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runnables.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -427,7 +427,7 @@ void CMakeTool::fetchVersionFromVersionOutput() const
|
||||
if (response.result != Utils::SynchronousProcessResponse::Finished)
|
||||
return;
|
||||
|
||||
QRegularExpression versionLine("^cmake version ((\\d+).(\\d+).(\\d+).*)$");
|
||||
QRegularExpression versionLine("^cmake.* version ((\\d+).(\\d+).(\\d+).*)$");
|
||||
const QString responseText = response.stdOut();
|
||||
for (const QStringRef &line : responseText.splitRef(QLatin1Char('\n'))) {
|
||||
QRegularExpressionMatch match = versionLine.match(line);
|
||||
|
||||
@@ -199,6 +199,7 @@ void ServerModeReader::parse(bool forceConfiguration)
|
||||
tr("Configuring \"%1\"").arg(m_parameters.projectName),
|
||||
"CMake.Configure");
|
||||
|
||||
m_delayedErrorMessage.clear();
|
||||
m_cmakeServer->sendRequest(CONFIGURE_TYPE, extra);
|
||||
}
|
||||
|
||||
@@ -389,42 +390,49 @@ void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
||||
|
||||
void ServerModeReader::handleReply(const QVariantMap &data, const QString &inReplyTo)
|
||||
{
|
||||
Q_UNUSED(data);
|
||||
if (inReplyTo == CONFIGURE_TYPE) {
|
||||
m_cmakeServer->sendRequest(COMPUTE_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1000);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1100;
|
||||
} else if (inReplyTo == COMPUTE_TYPE) {
|
||||
m_cmakeServer->sendRequest(CODEMODEL_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1100);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1200;
|
||||
} else if (inReplyTo == CODEMODEL_TYPE) {
|
||||
extractCodeModelData(data);
|
||||
m_cmakeServer->sendRequest(CMAKE_INPUTS_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1200);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1300;
|
||||
} else if (inReplyTo == CMAKE_INPUTS_TYPE) {
|
||||
extractCMakeInputsData(data);
|
||||
m_cmakeServer->sendRequest(CACHE_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1300);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1400;
|
||||
} else if (inReplyTo == CACHE_TYPE) {
|
||||
extractCacheData(data);
|
||||
if (m_future) {
|
||||
m_future->setProgressValue(MAX_PROGRESS);
|
||||
m_future->reportFinished();
|
||||
m_future.reset();
|
||||
if (!m_delayedErrorMessage.isEmpty()) {
|
||||
// Handle reply to cache after error:
|
||||
if (inReplyTo == CACHE_TYPE)
|
||||
extractCacheData(data);
|
||||
reportError();
|
||||
} else {
|
||||
// No error yet:
|
||||
if (inReplyTo == CONFIGURE_TYPE) {
|
||||
m_cmakeServer->sendRequest(COMPUTE_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1000);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1100;
|
||||
} else if (inReplyTo == COMPUTE_TYPE) {
|
||||
m_cmakeServer->sendRequest(CODEMODEL_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1100);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1200;
|
||||
} else if (inReplyTo == CODEMODEL_TYPE) {
|
||||
extractCodeModelData(data);
|
||||
m_cmakeServer->sendRequest(CMAKE_INPUTS_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1200);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
m_progressStepMaximum = 1300;
|
||||
} else if (inReplyTo == CMAKE_INPUTS_TYPE) {
|
||||
extractCMakeInputsData(data);
|
||||
m_cmakeServer->sendRequest(CACHE_TYPE);
|
||||
if (m_future)
|
||||
m_future->setProgressValue(1300);
|
||||
m_progressStepMinimum = m_progressStepMaximum;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,9 +440,17 @@ void ServerModeReader::handleError(const QString &message)
|
||||
{
|
||||
TaskHub::addTask(Task::Error, message, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
Utils::FileName(), -1);
|
||||
stop();
|
||||
Core::MessageManager::write(tr("CMake Project parsing failed."));
|
||||
emit errorOccured(message);
|
||||
if (!m_delayedErrorMessage.isEmpty()) {
|
||||
reportError();
|
||||
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)
|
||||
@@ -455,6 +471,18 @@ void ServerModeReader::handleSignal(const QString &signal, const QVariantMap &da
|
||||
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)
|
||||
{
|
||||
if (minRange == maxRange || min == max)
|
||||
|
||||
@@ -68,6 +68,8 @@ private:
|
||||
void handleProgress(int min, int cur, int max, const QString &inReplyTo);
|
||||
void handleSignal(const QString &signal, const QVariantMap &data);
|
||||
|
||||
void reportError();
|
||||
|
||||
int calculateProgress(const int minRange, const int min,
|
||||
const int cur,
|
||||
const int max, const int maxRange);
|
||||
@@ -166,6 +168,8 @@ private:
|
||||
int m_progressStepMinimum = 0;
|
||||
int m_progressStepMaximum = 1000;
|
||||
|
||||
QString m_delayedErrorMessage;
|
||||
|
||||
CMakeConfig m_cmakeConfiguration;
|
||||
|
||||
QSet<Utils::FileName> m_cmakeFiles;
|
||||
|
||||
@@ -271,7 +271,7 @@ void TeaLeafReader::generateProjectTree(CMakeProjectNode *root, const QList<cons
|
||||
|
||||
// Delete no longer necessary file watcher based on m_cmakeFiles:
|
||||
const QSet<FileName> currentWatched
|
||||
= transform(m_watchedFiles, [](CMakeFile *cmf) { return cmf->filePath(); });
|
||||
= transform(m_watchedFiles, &CMakeFile::filePath);
|
||||
const QSet<FileName> toWatch = m_cmakeFiles;
|
||||
QSet<FileName> toDelete = currentWatched;
|
||||
toDelete.subtract(toWatch);
|
||||
@@ -383,7 +383,7 @@ void TeaLeafReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
||||
|
||||
rpp.setMacros(cbt.macros);
|
||||
rpp.setDisplayName(cbt.title);
|
||||
rpp.setFiles(transform(cbt.files, [](const FileName &fn) { return fn.toString(); }));
|
||||
rpp.setFiles(transform(cbt.files, &FileName::toString));
|
||||
|
||||
const bool isExecutable = cbt.targetType == ExecutableType;
|
||||
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
|
||||
|
||||
Reference in New Issue
Block a user