forked from qt-creator/qt-creator
ProjectExplorer: Use a Kit to initialize KitInfo
Change-Id: I70a83ff9a9da814b4e1ad9ce5e0b626105c09ca4 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -175,7 +175,7 @@ static QStringList filterIncludes(const QString &absSrc, const QString &absBuild
|
|||||||
|
|
||||||
void AutotoolsBuildSystem::updateCppCodeModel()
|
void AutotoolsBuildSystem::updateCppCodeModel()
|
||||||
{
|
{
|
||||||
QtSupport::CppKitInfo kitInfo(project());
|
QtSupport::CppKitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return );
|
QTC_ASSERT(kitInfo.isValid(), return );
|
||||||
|
|
||||||
const Utils::FilePath projectFilePath = project()->projectFilePath();
|
const Utils::FilePath projectFilePath = project()->projectFilePath();
|
||||||
|
@@ -441,7 +441,7 @@ void CMakeBuildSystem::updateProjectData()
|
|||||||
qCDebug(cmakeBuildSystemLog) << "Extra compilers updated.";
|
qCDebug(cmakeBuildSystemLog) << "Extra compilers updated.";
|
||||||
}
|
}
|
||||||
|
|
||||||
QtSupport::CppKitInfo kitInfo(p);
|
QtSupport::CppKitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return );
|
QTC_ASSERT(kitInfo.isValid(), return );
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@@ -376,7 +376,7 @@ void CompilationDatabaseBuildSystem::triggerParsing()
|
|||||||
|
|
||||||
void CompilationDatabaseBuildSystem::buildTreeAndProjectParts()
|
void CompilationDatabaseBuildSystem::buildTreeAndProjectParts()
|
||||||
{
|
{
|
||||||
ProjectExplorer::KitInfo kitInfo(project());
|
ProjectExplorer::KitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return);
|
QTC_ASSERT(kitInfo.isValid(), return);
|
||||||
// Reset toolchains to pick them based on the database entries.
|
// Reset toolchains to pick them based on the database entries.
|
||||||
kitInfo.cToolChain = nullptr;
|
kitInfo.cToolChain = nullptr;
|
||||||
|
@@ -551,7 +551,7 @@ void GenericBuildSystem::refreshCppCodeModel()
|
|||||||
{
|
{
|
||||||
if (!m_cppCodeModelUpdater)
|
if (!m_cppCodeModelUpdater)
|
||||||
return;
|
return;
|
||||||
QtSupport::CppKitInfo kitInfo(project());
|
QtSupport::CppKitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return);
|
QTC_ASSERT(kitInfo.isValid(), return);
|
||||||
|
|
||||||
RawProjectPart rpp;
|
RawProjectPart rpp;
|
||||||
|
@@ -90,6 +90,11 @@ Target *BuildSystem::target() const
|
|||||||
return d->m_target;
|
return d->m_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Kit *BuildSystem::kit() const
|
||||||
|
{
|
||||||
|
return d->m_target->kit();
|
||||||
|
}
|
||||||
|
|
||||||
void BuildSystem::emitParsingStarted()
|
void BuildSystem::emitParsingStarted()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!d->m_isParsing, return);
|
QTC_ASSERT(!d->m_isParsing, return);
|
||||||
|
@@ -53,6 +53,7 @@ public:
|
|||||||
|
|
||||||
Project *project() const;
|
Project *project() const;
|
||||||
Target *target() const;
|
Target *target() const;
|
||||||
|
Kit *kit() const;
|
||||||
|
|
||||||
Utils::FilePath projectFilePath() const;
|
Utils::FilePath projectFilePath() const;
|
||||||
Utils::FilePath projectDirectory() const;
|
Utils::FilePath projectDirectory() const;
|
||||||
|
@@ -150,14 +150,9 @@ void RawProjectPart::setBuildTargetType(BuildTargetType type)
|
|||||||
buildTargetType = type;
|
buildTargetType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
KitInfo::KitInfo(Project *project)
|
KitInfo::KitInfo(Kit *kit)
|
||||||
|
: kit(kit)
|
||||||
{
|
{
|
||||||
// Kit
|
|
||||||
if (Target *target = project->activeTarget())
|
|
||||||
kit = target->kit();
|
|
||||||
else
|
|
||||||
kit = KitManager::defaultKit();
|
|
||||||
|
|
||||||
// Toolchains
|
// Toolchains
|
||||||
if (kit) {
|
if (kit) {
|
||||||
cToolChain = ToolChainKitAspect::toolChain(kit, Constants::C_LANGUAGE_ID);
|
cToolChain = ToolChainKitAspect::toolChain(kit, Constants::C_LANGUAGE_ID);
|
||||||
|
@@ -125,7 +125,7 @@ using RawProjectParts = QVector<RawProjectPart>;
|
|||||||
class PROJECTEXPLORER_EXPORT KitInfo
|
class PROJECTEXPLORER_EXPORT KitInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit KitInfo(Project *project);
|
explicit KitInfo(Kit *kit);
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
|
@@ -1012,7 +1012,7 @@ void QbsBuildSystem::updateCppCodeModel()
|
|||||||
qDeleteAll(m_extraCompilers);
|
qDeleteAll(m_extraCompilers);
|
||||||
m_extraCompilers.clear();
|
m_extraCompilers.clear();
|
||||||
|
|
||||||
QtSupport::CppKitInfo kitInfo(project());
|
QtSupport::CppKitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return);
|
QTC_ASSERT(kitInfo.isValid(), return);
|
||||||
|
|
||||||
RawProjectParts rpps;
|
RawProjectParts rpps;
|
||||||
|
@@ -244,7 +244,7 @@ void QmakeBuildSystem::updateCppCodeModel()
|
|||||||
{
|
{
|
||||||
m_toolChainWarnings.clear();
|
m_toolChainWarnings.clear();
|
||||||
|
|
||||||
QtSupport::CppKitInfo kitInfo(project());
|
QtSupport::CppKitInfo kitInfo(kit());
|
||||||
QTC_ASSERT(kitInfo.isValid(), return);
|
QTC_ASSERT(kitInfo.isValid(), return);
|
||||||
|
|
||||||
QList<ProjectExplorer::ExtraCompiler *> generators;
|
QList<ProjectExplorer::ExtraCompiler *> generators;
|
||||||
|
@@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
|
|
||||||
CppKitInfo::CppKitInfo(ProjectExplorer::Project *project)
|
CppKitInfo::CppKitInfo(ProjectExplorer::Kit *kit)
|
||||||
: ProjectExplorer::KitInfo(project)
|
: ProjectExplorer::KitInfo(kit)
|
||||||
{
|
{
|
||||||
if (kit && (qtVersion = QtKitAspect::qtVersion(kit))) {
|
if (kit && (qtVersion = QtKitAspect::qtVersion(kit))) {
|
||||||
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0))
|
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5, 0, 0))
|
||||||
|
@@ -36,7 +36,7 @@ class BaseQtVersion;
|
|||||||
class QTSUPPORT_EXPORT CppKitInfo : public ProjectExplorer::KitInfo
|
class QTSUPPORT_EXPORT CppKitInfo : public ProjectExplorer::KitInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CppKitInfo(ProjectExplorer::Project *project);
|
CppKitInfo(ProjectExplorer::Kit *kit);
|
||||||
|
|
||||||
BaseQtVersion *qtVersion = nullptr;
|
BaseQtVersion *qtVersion = nullptr;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user