forked from qt-creator/qt-creator
Merge CppTools into CppEditor
There was no proper separation of responsibilities between these plugins. In particular, CppTools had lots of editor-related functionality, so it's not clear why it was separated out in the first place. In fact, for a lot of code, it seemed quite arbitrary where it was put (just one example: switchHeaderSource() was in CppTools, wheras switchDeclarationDefinition() was in CppEditor). Merging the plugins will enable us to get rid of various convoluted pseudo-abstractions that were only introduced to keep up the artificial separation. Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
add_qtc_plugin(AutoTest
|
||||
PLUGIN_DEPENDS Core CppTools Debugger ProjectExplorer QmlJSTools TextEditor
|
||||
PLUGIN_DEPENDS Core CppEditor Debugger ProjectExplorer QmlJSTools TextEditor
|
||||
PLUGIN_TEST_DEPENDS QmakeProjectManager QtSupport QbsProjectManager
|
||||
SOURCES
|
||||
autotest.qrc
|
||||
|
||||
@@ -4,7 +4,7 @@ QtcPlugin {
|
||||
name: "AutoTest"
|
||||
|
||||
Depends { name: "Core" }
|
||||
Depends { name: "CppTools" }
|
||||
Depends { name: "CppEditor" }
|
||||
Depends { name: "CPlusPlus" }
|
||||
Depends { name: "ProjectExplorer" }
|
||||
Depends { name: "QmlJS" }
|
||||
|
||||
@@ -3,7 +3,7 @@ QTC_PLUGIN_NAME = AutoTest
|
||||
QTC_PLUGIN_DEPENDS += \
|
||||
coreplugin \
|
||||
projectexplorer \
|
||||
cpptools \
|
||||
cppeditor \
|
||||
qmljstools \
|
||||
debugger \
|
||||
texteditor
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include "testsettings.h"
|
||||
#include "testtreemodel.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/cpptoolstestcase.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/cpptoolstestcase.h>
|
||||
#include <cppeditor/projectinfo.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
@@ -81,7 +81,7 @@ void AutoTestUnitTests::initTestCase()
|
||||
if (!toolchain)
|
||||
QSKIP("This test requires that there is a kit with a toolchain.");
|
||||
|
||||
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(":/unit_test");
|
||||
m_tmpDir = new CppEditor::Tests::TemporaryCopiedDir(":/unit_test");
|
||||
|
||||
if (!qEnvironmentVariableIsEmpty("BOOST_INCLUDE_DIR")) {
|
||||
m_checkBoost = true;
|
||||
@@ -108,7 +108,7 @@ void AutoTestUnitTests::testCodeParser()
|
||||
QFETCH(int, expectedUnnamedQuickTestsCount);
|
||||
QFETCH(int, expectedDataTagsCount);
|
||||
|
||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||
CppEditor::Tests::ProjectOpenerAndCloser projectManager;
|
||||
QVERIFY(projectManager.open(projectFilePath, true, m_kit));
|
||||
|
||||
QSignalSpy parserSpy(m_model->parser(), SIGNAL(parsingFinished()));
|
||||
@@ -156,7 +156,7 @@ void AutoTestUnitTests::testCodeParserSwitchStartup()
|
||||
QFETCH(QList<int>, expectedUnnamedQuickTestsCount);
|
||||
QFETCH(QList<int>, expectedDataTagsCount);
|
||||
|
||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||
CppEditor::Tests::ProjectOpenerAndCloser projectManager;
|
||||
for (int i = 0; i < projectFilePaths.size(); ++i) {
|
||||
qDebug() << "Opening project" << projectFilePaths.at(i);
|
||||
QVERIFY(projectManager.open(projectFilePaths.at(i), true, m_kit));
|
||||
@@ -205,7 +205,7 @@ void AutoTestUnitTests::testCodeParserGTest()
|
||||
QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)");
|
||||
|
||||
QFETCH(QString, projectFilePath);
|
||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||
CppEditor::Tests::ProjectOpenerAndCloser projectManager;
|
||||
QVERIFY(projectManager.open(projectFilePath, true, m_kit));
|
||||
|
||||
QSignalSpy parserSpy(m_model->parser(), SIGNAL(parsingFinished()));
|
||||
@@ -254,8 +254,8 @@ void AutoTestUnitTests::testCodeParserBoostTest()
|
||||
|
||||
QFETCH(QString, projectFilePath);
|
||||
QFETCH(QString, extension);
|
||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||
const CppTools::ProjectInfo::ConstPtr projectInfo
|
||||
CppEditor::Tests::ProjectOpenerAndCloser projectManager;
|
||||
const CppEditor::ProjectInfo::ConstPtr projectInfo
|
||||
= projectManager.open(projectFilePath, true, m_kit);
|
||||
QVERIFY(projectInfo);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace CppTools { namespace Tests { class TemporaryCopiedDir; } }
|
||||
namespace CppEditor { namespace Tests { class TemporaryCopiedDir; } }
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
|
||||
namespace Autotest {
|
||||
@@ -60,7 +60,7 @@ private slots:
|
||||
|
||||
private:
|
||||
TestTreeModel *m_model = nullptr;
|
||||
CppTools::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;
|
||||
CppEditor::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;
|
||||
bool m_isQt4 = false;
|
||||
bool m_checkBoost = false;
|
||||
ProjectExplorer::Kit *m_kit = nullptr;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "boosttestframework.h"
|
||||
#include "boosttesttreeitem.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QRegularExpression>
|
||||
@@ -125,12 +125,12 @@ bool BoostTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futu
|
||||
if (doc.isNull() || !includesBoostTest(doc, m_cppSnapshot) || !hasBoostTestMacros(doc))
|
||||
return false;
|
||||
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
const QList<CppTools::ProjectPart::ConstPtr> projectParts
|
||||
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> projectParts
|
||||
= modelManager->projectPart(fileName);
|
||||
if (projectParts.isEmpty()) // happens if shutting down while parsing
|
||||
return false;
|
||||
const CppTools::ProjectPart::ConstPtr projectPart = projectParts.first();
|
||||
const CppEditor::ProjectPart::ConstPtr projectPart = projectParts.first();
|
||||
const auto projectFile = Utils::FilePath::fromString(projectPart->projectFile);
|
||||
const QByteArray &fileContent = getFileContent(fileName);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "boosttestparser.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -195,7 +195,7 @@ QList<ITestConfiguration *> BoostTestTreeItem::getAllTestConfigurations() const
|
||||
++funcChildren;
|
||||
});
|
||||
if (funcChildren) {
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return);
|
||||
testsPerProjectfile[item->proFile()].testCases += funcChildren;
|
||||
testsPerProjectfile[item->proFile()].internalTargets.unite(cppMM->internalTargets(item->filePath()));
|
||||
@@ -236,7 +236,7 @@ QList<ITestConfiguration *> BoostTestTreeItem::getTestConfigurations(
|
||||
if (!item->enabled()) // ignore child tests known to be disabled when using run selected
|
||||
return;
|
||||
if (predicate(item)) {
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return);
|
||||
QString tcName = item->name();
|
||||
if (item->state().testFlag(BoostTestTreeItem::Templated))
|
||||
@@ -282,7 +282,7 @@ ITestConfiguration *BoostTestTreeItem::testConfiguration() const
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
QTC_ASSERT(project, return nullptr);
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return nullptr);
|
||||
|
||||
const Type itemType = type();
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#include "catchframework.h"
|
||||
#include "catchtreeitem.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectpart.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/projectpart.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
@@ -118,7 +118,7 @@ bool CatchTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futu
|
||||
if (doc.isNull() || !includesCatchHeader(doc, m_cppSnapshot))
|
||||
return false;
|
||||
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
const QString &filePath = doc->fileName();
|
||||
const QByteArray &fileContent = getFileContent(fileName);
|
||||
|
||||
@@ -133,11 +133,11 @@ bool CatchTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futu
|
||||
}
|
||||
|
||||
|
||||
const QList<CppTools::ProjectPart::ConstPtr> projectParts = modelManager->projectPart(fileName);
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> projectParts = modelManager->projectPart(fileName);
|
||||
if (projectParts.isEmpty()) // happens if shutting down while parsing
|
||||
return false;
|
||||
Utils::FilePath proFile;
|
||||
const CppTools::ProjectPart::ConstPtr projectPart = projectParts.first();
|
||||
const CppEditor::ProjectPart::ConstPtr projectPart = projectParts.first();
|
||||
proFile = Utils::FilePath::fromString(projectPart->projectFile);
|
||||
|
||||
CatchCodeParser codeParser(fileContent, projectPart->languageFeatures);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "catchconfiguration.h"
|
||||
#include "catchframework.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -157,7 +157,7 @@ ITestConfiguration *CatchTreeItem::testConfiguration() const
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
QTC_ASSERT(project, return nullptr);
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return nullptr);
|
||||
|
||||
if (type() != TestCase)
|
||||
@@ -192,7 +192,7 @@ static void collectTestInfo(const TestTreeItem *item,
|
||||
bool ignoreCheckState)
|
||||
{
|
||||
QTC_ASSERT(item, return);
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return);
|
||||
const int childCount = item->childCount();
|
||||
if (item->type() == TestTreeItem::GroupNode) {
|
||||
@@ -234,7 +234,7 @@ static void collectFailedTestInfo(const CatchTreeItem *item,
|
||||
item->forAllChildItems([&testCasesForProfile](TestTreeItem *it) {
|
||||
QTC_ASSERT(it, return);
|
||||
QTC_ASSERT(it->parentItem(), return);
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return);
|
||||
if (it->type() == TestTreeItem::TestCase && it->data(0, FailedRole).toBool()) {
|
||||
CatchTreeItem *current = static_cast<CatchTreeItem *>(it);
|
||||
@@ -282,7 +282,7 @@ QList<ITestConfiguration *> CatchTreeItem::getFailedTestConfigurations() const
|
||||
QList<ITestConfiguration *> CatchTreeItem::getTestConfigurationsForFile(const Utils::FilePath &fileName) const
|
||||
{
|
||||
QList<ITestConfiguration *> result;
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return result);
|
||||
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include "gtestvisitors.h"
|
||||
#include "gtest_utils.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectpart.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/projectpart.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QRegularExpressionMatch>
|
||||
@@ -107,7 +107,7 @@ bool GTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futureIn
|
||||
}
|
||||
|
||||
const QString &filePath = doc->fileName();
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
CPlusPlus::Document::Ptr document = m_cppSnapshot.preprocessedDocument(fileContent, fileName);
|
||||
document->check();
|
||||
CPlusPlus::AST *ast = document->translationUnit()->ast();
|
||||
@@ -116,7 +116,7 @@ bool GTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futureIn
|
||||
|
||||
const QMap<GTestCaseSpec, GTestCodeLocationList> result = visitor.gtestFunctions();
|
||||
Utils::FilePath proFile;
|
||||
const QList<CppTools::ProjectPart::ConstPtr> &ppList = modelManager->projectPart(filePath);
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> &ppList = modelManager->projectPart(filePath);
|
||||
if (!ppList.isEmpty())
|
||||
proFile = Utils::FilePath::fromString(ppList.first()->projectFile);
|
||||
else
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "gtestparser.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
@@ -522,18 +522,18 @@ QString GTestTreeItem::nameSuffix() const
|
||||
QSet<QString> internalTargets(const TestTreeItem &item)
|
||||
{
|
||||
QSet<QString> result;
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject());
|
||||
if (!projectInfo)
|
||||
return {};
|
||||
const Utils::FilePath filePath = item.filePath();
|
||||
const QString file = filePath.toString();
|
||||
const QVector<CppTools::ProjectPart::ConstPtr> projectParts = projectInfo->projectParts();
|
||||
const QVector<CppEditor::ProjectPart::ConstPtr> projectParts = projectInfo->projectParts();
|
||||
if (projectParts.isEmpty())
|
||||
return cppMM->dependingInternalTargets(item.filePath());
|
||||
for (const CppTools::ProjectPart::ConstPtr &projectPart : projectParts) {
|
||||
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectParts) {
|
||||
if (Utils::FilePath::fromString(projectPart->projectFile) == item.proFile()
|
||||
&& Utils::anyOf(projectPart->files, [&file] (const CppTools::ProjectFile &pf) {
|
||||
&& Utils::anyOf(projectPart->files, [&file] (const CppEditor::ProjectFile &pf) {
|
||||
return pf.path == file;
|
||||
})) {
|
||||
result.insert(projectPart->buildSystemTarget);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "itestparser.h"
|
||||
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <utils/textfileformat.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
@@ -48,14 +48,14 @@ void CppParser::init(const Utils::FilePaths &filesToParse, bool fullParse)
|
||||
{
|
||||
Q_UNUSED(filesToParse)
|
||||
Q_UNUSED(fullParse)
|
||||
m_cppSnapshot = CppTools::CppModelManager::instance()->snapshot();
|
||||
m_workingCopy = CppTools::CppModelManager::instance()->workingCopy();
|
||||
m_cppSnapshot = CppEditor::CppModelManager::instance()->snapshot();
|
||||
m_workingCopy = CppEditor::CppModelManager::instance()->workingCopy();
|
||||
}
|
||||
|
||||
bool CppParser::selectedForBuilding(const Utils::FilePath &fileName)
|
||||
{
|
||||
QList<CppTools::ProjectPart::ConstPtr> projParts =
|
||||
CppTools::CppModelManager::instance()->projectPart(fileName);
|
||||
QList<CppEditor::ProjectPart::ConstPtr> projParts =
|
||||
CppEditor::CppModelManager::instance()->projectPart(fileName);
|
||||
|
||||
return !projParts.isEmpty() && projParts.at(0)->selectedForBuilding;
|
||||
}
|
||||
@@ -82,8 +82,8 @@ bool precompiledHeaderContains(const CPlusPlus::Snapshot &snapshot,
|
||||
const QString &cacheString,
|
||||
const std::function<bool(const QString &)> &checker)
|
||||
{
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
const QList<CppTools::ProjectPart::ConstPtr> projectParts = modelManager->projectPart(filePath);
|
||||
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> projectParts = modelManager->projectPart(filePath);
|
||||
if (projectParts.isEmpty())
|
||||
return false;
|
||||
const QStringList precompiledHeaders = projectParts.first()->precompiledHeaders;
|
||||
@@ -128,7 +128,7 @@ bool CppParser::precompiledHeaderContains(const CPlusPlus::Snapshot &snapshot,
|
||||
void CppParser::release()
|
||||
{
|
||||
m_cppSnapshot = CPlusPlus::Snapshot();
|
||||
m_workingCopy = CppTools::WorkingCopy();
|
||||
m_workingCopy = CppEditor::WorkingCopy();
|
||||
QMutexLocker l(s_cacheMutex());
|
||||
s_pchLookupCache.clear();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "testtreeitem.h"
|
||||
|
||||
#include <cplusplus/CppDocument.h>
|
||||
#include <cpptools/cppworkingcopy.h>
|
||||
#include <cppeditor/cppworkingcopy.h>
|
||||
#include <qmljs/qmljsdocument.h>
|
||||
|
||||
#include <QFutureInterface>
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
|
||||
protected:
|
||||
CPlusPlus::Snapshot m_cppSnapshot;
|
||||
CppTools::WorkingCopy m_workingCopy;
|
||||
CppEditor::WorkingCopy m_workingCopy;
|
||||
};
|
||||
|
||||
} // namespace Autotest
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
#include "loadprojectscenario.h"
|
||||
|
||||
#include <cpptools/cpptoolstestcase.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
#include <cppeditor/cpptoolstestcase.h>
|
||||
#include <cppeditor/projectinfo.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
@@ -82,7 +82,7 @@ bool LoadProjectScenario::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_tmpDir = new CppTools::Tests::TemporaryCopiedDir(":/unit_test");
|
||||
m_tmpDir = new CppEditor::Tests::TemporaryCopiedDir(":/unit_test");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ bool LoadProjectScenario::loadProject()
|
||||
{
|
||||
const QString projectFilePath = m_tmpDir->path() + "/plain/plain.pro";
|
||||
|
||||
CppTools::Tests::ProjectOpenerAndCloser projectManager;
|
||||
CppEditor::Tests::ProjectOpenerAndCloser projectManager;
|
||||
// This code must trigger a call to PluginManager::finishScenario() at some later point.
|
||||
const CppTools::ProjectInfo::ConstPtr projectInfo = projectManager.open(projectFilePath,
|
||||
const CppEditor::ProjectInfo::ConstPtr projectInfo = projectManager.open(projectFilePath,
|
||||
true, m_kit);
|
||||
return projectInfo.get();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace CppTools { namespace Tests { class TemporaryCopiedDir; } }
|
||||
namespace CppEditor { namespace Tests { class TemporaryCopiedDir; } }
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
|
||||
namespace Autotest {
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
bool loadProject();
|
||||
|
||||
TestTreeModel *m_model = nullptr;
|
||||
CppTools::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;
|
||||
CppEditor::Tests::TemporaryCopiedDir *m_tmpDir = nullptr;
|
||||
ProjectExplorer::Kit *m_kit = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
#include "qttestframework.h"
|
||||
#include "qttestvisitors.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectpart.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/projectpart.h>
|
||||
#include <cplusplus/TypeOfExpression.h>
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
@@ -93,8 +93,8 @@ static bool includesQtTest(const CPlusPlus::Document::Ptr &doc, const CPlusPlus:
|
||||
|
||||
static bool qtTestLibDefined(const Utils::FilePath &fileName)
|
||||
{
|
||||
const QList<CppTools::ProjectPart::ConstPtr> parts =
|
||||
CppTools::CppModelManager::instance()->projectPart(fileName);
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> parts =
|
||||
CppEditor::CppModelManager::instance()->projectPart(fileName);
|
||||
if (parts.size() > 0) {
|
||||
return Utils::anyOf(parts.at(0)->projectMacros, [] (const ProjectExplorer::Macro ¯o) {
|
||||
return macro.key == "QT_TESTLIB_LIB";
|
||||
@@ -103,7 +103,7 @@ static bool qtTestLibDefined(const Utils::FilePath &fileName)
|
||||
return false;
|
||||
}
|
||||
|
||||
TestCases QtTestParser::testCases(const CppTools::CppModelManager *modelManager,
|
||||
TestCases QtTestParser::testCases(const CppEditor::CppModelManager *modelManager,
|
||||
const Utils::FilePath &fileName) const
|
||||
{
|
||||
const QByteArray &fileContent = getFileContent(fileName);
|
||||
@@ -314,7 +314,7 @@ bool QtTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futureI
|
||||
return false;
|
||||
}
|
||||
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
TestCases testCaseList(testCases(modelManager, fileName));
|
||||
bool reported = false;
|
||||
// we might be in a reparse without the original entry point with the QTest::qExec()
|
||||
@@ -327,7 +327,7 @@ bool QtTestParser::processDocument(QFutureInterface<TestParseResultPtr> &futureI
|
||||
if (earlyReturn.has_value() || !data.valid)
|
||||
continue;
|
||||
|
||||
QList<CppTools::ProjectPart::ConstPtr> projectParts
|
||||
QList<CppEditor::ProjectPart::ConstPtr> projectParts
|
||||
= modelManager->projectPart(fileName);
|
||||
if (projectParts.isEmpty()) // happens if shutting down while parsing
|
||||
return false;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include <utils/optional.h>
|
||||
|
||||
namespace CppTools { class CppModelManager; }
|
||||
namespace CppEditor { class CppModelManager; }
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
const Utils::FilePath &fileName) override;
|
||||
|
||||
private:
|
||||
TestCases testCases(const CppTools::CppModelManager *modelManager,
|
||||
TestCases testCases(const CppEditor::CppModelManager *modelManager,
|
||||
const Utils::FilePath &fileName) const;
|
||||
QHash<QString, QtTestCodeLocationList> checkForDataTags(const Utils::FilePath &fileName) const;
|
||||
struct TestCaseData {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "qttestparser.h"
|
||||
#include "qttestframework.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -130,7 +130,7 @@ ITestConfiguration *QtTestTreeItem::testConfiguration() const
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject();
|
||||
QTC_ASSERT(project, return nullptr);
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return nullptr);
|
||||
|
||||
QtTestConfiguration *config = nullptr;
|
||||
@@ -172,7 +172,7 @@ ITestConfiguration *QtTestTreeItem::testConfiguration() const
|
||||
static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
||||
QList<ITestConfiguration *> &testConfigurations)
|
||||
{
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return);
|
||||
QTC_ASSERT(item, return);
|
||||
if (item->type() == TestTreeItem::GroupNode) {
|
||||
@@ -215,7 +215,7 @@ static void fillTestConfigurationsFromCheckState(const TestTreeItem *item,
|
||||
|
||||
static void collectFailedTestInfo(TestTreeItem *item, QList<ITestConfiguration *> &testConfigs)
|
||||
{
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
QTC_ASSERT(cppMM, return);
|
||||
QTC_ASSERT(item, return);
|
||||
if (item->type() == TestTreeItem::GroupNode) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/Symbols.h>
|
||||
#include <cplusplus/TypeOfExpression.h>
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/Scope.h>
|
||||
#include <cplusplus/SymbolVisitor.h>
|
||||
#include <cpptools/symbolfinder.h>
|
||||
#include <cppeditor/symbolfinder.h>
|
||||
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
bool visit(CPlusPlus::Class *symbol) override;
|
||||
|
||||
private:
|
||||
CppTools::SymbolFinder m_symbolFinder;
|
||||
CppEditor::SymbolFinder m_symbolFinder;
|
||||
QString m_className;
|
||||
CPlusPlus::Snapshot m_snapshot;
|
||||
QMap<QString, QtTestCodeLocationAndType> m_privSlots;
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
#include "../testcodeparser.h"
|
||||
#include "../testtreemodel.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectpart.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/projectpart.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <qmljs/parser/qmljsast_p.h>
|
||||
#include <qmljs/qmljsdialect.h>
|
||||
@@ -98,10 +98,10 @@ static bool includesQtQuickTest(const CPlusPlus::Document::Ptr &doc,
|
||||
return false;
|
||||
}
|
||||
|
||||
static QString quickTestSrcDir(const CppTools::CppModelManager *cppMM,
|
||||
static QString quickTestSrcDir(const CppEditor::CppModelManager *cppMM,
|
||||
const Utils::FilePath &fileName)
|
||||
{
|
||||
const QList<CppTools::ProjectPart::ConstPtr> parts = cppMM->projectPart(fileName);
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> parts = cppMM->projectPart(fileName);
|
||||
if (parts.size() > 0) {
|
||||
const ProjectExplorer::Macros ¯os = parts.at(0)->projectMacros;
|
||||
auto found = std::find_if(
|
||||
@@ -263,11 +263,11 @@ bool QuickTestParser::handleQtQuickTest(QFutureInterface<TestParseResultPtr> &fu
|
||||
CPlusPlus::Document::Ptr document,
|
||||
ITestFramework *framework)
|
||||
{
|
||||
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
|
||||
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
|
||||
if (quickTestName(document).isEmpty())
|
||||
return false;
|
||||
|
||||
QList<CppTools::ProjectPart::ConstPtr> ppList = modelManager->projectPart(document->fileName());
|
||||
QList<CppEditor::ProjectPart::ConstPtr> ppList = modelManager->projectPart(document->fileName());
|
||||
if (ppList.isEmpty()) // happens if shutting down while parsing
|
||||
return false;
|
||||
const Utils::FilePath cppFileName = Utils::FilePath::fromString(document->fileName());
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "quicktestparser.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -387,11 +387,11 @@ bool QuickTestTreeItem::isGroupable() const
|
||||
QSet<QString> internalTargets(const Utils::FilePath &proFile)
|
||||
{
|
||||
QSet<QString> result;
|
||||
const auto cppMM = CppTools::CppModelManager::instance();
|
||||
const auto cppMM = CppEditor::CppModelManager::instance();
|
||||
const auto projectInfo = cppMM->projectInfo(ProjectExplorer::SessionManager::startupProject());
|
||||
if (!projectInfo)
|
||||
return {};
|
||||
for (const CppTools::ProjectPart::ConstPtr &projectPart : projectInfo->projectParts()) {
|
||||
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectInfo->projectParts()) {
|
||||
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Executable)
|
||||
continue;
|
||||
if (projectPart->projectFile == proFile.toString())
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/progressmanager/futureprogress.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/cpptoolsconstants.h>
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
#include <qmljstools/qmljsmodelmanager.h>
|
||||
@@ -373,7 +373,7 @@ void TestCodeParser::scanForTests(const Utils::FilePaths &fileList,
|
||||
|
||||
void TestCodeParser::onTaskStarted(Utils::Id type)
|
||||
{
|
||||
if (type == CppTools::Constants::TASK_INDEX) {
|
||||
if (type == CppEditor::Constants::TASK_INDEX) {
|
||||
m_codeModelParsing = true;
|
||||
if (m_parserState == FullParse || m_parserState == PartialParse) {
|
||||
m_postponedUpdateType = m_parserState == FullParse
|
||||
@@ -392,7 +392,7 @@ void TestCodeParser::onAllTasksFinished(Utils::Id type)
|
||||
emit parsingFailed();
|
||||
|
||||
// only CPP parsing is relevant as we trigger Qml parsing internally anyway
|
||||
if (type != CppTools::Constants::TASK_INDEX)
|
||||
if (type != CppEditor::Constants::TASK_INDEX)
|
||||
return;
|
||||
m_codeModelParsing = false;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include "testoutputreader.h"
|
||||
#include "testrunconfiguration.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cpptools/projectinfo.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <cppeditor/projectinfo.h>
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "testprojectsettings.h"
|
||||
#include "testsettings.h"
|
||||
|
||||
#include <cpptools/cppmodelmanager.h>
|
||||
#include <cppeditor/cppmodelmanager.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
@@ -111,16 +111,16 @@ void TestTreeModel::setupParsingConnections()
|
||||
}
|
||||
});
|
||||
|
||||
CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance();
|
||||
connect(cppMM, &CppTools::CppModelManager::documentUpdated,
|
||||
CppEditor::CppModelManager *cppMM = CppEditor::CppModelManager::instance();
|
||||
connect(cppMM, &CppEditor::CppModelManager::documentUpdated,
|
||||
m_parser, &TestCodeParser::onCppDocumentUpdated, Qt::QueuedConnection);
|
||||
connect(cppMM, &CppTools::CppModelManager::aboutToRemoveFiles,
|
||||
connect(cppMM, &CppEditor::CppModelManager::aboutToRemoveFiles,
|
||||
this, [this](const QStringList &files) {
|
||||
const Utils::FilePaths filesToRemove
|
||||
= Utils::transform(files, &Utils::FilePath::fromString);
|
||||
removeFiles(filesToRemove);
|
||||
}, Qt::QueuedConnection);
|
||||
connect(cppMM, &CppTools::CppModelManager::projectPartsUpdated,
|
||||
connect(cppMM, &CppEditor::CppModelManager::projectPartsUpdated,
|
||||
m_parser, &TestCodeParser::onProjectPartsUpdated);
|
||||
|
||||
QmlJS::ModelManagerInterface *qmlJsMM = QmlJS::ModelManagerInterface::instance();
|
||||
|
||||
Reference in New Issue
Block a user