forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.3'
Change-Id: I01d7d8aa282f2bca94f85f55c832c76672e229f7
This commit is contained in:
@@ -145,7 +145,7 @@ void CMakeBuildConfiguration::ctor()
|
||||
connect(m_buildDirManager.get(), &BuildDirManager::dataAvailable,
|
||||
this, [this, project]() {
|
||||
project->updateProjectData(this);
|
||||
emit enabledChanged();
|
||||
clearError();
|
||||
emit dataAvailable();
|
||||
});
|
||||
connect(m_buildDirManager.get(), &BuildDirManager::errorOccured,
|
||||
@@ -153,7 +153,7 @@ void CMakeBuildConfiguration::ctor()
|
||||
connect(m_buildDirManager.get(), &BuildDirManager::configurationStarted,
|
||||
this, [this, project]() {
|
||||
project->handleParsingStarted();
|
||||
emit enabledChanged();
|
||||
clearError(ForceEnabledChanged::True);
|
||||
emit parsingStarted();
|
||||
});
|
||||
|
||||
@@ -176,6 +176,7 @@ bool CMakeBuildConfiguration::isParsing() const
|
||||
|
||||
void CMakeBuildConfiguration::resetData()
|
||||
{
|
||||
clearError();
|
||||
m_buildDirManager->resetData();
|
||||
}
|
||||
|
||||
@@ -342,12 +343,14 @@ void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigMod
|
||||
m_buildDirManager->forceReparse();
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::clearError()
|
||||
void CMakeBuildConfiguration::clearError(ForceEnabledChanged fec)
|
||||
{
|
||||
if (!m_error.isEmpty()) {
|
||||
m_error.clear();
|
||||
emit enabledChanged();
|
||||
fec = ForceEnabledChanged::True;
|
||||
}
|
||||
if (fec == ForceEnabledChanged::True)
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::emitBuildTypeChanged()
|
||||
|
||||
@@ -109,10 +109,12 @@ protected:
|
||||
|
||||
private:
|
||||
void ctor();
|
||||
|
||||
enum ForceEnabledChanged : quint8 { False, True };
|
||||
void clearError(ForceEnabledChanged fec = ForceEnabledChanged::False);
|
||||
QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
|
||||
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
|
||||
|
||||
void clearError();
|
||||
void setError(const QString &message);
|
||||
void setWarning(const QString &message);
|
||||
|
||||
|
||||
@@ -172,6 +172,13 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
emit addTask(Task::buildConfigurationMissingTask());
|
||||
canInit = false;
|
||||
}
|
||||
if (!bc->isEnabled()) {
|
||||
emit addTask(Task(Task::Error,
|
||||
QCoreApplication::translate("CMakeProjectManager::CMakeBuildStep",
|
||||
"The build configuration is currently disabled."),
|
||||
Utils::FileName(), -1, ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
canInit = false;
|
||||
}
|
||||
|
||||
CMakeTool *tool = CMakeKitInformation::cmakeTool(target()->kit());
|
||||
if (!tool || !tool->isValid()) {
|
||||
@@ -185,7 +192,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
||||
}
|
||||
|
||||
CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
|
||||
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->title().isEmpty())) {
|
||||
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildSystemTarget().isEmpty())) {
|
||||
emit addTask(Task(Task::Error,
|
||||
QCoreApplication::translate("ProjectExplorer::Task",
|
||||
"You asked to build the current Run Configuration's build target only, "
|
||||
@@ -232,7 +239,7 @@ void CMakeBuildStep::run(QFutureInterface<bool> &fi)
|
||||
// Make sure CMake state was written to disk before trying to build:
|
||||
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
||||
if (!bc)
|
||||
bc = qobject_cast<CMakeBuildConfiguration *>(target()->activeBuildConfiguration());
|
||||
bc = targetsActiveBuildConfiguration();
|
||||
QTC_ASSERT(bc, return);
|
||||
|
||||
bool mustDelay = false;
|
||||
@@ -348,7 +355,7 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
|
||||
|
||||
if (isCurrentExecutableTarget(m_buildTarget)) {
|
||||
if (rc)
|
||||
target = rc->title();
|
||||
target = rc->buildSystemTarget();
|
||||
else
|
||||
target = QLatin1String("<i><") + tr(ADD_RUNCONFIGURATION_TEXT) + QLatin1String("></i>");
|
||||
} else {
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <projectexplorer/taskhub.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/asconst.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
|
||||
@@ -294,7 +295,7 @@ void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
|
||||
void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
||||
{
|
||||
int counter = 0;
|
||||
foreach (const FileGroup *fg, m_fileGroups) {
|
||||
for (const FileGroup *fg : Utils::asConst(m_fileGroups)) {
|
||||
++counter;
|
||||
const QString defineArg
|
||||
= transform(fg->defines, [](const QString &s) -> QString {
|
||||
@@ -469,6 +470,8 @@ ServerModeReader::Target *ServerModeReader::extractTargetData(const QVariantMap
|
||||
target->fileGroups.append(extractFileGroupData(fgData, srcDir, target));
|
||||
}
|
||||
|
||||
fixTarget(target);
|
||||
|
||||
m_targets.append(target);
|
||||
return target;
|
||||
}
|
||||
@@ -547,6 +550,49 @@ void ServerModeReader::extractCacheData(const QVariantMap &data)
|
||||
m_cmakeCache = config;
|
||||
}
|
||||
|
||||
void ServerModeReader::fixTarget(ServerModeReader::Target *target) const
|
||||
{
|
||||
QHash<QString, const FileGroup *> languageFallbacks;
|
||||
|
||||
for (const FileGroup *group : Utils::asConst(target->fileGroups)) {
|
||||
if (group->includePaths.isEmpty() && group->compileFlags.isEmpty()
|
||||
&& group->defines.isEmpty())
|
||||
continue;
|
||||
|
||||
const FileGroup *fallback = languageFallbacks.value(group->language);
|
||||
if (!fallback || fallback->sources.count() < group->sources.count())
|
||||
languageFallbacks.insert(group->language, group);
|
||||
}
|
||||
|
||||
if (!languageFallbacks.value(""))
|
||||
return; // No empty language groups found, no need to proceed.
|
||||
|
||||
const FileGroup *fallback = languageFallbacks.value("CXX");
|
||||
if (!fallback)
|
||||
fallback = languageFallbacks.value("C");
|
||||
if (!fallback)
|
||||
fallback = languageFallbacks.value("");
|
||||
|
||||
if (!fallback)
|
||||
return;
|
||||
|
||||
for (auto it = target->fileGroups.begin(); it != target->fileGroups.end(); ++it) {
|
||||
if (!(*it)->language.isEmpty())
|
||||
continue;
|
||||
(*it)->language = fallback->language.isEmpty() ? "CXX" : fallback->language;
|
||||
|
||||
if (*it == fallback
|
||||
|| !(*it)->includePaths.isEmpty() || !(*it)->defines.isEmpty()
|
||||
|| !(*it)->compileFlags.isEmpty())
|
||||
continue;
|
||||
|
||||
for (const IncludePath *ip : fallback->includePaths)
|
||||
(*it)->includePaths.append(new IncludePath(*ip));
|
||||
(*it)->defines = fallback->defines;
|
||||
(*it)->compileFlags = fallback->compileFlags;
|
||||
}
|
||||
}
|
||||
|
||||
QHash<Utils::FileName, ProjectNode *>
|
||||
ServerModeReader::addCMakeLists(CMakeProjectNode *root, const QList<FileNode *> &cmakeLists)
|
||||
{
|
||||
|
||||
@@ -113,6 +113,8 @@ private:
|
||||
void extractCMakeInputsData(const QVariantMap &data);
|
||||
void extractCacheData(const QVariantMap &data);
|
||||
|
||||
void fixTarget(Target *target) const;
|
||||
|
||||
QHash<Utils::FileName, ProjectExplorer::ProjectNode *>
|
||||
addCMakeLists(CMakeProjectNode *root, const QList<ProjectExplorer::FileNode *> &cmakeLists);
|
||||
void addProjects(const QHash<Utils::FileName, ProjectExplorer::ProjectNode *> &cmakeListsNodes,
|
||||
|
||||
Reference in New Issue
Block a user