forked from qt-creator/qt-creator
CppTools: Move ProjectUpdateInfo to ProjectExplorer
Used for updating project parts, so move it near RawProjectPart. Change-Id: I77aeffbdbfb3d2ec0de600f61dcf7fbb7a355a98 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -29,7 +29,6 @@
|
|||||||
#include "compilationdbparser.h"
|
#include "compilationdbparser.h"
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <cpptools/cppkitinfo.h>
|
|
||||||
#include <cpptools/cppprojectupdater.h>
|
#include <cpptools/cppprojectupdater.h>
|
||||||
#include <cpptools/projectinfo.h>
|
#include <cpptools/projectinfo.h>
|
||||||
#include <projectexplorer/buildinfo.h>
|
#include <projectexplorer/buildinfo.h>
|
||||||
@@ -170,7 +169,7 @@ void addDriverModeFlagIfNeeded(const ToolChain *toolchain,
|
|||||||
|
|
||||||
RawProjectPart makeRawProjectPart(const Utils::FilePath &projectFile,
|
RawProjectPart makeRawProjectPart(const Utils::FilePath &projectFile,
|
||||||
Kit *kit,
|
Kit *kit,
|
||||||
CppTools::KitInfo &kitInfo,
|
ProjectExplorer::KitInfo &kitInfo,
|
||||||
const QString &workingDir,
|
const QString &workingDir,
|
||||||
const Utils::FilePath &fileName,
|
const Utils::FilePath &fileName,
|
||||||
QStringList flags)
|
QStringList flags)
|
||||||
@@ -338,7 +337,7 @@ void createTree(std::unique_ptr<ProjectNode> &root,
|
|||||||
|
|
||||||
void CompilationDatabaseProject::buildTreeAndProjectParts()
|
void CompilationDatabaseProject::buildTreeAndProjectParts()
|
||||||
{
|
{
|
||||||
CppTools::KitInfo kitInfo(this);
|
ProjectExplorer::KitInfo kitInfo(this);
|
||||||
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;
|
||||||
|
@@ -48,7 +48,6 @@ add_qtc_plugin(CppTools
|
|||||||
cpphoverhandler.cpp cpphoverhandler.h
|
cpphoverhandler.cpp cpphoverhandler.h
|
||||||
cppincludesfilter.cpp cppincludesfilter.h
|
cppincludesfilter.cpp cppincludesfilter.h
|
||||||
cppindexingsupport.cpp cppindexingsupport.h
|
cppindexingsupport.cpp cppindexingsupport.h
|
||||||
cppkitinfo.cpp cppkitinfo.h
|
|
||||||
cpplocalsymbols.cpp cpplocalsymbols.h
|
cpplocalsymbols.cpp cpplocalsymbols.h
|
||||||
cpplocatordata.cpp cpplocatordata.h
|
cpplocatordata.cpp cpplocatordata.h
|
||||||
cpplocatorfilter.cpp cpplocatorfilter.h
|
cpplocatorfilter.cpp cpplocatorfilter.h
|
||||||
|
@@ -1,64 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2019 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "cppkitinfo.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/kit.h>
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
|
||||||
#include <projectexplorer/kitmanager.h>
|
|
||||||
#include <projectexplorer/project.h>
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
|
||||||
#include <projectexplorer/target.h>
|
|
||||||
|
|
||||||
#include <qtsupport/qtkitinformation.h>
|
|
||||||
|
|
||||||
namespace CppTools {
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
|
||||||
|
|
||||||
KitInfo::KitInfo(Project *project)
|
|
||||||
{
|
|
||||||
// Kit
|
|
||||||
if (Target *target = project->activeTarget())
|
|
||||||
kit = target->kit();
|
|
||||||
else
|
|
||||||
kit = KitManager::defaultKit();
|
|
||||||
|
|
||||||
// Toolchains
|
|
||||||
if (kit) {
|
|
||||||
cToolChain = ToolChainKitAspect::toolChain(kit, Constants::C_LANGUAGE_ID);
|
|
||||||
cxxToolChain = ToolChainKitAspect::toolChain(kit, Constants::CXX_LANGUAGE_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sysroot
|
|
||||||
sysRootPath = ProjectExplorer::SysRootKitAspect::sysRoot(kit).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KitInfo::isValid() const
|
|
||||||
{
|
|
||||||
return kit;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CppTools
|
|
@@ -1,56 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2019 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <projectexplorer/rawprojectpart.h>
|
|
||||||
|
|
||||||
#include "cpptools_global.h"
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class Kit;
|
|
||||||
class Project;
|
|
||||||
class ToolChain;
|
|
||||||
} // namespace ProjectExplorer
|
|
||||||
|
|
||||||
namespace CppTools {
|
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT KitInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit KitInfo(ProjectExplorer::Project *project);
|
|
||||||
|
|
||||||
bool isValid() const;
|
|
||||||
|
|
||||||
ProjectExplorer::Kit *kit = nullptr;
|
|
||||||
ProjectExplorer::ToolChain *cToolChain = nullptr;
|
|
||||||
ProjectExplorer::ToolChain *cxxToolChain = nullptr;
|
|
||||||
|
|
||||||
Utils::QtVersion projectPartQtVersion = Utils::QtVersion::None;
|
|
||||||
|
|
||||||
QString sysRootPath;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace CppTools
|
|
@@ -35,8 +35,9 @@
|
|||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ProjectInfoGenerator::ProjectInfoGenerator(const QFutureInterface<void> &futureInterface,
|
ProjectInfoGenerator::ProjectInfoGenerator(
|
||||||
const ProjectUpdateInfo &projectUpdateInfo)
|
const QFutureInterface<void> &futureInterface,
|
||||||
|
const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo)
|
||||||
: m_futureInterface(futureInterface)
|
: m_futureInterface(futureInterface)
|
||||||
, m_projectUpdateInfo(projectUpdateInfo)
|
, m_projectUpdateInfo(projectUpdateInfo)
|
||||||
{
|
{
|
||||||
@@ -147,7 +148,7 @@ ProjectPart::Ptr ProjectInfoGenerator::createProjectPart(
|
|||||||
Utils::LanguageExtensions languageExtensions)
|
Utils::LanguageExtensions languageExtensions)
|
||||||
{
|
{
|
||||||
ProjectExplorer::RawProjectPartFlags flags;
|
ProjectExplorer::RawProjectPartFlags flags;
|
||||||
ToolChainInfo tcInfo;
|
ProjectExplorer::ToolChainInfo tcInfo;
|
||||||
if (language == Language::C) {
|
if (language == Language::C) {
|
||||||
flags = rawProjectPart.flagsForC;
|
flags = rawProjectPart.flagsForC;
|
||||||
tcInfo = m_projectUpdateInfo.cToolChainInfo;
|
tcInfo = m_projectUpdateInfo.cToolChainInfo;
|
||||||
|
@@ -37,7 +37,7 @@ class ProjectInfoGenerator
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProjectInfoGenerator(const QFutureInterface<void> &futureInterface,
|
ProjectInfoGenerator(const QFutureInterface<void> &futureInterface,
|
||||||
const ProjectUpdateInfo &projectUpdateInfo);
|
const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo);
|
||||||
|
|
||||||
ProjectInfo generate();
|
ProjectInfo generate();
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const QFutureInterface<void> m_futureInterface;
|
const QFutureInterface<void> m_futureInterface;
|
||||||
const ProjectUpdateInfo &m_projectUpdateInfo;
|
const ProjectExplorer::ProjectUpdateInfo &m_projectUpdateInfo;
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
@@ -46,7 +46,7 @@ CppProjectUpdater::~CppProjectUpdater()
|
|||||||
cancelAndWaitForFinished();
|
cancelAndWaitForFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppProjectUpdater::update(const ProjectUpdateInfo &projectUpdateInfo)
|
void CppProjectUpdater::update(const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo)
|
||||||
{
|
{
|
||||||
// Stop previous update.
|
// Stop previous update.
|
||||||
cancelAndWaitForFinished();
|
cancelAndWaitForFinished();
|
||||||
|
@@ -34,7 +34,6 @@
|
|||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
class ProjectInfo;
|
class ProjectInfo;
|
||||||
class ProjectUpdateInfo;
|
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT CppProjectUpdater : public QObject
|
class CPPTOOLS_EXPORT CppProjectUpdater : public QObject
|
||||||
{
|
{
|
||||||
@@ -44,7 +43,7 @@ public:
|
|||||||
CppProjectUpdater();
|
CppProjectUpdater();
|
||||||
~CppProjectUpdater() override;
|
~CppProjectUpdater() override;
|
||||||
|
|
||||||
void update(const ProjectUpdateInfo &projectUpdateInfo);
|
void update(const ProjectExplorer::ProjectUpdateInfo &projectUpdateInfo);
|
||||||
void cancel();
|
void cancel();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -54,7 +53,7 @@ private:
|
|||||||
void onProjectInfoGenerated();
|
void onProjectInfoGenerated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectUpdateInfo m_projectUpdateInfo;
|
ProjectExplorer::ProjectUpdateInfo m_projectUpdateInfo;
|
||||||
|
|
||||||
QFutureInterface<void> m_futureInterface;
|
QFutureInterface<void> m_futureInterface;
|
||||||
QFutureWatcher<ProjectInfo> m_generateFutureWatcher;
|
QFutureWatcher<ProjectInfo> m_generateFutureWatcher;
|
||||||
|
@@ -103,7 +103,6 @@ HEADERS += \
|
|||||||
cppmodelmanagerinterface.h \
|
cppmodelmanagerinterface.h \
|
||||||
cppbuiltinmodelmanagersupport.h \
|
cppbuiltinmodelmanagersupport.h \
|
||||||
headerpathfilter.h \
|
headerpathfilter.h \
|
||||||
cppkitinfo.h \
|
|
||||||
cpptools_clazychecks.h
|
cpptools_clazychecks.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
@@ -190,8 +189,7 @@ SOURCES += \
|
|||||||
cppprojectpartchooser.cpp \
|
cppprojectpartchooser.cpp \
|
||||||
wrappablelineedit.cpp \
|
wrappablelineedit.cpp \
|
||||||
cppbuiltinmodelmanagersupport.cpp \
|
cppbuiltinmodelmanagersupport.cpp \
|
||||||
headerpathfilter.cpp \
|
headerpathfilter.cpp
|
||||||
cppkitinfo.cpp
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
clangdiagnosticconfigswidget.ui \
|
clangdiagnosticconfigswidget.ui \
|
||||||
|
@@ -116,8 +116,6 @@ Project {
|
|||||||
"cppincludesfilter.h",
|
"cppincludesfilter.h",
|
||||||
"cppindexingsupport.cpp",
|
"cppindexingsupport.cpp",
|
||||||
"cppindexingsupport.h",
|
"cppindexingsupport.h",
|
||||||
"cppkitinfo.cpp",
|
|
||||||
"cppkitinfo.h",
|
|
||||||
"cpplocalsymbols.cpp",
|
"cpplocalsymbols.cpp",
|
||||||
"cpplocalsymbols.h",
|
"cpplocalsymbols.h",
|
||||||
"cpplocatordata.cpp",
|
"cpplocatordata.cpp",
|
||||||
|
@@ -25,48 +25,14 @@
|
|||||||
|
|
||||||
#include "projectinfo.h"
|
#include "projectinfo.h"
|
||||||
|
|
||||||
#include "cppkitinfo.h"
|
|
||||||
|
|
||||||
#include <projectexplorer/abi.h>
|
#include <projectexplorer/abi.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/rawprojectpart.h>
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
ToolChainInfo::ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
|
||||||
const QString &sysRootPath, const Utils::Environment &env)
|
|
||||||
{
|
|
||||||
if (toolChain) {
|
|
||||||
// Keep the following cheap/non-blocking for the ui thread...
|
|
||||||
type = toolChain->typeId();
|
|
||||||
isMsvc2015ToolChain
|
|
||||||
= toolChain->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMsvc2015Flavor;
|
|
||||||
wordWidth = toolChain->targetAbi().wordWidth();
|
|
||||||
targetTriple = toolChain->originalTargetTriple();
|
|
||||||
extraCodeModelFlags = toolChain->extraCodeModelFlags();
|
|
||||||
|
|
||||||
// ...and save the potentially expensive operations for later so that
|
|
||||||
// they can be run from a worker thread.
|
|
||||||
this->sysRootPath = sysRootPath;
|
|
||||||
headerPathsRunner = toolChain->createBuiltInHeaderPathsRunner(env);
|
|
||||||
macroInspectionRunner = toolChain->createMacroInspectionRunner();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectUpdateInfo::ProjectUpdateInfo(ProjectExplorer::Project *project,
|
|
||||||
const KitInfo &kitInfo,
|
|
||||||
const Utils::Environment &env,
|
|
||||||
const ProjectExplorer::RawProjectParts &rawProjectParts)
|
|
||||||
: project(project)
|
|
||||||
, rawProjectParts(rawProjectParts)
|
|
||||||
, cToolChain(kitInfo.cToolChain)
|
|
||||||
, cxxToolChain(kitInfo.cxxToolChain)
|
|
||||||
, cToolChainInfo(ToolChainInfo(cToolChain, kitInfo.sysRootPath, env))
|
|
||||||
, cxxToolChainInfo(ToolChainInfo(cxxToolChain, kitInfo.sysRootPath, env))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectInfo::ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
ProjectInfo::ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
||||||
: m_project(project)
|
: m_project(project)
|
||||||
{
|
{
|
||||||
|
@@ -40,50 +40,6 @@
|
|||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
|
|
||||||
class KitInfo;
|
|
||||||
|
|
||||||
class ToolChainInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ToolChainInfo() = default;
|
|
||||||
ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
|
||||||
const QString &sysRootPath, const Utils::Environment &env);
|
|
||||||
|
|
||||||
bool isValid() const { return type.isValid(); }
|
|
||||||
|
|
||||||
public:
|
|
||||||
Core::Id type;
|
|
||||||
bool isMsvc2015ToolChain = false;
|
|
||||||
unsigned wordWidth = 0;
|
|
||||||
QString targetTriple;
|
|
||||||
QStringList extraCodeModelFlags;
|
|
||||||
|
|
||||||
QString sysRootPath; // For headerPathsRunner.
|
|
||||||
ProjectExplorer::ToolChain::BuiltInHeaderPathsRunner headerPathsRunner;
|
|
||||||
ProjectExplorer::ToolChain::MacroInspectionRunner macroInspectionRunner;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT ProjectUpdateInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProjectUpdateInfo() = default;
|
|
||||||
ProjectUpdateInfo(ProjectExplorer::Project *project,
|
|
||||||
const KitInfo &kitInfo,
|
|
||||||
const Utils::Environment &env,
|
|
||||||
const ProjectExplorer::RawProjectParts &rawProjectParts);
|
|
||||||
bool isValid() const { return project && !rawProjectParts.isEmpty(); }
|
|
||||||
|
|
||||||
public:
|
|
||||||
QPointer<ProjectExplorer::Project> project;
|
|
||||||
ProjectExplorer::RawProjectParts rawProjectParts;
|
|
||||||
|
|
||||||
const ProjectExplorer::ToolChain *cToolChain = nullptr;
|
|
||||||
const ProjectExplorer::ToolChain *cxxToolChain = nullptr;
|
|
||||||
|
|
||||||
ToolChainInfo cToolChainInfo;
|
|
||||||
ToolChainInfo cxxToolChainInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CPPTOOLS_EXPORT ProjectInfo
|
class CPPTOOLS_EXPORT ProjectInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -27,7 +27,9 @@
|
|||||||
|
|
||||||
#include "abi.h"
|
#include "abi.h"
|
||||||
#include "kitinformation.h"
|
#include "kitinformation.h"
|
||||||
|
#include "project.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
|
#include "target.h"
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
@@ -148,4 +150,64 @@ void RawProjectPart::setBuildTargetType(BuildTargetType type)
|
|||||||
buildTargetType = type;
|
buildTargetType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KitInfo::KitInfo(Project *project)
|
||||||
|
{
|
||||||
|
// Kit
|
||||||
|
if (Target *target = project->activeTarget())
|
||||||
|
kit = target->kit();
|
||||||
|
else
|
||||||
|
kit = KitManager::defaultKit();
|
||||||
|
|
||||||
|
// Toolchains
|
||||||
|
if (kit) {
|
||||||
|
cToolChain = ToolChainKitAspect::toolChain(kit, Constants::C_LANGUAGE_ID);
|
||||||
|
cxxToolChain = ToolChainKitAspect::toolChain(kit, Constants::CXX_LANGUAGE_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sysroot
|
||||||
|
sysRootPath = SysRootKitAspect::sysRoot(kit).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KitInfo::isValid() const
|
||||||
|
{
|
||||||
|
return kit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolChainInfo::ToolChainInfo(const ToolChain *toolChain,
|
||||||
|
const QString &sysRootPath,
|
||||||
|
const Utils::Environment &env)
|
||||||
|
{
|
||||||
|
if (toolChain) {
|
||||||
|
// Keep the following cheap/non-blocking for the ui thread...
|
||||||
|
type = toolChain->typeId();
|
||||||
|
isMsvc2015ToolChain = toolChain->targetAbi().osFlavor() == Abi::WindowsMsvc2015Flavor;
|
||||||
|
wordWidth = toolChain->targetAbi().wordWidth();
|
||||||
|
targetTriple = toolChain->originalTargetTriple();
|
||||||
|
extraCodeModelFlags = toolChain->extraCodeModelFlags();
|
||||||
|
|
||||||
|
// ...and save the potentially expensive operations for later so that
|
||||||
|
// they can be run from a worker thread.
|
||||||
|
this->sysRootPath = sysRootPath;
|
||||||
|
headerPathsRunner = toolChain->createBuiltInHeaderPathsRunner(env);
|
||||||
|
macroInspectionRunner = toolChain->createMacroInspectionRunner();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectUpdateInfo::ProjectUpdateInfo(Project *project,
|
||||||
|
const KitInfo &kitInfo,
|
||||||
|
const Utils::Environment &env,
|
||||||
|
const RawProjectParts &rawProjectParts)
|
||||||
|
: project(project)
|
||||||
|
, rawProjectParts(rawProjectParts)
|
||||||
|
, cToolChain(kitInfo.cToolChain)
|
||||||
|
, cxxToolChain(kitInfo.cxxToolChain)
|
||||||
|
, cToolChainInfo(ToolChainInfo(cToolChain, kitInfo.sysRootPath, env))
|
||||||
|
, cxxToolChainInfo(ToolChainInfo(cxxToolChain, kitInfo.sysRootPath, env))
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool ProjectUpdateInfo::isValid() const
|
||||||
|
{
|
||||||
|
return project && !rawProjectParts.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -31,13 +31,20 @@
|
|||||||
#include "projectexplorer_global.h"
|
#include "projectexplorer_global.h"
|
||||||
#include "projectmacro.h"
|
#include "projectmacro.h"
|
||||||
|
|
||||||
|
// this include style is forced for the cpp unit test mocks
|
||||||
|
#include <projectexplorer/toolchain.h>
|
||||||
|
|
||||||
#include <utils/cpplanguage_details.h>
|
#include <utils/cpplanguage_details.h>
|
||||||
|
#include <utils/environment.h>
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class ToolChain;
|
class Kit;
|
||||||
|
class Project;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT RawProjectPartFlags
|
class PROJECTEXPLORER_EXPORT RawProjectPartFlags
|
||||||
{
|
{
|
||||||
@@ -114,4 +121,63 @@ public:
|
|||||||
|
|
||||||
using RawProjectParts = QVector<RawProjectPart>;
|
using RawProjectParts = QVector<RawProjectPart>;
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT KitInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit KitInfo(Project *project);
|
||||||
|
|
||||||
|
bool isValid() const;
|
||||||
|
|
||||||
|
Kit *kit = nullptr;
|
||||||
|
ToolChain *cToolChain = nullptr;
|
||||||
|
ToolChain *cxxToolChain = nullptr;
|
||||||
|
|
||||||
|
Utils::QtVersion projectPartQtVersion = Utils::QtVersion::None;
|
||||||
|
|
||||||
|
QString sysRootPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT ToolChainInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ToolChainInfo() = default;
|
||||||
|
ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
||||||
|
const QString &sysRootPath,
|
||||||
|
const Utils::Environment &env);
|
||||||
|
|
||||||
|
bool isValid() const { return type.isValid(); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
Core::Id type;
|
||||||
|
bool isMsvc2015ToolChain = false;
|
||||||
|
unsigned wordWidth = 0;
|
||||||
|
QString targetTriple;
|
||||||
|
QStringList extraCodeModelFlags;
|
||||||
|
|
||||||
|
QString sysRootPath; // For headerPathsRunner.
|
||||||
|
ProjectExplorer::ToolChain::BuiltInHeaderPathsRunner headerPathsRunner;
|
||||||
|
ProjectExplorer::ToolChain::MacroInspectionRunner macroInspectionRunner;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PROJECTEXPLORER_EXPORT ProjectUpdateInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ProjectUpdateInfo() = default;
|
||||||
|
ProjectUpdateInfo(Project *project,
|
||||||
|
const KitInfo &kitInfo,
|
||||||
|
const Utils::Environment &env,
|
||||||
|
const RawProjectParts &rawProjectParts);
|
||||||
|
bool isValid() const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
QPointer<Project> project;
|
||||||
|
RawProjectParts rawProjectParts;
|
||||||
|
|
||||||
|
const ToolChain *cToolChain = nullptr;
|
||||||
|
const ToolChain *cxxToolChain = nullptr;
|
||||||
|
|
||||||
|
ToolChainInfo cToolChainInfo;
|
||||||
|
ToolChainInfo cxxToolChainInfo;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -30,10 +30,8 @@
|
|||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
|
|
||||||
using namespace CppTools;
|
|
||||||
|
|
||||||
CppKitInfo::CppKitInfo(ProjectExplorer::Project *project)
|
CppKitInfo::CppKitInfo(ProjectExplorer::Project *project)
|
||||||
: KitInfo(project)
|
: ProjectExplorer::KitInfo(project)
|
||||||
{
|
{
|
||||||
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))
|
||||||
|
@@ -27,13 +27,13 @@
|
|||||||
|
|
||||||
#include "qtsupport_global.h"
|
#include "qtsupport_global.h"
|
||||||
|
|
||||||
#include <cpptools/cppkitinfo.h>
|
#include <projectexplorer/rawprojectpart.h>
|
||||||
|
|
||||||
namespace QtSupport {
|
namespace QtSupport {
|
||||||
|
|
||||||
class BaseQtVersion;
|
class BaseQtVersion;
|
||||||
|
|
||||||
class QTSUPPORT_EXPORT CppKitInfo : public CppTools::KitInfo
|
class QTSUPPORT_EXPORT CppKitInfo : public ProjectExplorer::KitInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CppKitInfo(ProjectExplorer::Project *project);
|
CppKitInfo(ProjectExplorer::Project *project);
|
||||||
|
@@ -35,10 +35,10 @@
|
|||||||
using CppTools::Internal::ProjectInfoGenerator;
|
using CppTools::Internal::ProjectInfoGenerator;
|
||||||
using CppTools::ProjectFile;
|
using CppTools::ProjectFile;
|
||||||
using CppTools::ProjectInfo;
|
using CppTools::ProjectInfo;
|
||||||
using CppTools::ProjectUpdateInfo;
|
|
||||||
using CppTools::ProjectPart;
|
using CppTools::ProjectPart;
|
||||||
|
|
||||||
using ProjectExplorer::Macros;
|
using ProjectExplorer::Macros;
|
||||||
|
using ProjectExplorer::ProjectUpdateInfo;
|
||||||
using ProjectExplorer::RawProjectPart;
|
using ProjectExplorer::RawProjectPart;
|
||||||
using ProjectExplorer::ToolChain;
|
using ProjectExplorer::ToolChain;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user