Commit 43955ee5 authored by Erik Verbruggen's avatar Erik Verbruggen Committed by Nikolai Kosjar

AutotoolsProject: put different languages into separate project parts.

This is in preparation for changes to the ProjectParts, where one part
can only hold files for 1 language.

Change-Id: Ica05e5f7fcd35360400d299c39014c0a56d2889b
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent 30f8555a
......@@ -402,39 +402,29 @@ void AutotoolsProject::updateCppCodeModel()
{
CppTools::CppModelManagerInterface *modelManager =
CppTools::CppModelManagerInterface::instance();
if (!modelManager)
return;
m_codeModelFuture.cancel();
CppTools::ProjectInfo pInfo = modelManager->projectInfo(this);
pInfo.clearProjectParts();
CppTools::ProjectPartBuilder ppBuilder(pInfo);
const QStringList cflags = m_makefileParserThread->cflags();
QStringList cxxflags = m_makefileParserThread->cxxflags();
if (cxxflags.isEmpty())
cxxflags = cflags;
ppBuilder.setCFlags(cflags);
ppBuilder.setCxxFlags(cxxflags);
CppTools::ProjectInfo pinfo = modelManager->projectInfo(this);
pinfo.clearProjectParts();
CppTools::ProjectPart::Ptr part(new CppTools::ProjectPart);
part->project = this;
part->displayName = displayName();
part->projectFile = projectFilePath().toString();
if (activeTarget()) {
ProjectExplorer::Kit *k = activeTarget()->kit();
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
part->evaluateToolchain(tc, cxxflags, cflags,
SysRootKitInformation::sysRoot(k));
}
foreach (const QString &file, m_files)
part->files << CppTools::ProjectFile(file, CppTools::ProjectFile::CXXSource);
foreach (const QString &inc, m_makefileParserThread->includePaths()) {
part->headerPaths += CppTools::ProjectPart::HeaderPath(
inc, CppTools::ProjectPart::HeaderPath::IncludePath);
}
part->projectDefines += m_makefileParserThread->defines();
pinfo.appendProjectPart(part);
ppBuilder.setIncludePaths(m_makefileParserThread->includePaths());
ppBuilder.setDefines(m_makefileParserThread->defines());
modelManager->updateProjectInfo(pinfo);
const QList<Core::Id> languages = ppBuilder.createProjectPartsForFiles(m_files);
foreach (Core::Id language, languages)
setProjectLanguage(language, true);
setProjectLanguage(ProjectExplorer::Constants::LANG_CXX, !part->files.isEmpty());
m_codeModelFuture = modelManager->updateProjectInfo(pInfo);
}
......@@ -36,6 +36,8 @@
#include <utils/fileutils.h>
#include <QFuture>
QT_FORWARD_DECLARE_CLASS(QDir)
namespace Utils { class FileSystemWatcher; }
......@@ -156,6 +158,8 @@ private:
/// Responsible for parsing the makefiles asynchronously in a thread
MakefileParserThread *m_makefileParserThread;
QFuture<void> m_codeModelFuture;
};
} // namespace Internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment