forked from qt-creator/qt-creator
Change RawProjectPart::projectFile to FilePath
Changed the type of PawProjectPart::projectFile from QString to FilePath. Rest of the changes are a direct byproduct. Change-Id: I00ed5e948af3fd1660ebf2c4bbcfae21f8facf28 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -109,7 +109,7 @@ bool BoostTestParser::processDocument(QPromise<TestParseResultPtr> &promise,
|
||||
if (projectParts.isEmpty()) // happens if shutting down while parsing
|
||||
return false;
|
||||
const CppEditor::ProjectPart::ConstPtr projectPart = projectParts.first();
|
||||
const auto projectFile = FilePath::fromString(projectPart->projectFile);
|
||||
const FilePath &projectFile = projectPart->projectFile;
|
||||
const QByteArray &fileContent = getFileContent(fileName);
|
||||
|
||||
BoostCodeParser codeParser(fileContent, projectPart->languageFeatures, doc, m_cppSnapshot);
|
||||
|
@@ -123,7 +123,7 @@ bool CatchTestParser::processDocument(QPromise<TestParseResultPtr> &promise,
|
||||
return false;
|
||||
FilePath proFile;
|
||||
const CppEditor::ProjectPart::ConstPtr projectPart = projectParts.first();
|
||||
proFile = FilePath::fromString(projectPart->projectFile);
|
||||
proFile = projectPart->projectFile;
|
||||
|
||||
CatchCodeParser codeParser(fileContent, projectPart->languageFeatures);
|
||||
const CatchTestCodeLocationList foundTests = codeParser.findTests();
|
||||
|
@@ -97,7 +97,7 @@ bool GTestParser::processDocument(QPromise<TestParseResultPtr> &promise,
|
||||
const QList<CppEditor::ProjectPart::ConstPtr> &ppList =
|
||||
CppEditor::CppModelManager::projectPart(filePath);
|
||||
if (!ppList.isEmpty())
|
||||
proFile = FilePath::fromString(ppList.first()->projectFile);
|
||||
proFile = ppList.first()->projectFile;
|
||||
else
|
||||
return false; // happens if shutting down while parsing
|
||||
|
||||
|
@@ -500,10 +500,10 @@ QSet<QString> internalTargets(const TestTreeItem &item)
|
||||
if (projectParts.isEmpty())
|
||||
return CppEditor::CppModelManager::dependingInternalTargets(item.filePath());
|
||||
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectParts) {
|
||||
if (FilePath::fromString(projectPart->projectFile) == item.proFile()
|
||||
&& Utils::anyOf(projectPart->files, [&filePath](const CppEditor::ProjectFile &pf) {
|
||||
return pf.path == filePath;
|
||||
})) {
|
||||
if (projectPart->projectFile == item.proFile()
|
||||
&& Utils::anyOf(projectPart->files, [&filePath](const CppEditor::ProjectFile &pf) {
|
||||
return pf.path == filePath;
|
||||
})) {
|
||||
result.insert(projectPart->buildSystemTarget);
|
||||
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Executable)
|
||||
result.unite(CppEditor::CppModelManager::dependingInternalTargets(filePath));
|
||||
|
@@ -370,7 +370,7 @@ std::optional<bool> QtTestParser::fillTestCaseData(
|
||||
}
|
||||
|
||||
QtTestParseResult *QtTestParser::createParseResult(
|
||||
const QString &testCaseName, const TestCaseData &data, const QString &projectFile) const
|
||||
const QString &testCaseName, const TestCaseData &data, const FilePath &projectFile) const
|
||||
{
|
||||
QtTestParseResult *parseResult = new QtTestParseResult(framework());
|
||||
parseResult->itemType = TestTreeItem::TestCase;
|
||||
@@ -379,7 +379,7 @@ QtTestParseResult *QtTestParser::createParseResult(
|
||||
parseResult->displayName = testCaseName;
|
||||
parseResult->line = data.line;
|
||||
parseResult->column = data.column;
|
||||
parseResult->proFile = FilePath::fromString(projectFile);
|
||||
parseResult->proFile = projectFile;
|
||||
parseResult->setRunsMultipleTestcases(data.multipleTestCases);
|
||||
QMap<QString, QtTestCodeLocationAndType>::ConstIterator it = data.testFunctions.begin();
|
||||
const QMap<QString, QtTestCodeLocationAndType>::ConstIterator end = data.testFunctions.end();
|
||||
|
@@ -53,8 +53,10 @@ private:
|
||||
std::optional<bool> fillTestCaseData(const QString &testCaseName,
|
||||
const CPlusPlus::Document::Ptr &doc,
|
||||
TestCaseData &data) const;
|
||||
QtTestParseResult *createParseResult(const QString &testCaseName, const TestCaseData &data,
|
||||
const QString &projectFile) const;
|
||||
QtTestParseResult *createParseResult(
|
||||
const QString &testCaseName,
|
||||
const TestCaseData &data,
|
||||
const Utils::FilePath &projectFile) const;
|
||||
QHash<Utils::FilePath, TestCases> m_testCases;
|
||||
QMultiHash<Utils::FilePath, Utils::FilePath> m_alternativeFiles;
|
||||
QSet<Utils::FilePath> m_prefilteredFiles;
|
||||
|
@@ -260,7 +260,7 @@ bool QuickTestParser::handleQtQuickTest(QPromise<TestParseResultPtr> &promise,
|
||||
if (ppList.isEmpty()) // happens if shutting down while parsing
|
||||
return false;
|
||||
const FilePath cppFileName = document->filePath();
|
||||
const FilePath proFile = FilePath::fromString(ppList.at(0)->projectFile);
|
||||
const FilePath proFile = ppList.at(0)->projectFile;
|
||||
{
|
||||
QWriteLocker lock(&m_parseLock);
|
||||
m_mainCppFiles.insert(cppFileName, proFile);
|
||||
|
@@ -377,7 +377,7 @@ QSet<QString> internalTargets(const FilePath &proFile)
|
||||
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectInfo->projectParts()) {
|
||||
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Executable)
|
||||
continue;
|
||||
if (projectPart->projectFile != proFile.path())
|
||||
if (projectPart->projectFile != proFile)
|
||||
continue;
|
||||
if (Utils::anyOf(projectPart->projectMacros, [](const ProjectExplorer::Macro ¯o){
|
||||
return macro.type == ProjectExplorer::MacroType::Define &&
|
||||
|
@@ -154,7 +154,7 @@ void AutotoolsBuildSystem::makefileParsingFinished(const MakefileParserOutputDat
|
||||
|
||||
RawProjectPart rpp;
|
||||
rpp.setDisplayName(project()->displayName());
|
||||
rpp.setProjectFileLocation(projectFilePath().toString());
|
||||
rpp.setProjectFileLocation(projectFilePath());
|
||||
rpp.setQtVersion(kitInfo.projectPartQtVersion);
|
||||
const QStringList cflags = outputData.m_cflags;
|
||||
QStringList cxxflags = outputData.m_cxxflags;
|
||||
|
@@ -446,8 +446,7 @@ static RawProjectParts generateRawProjectParts(const QFuture<void> &cancelFuture
|
||||
}
|
||||
|
||||
RawProjectPart rpp;
|
||||
rpp.setProjectFileLocation(
|
||||
t.sourceDir.pathAppended(Constants::CMAKE_LISTS_TXT).toString());
|
||||
rpp.setProjectFileLocation(t.sourceDir.pathAppended(Constants::CMAKE_LISTS_TXT));
|
||||
rpp.setBuildSystemTarget(t.name);
|
||||
const QString postfix = needPostfix ? QString("_%1_%2").arg(ci.language).arg(count)
|
||||
: QString();
|
||||
|
@@ -172,7 +172,7 @@ static RawProjectPart makeRawProjectPart(const FilePath &projectFile,
|
||||
|
||||
RawProjectPart rpp;
|
||||
|
||||
rpp.setProjectFileLocation(projectFile.toString());
|
||||
rpp.setProjectFileLocation(projectFile);
|
||||
rpp.setBuildSystemTarget(workingDir.path());
|
||||
rpp.setDisplayName(filePath.fileName());
|
||||
rpp.setFiles({filePath.toFSPathString()});
|
||||
|
@@ -1142,7 +1142,7 @@ QVariant ProjectPartsModel::data(const QModelIndex &index, int role) const
|
||||
if (column == PartNameColumn)
|
||||
return m_projectPartsList.at(row)->displayName;
|
||||
else if (column == PartFilePathColumn)
|
||||
return QDir::toNativeSeparators(m_projectPartsList.at(row)->projectFile);
|
||||
return m_projectPartsList.at(row)->projectFile.nativePath();
|
||||
} else if (role == Qt::ForegroundRole) {
|
||||
if (!m_projectPartsList.at(row)->selectedForBuilding) {
|
||||
return QApplication::palette().color(QPalette::ColorGroup::Disabled,
|
||||
|
@@ -105,7 +105,7 @@ QVariant ParseContextModel::data(const QModelIndex &index, int role) const
|
||||
if (role == Qt::DisplayRole)
|
||||
return m_projectParts[row]->displayName;
|
||||
else if (role == Qt::ToolTipRole)
|
||||
return QDir::toNativeSeparators(m_projectParts[row]->projectFile);
|
||||
return m_projectParts[row]->projectFile.nativePath();
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
@@ -115,7 +115,7 @@ void ProjectPartChooserTest::testChooseManuallySet()
|
||||
rpp2.setProjectFileLocation("someId");
|
||||
ProjectPart::ConstPtr p2 = ProjectPart::create({}, rpp2);
|
||||
ProjectPartChooserTestHelper t;
|
||||
t.preferredProjectPartId = p2->projectFile;
|
||||
t.preferredProjectPartId = p2->projectFile.toString();
|
||||
t.projectPartsForFile += {p1, p2};
|
||||
|
||||
QCOMPARE(t.choose().projectPart, p2);
|
||||
@@ -128,7 +128,7 @@ void ProjectPartChooserTest::testIndicateManuallySet()
|
||||
rpp2.setProjectFileLocation("someId");
|
||||
ProjectPart::ConstPtr p2 = ProjectPart::create({}, rpp2);
|
||||
ProjectPartChooserTestHelper t;
|
||||
t.preferredProjectPartId = p2->projectFile;
|
||||
t.preferredProjectPartId = p2->projectFile.toString();
|
||||
t.projectPartsForFile += {p1, p2};
|
||||
|
||||
QVERIFY(t.choose().hints & ProjectPartInfo::IsPreferredMatch);
|
||||
@@ -141,7 +141,7 @@ void ProjectPartChooserTest::testIndicateManuallySetForFallbackToProjectPartFrom
|
||||
rpp2.setProjectFileLocation("someId");
|
||||
ProjectPart::ConstPtr p2 = ProjectPart::create({}, rpp2);
|
||||
ProjectPartChooserTestHelper t;
|
||||
t.preferredProjectPartId = p2->projectFile;
|
||||
t.preferredProjectPartId = p2->projectFile.toString();
|
||||
t.projectPartsFromDependenciesForFile += {p1, p2};
|
||||
|
||||
QVERIFY(t.choose().hints & ProjectPartInfo::IsPreferredMatch);
|
||||
|
@@ -27,7 +27,7 @@ QString ProjectPart::id() const
|
||||
|
||||
QString ProjectPart::projectFileLocation() const
|
||||
{
|
||||
QString location = QDir::fromNativeSeparators(projectFile);
|
||||
QString location = projectFile.toString();
|
||||
if (projectFileLine > 0)
|
||||
location += ":" + QString::number(projectFileLine);
|
||||
if (projectFileColumn > 0)
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
const Utils::FilePath topLevelProject;
|
||||
const QString displayName;
|
||||
const QString projectFile;
|
||||
const Utils::FilePath projectFile;
|
||||
const QString projectConfigFile; // Generic Project Manager only
|
||||
|
||||
const int projectFileLine = -1;
|
||||
|
@@ -398,7 +398,7 @@ private:
|
||||
FileType fileType = node && node->asFileNode() ? node->asFileNode()->fileType()
|
||||
: FileType::Unknown;
|
||||
if (fileType == FileType::Unknown
|
||||
&& ProjectFile::isHeader(ProjectFile::classify(interface.filePath().toString()))) {
|
||||
&& ProjectFile::isHeader(ProjectFile::classify(interface.filePath()))) {
|
||||
fileType = FileType::Header;
|
||||
}
|
||||
if (fileType == FileType::Header) {
|
||||
|
@@ -565,7 +565,7 @@ void GenericBuildSystem::refreshCppCodeModel()
|
||||
|
||||
RawProjectPart rpp;
|
||||
rpp.setDisplayName(project()->displayName());
|
||||
rpp.setProjectFileLocation(projectFilePath().toString());
|
||||
rpp.setProjectFileLocation(projectFilePath());
|
||||
rpp.setQtVersion(kitInfo.projectPartQtVersion);
|
||||
rpp.setHeaderPaths(m_projectIncludePaths);
|
||||
rpp.setConfigFileName(m_configFileName);
|
||||
|
@@ -310,7 +310,7 @@ RawProjectPart MesonProjectParser::buildRawPart(
|
||||
CompilerArgs flags = splitArgs(sources.parameters);
|
||||
part.setMacros(flags.macros);
|
||||
part.setIncludePaths(toAbsolutePath(m_buildDir, flags.includePaths));
|
||||
part.setProjectFileLocation(target.definedIn);
|
||||
part.setProjectFileLocation(FilePath::fromUserInput(target.definedIn));
|
||||
if (sources.language == "cpp")
|
||||
part.setFlagsForCxx({cxxToolchain, flags.args, {}});
|
||||
else if (sources.language == "c")
|
||||
|
@@ -63,7 +63,7 @@ HeaderPath RawProjectPart::frameworkDetectionHeuristic(const HeaderPath &header)
|
||||
return header;
|
||||
}
|
||||
|
||||
void RawProjectPart::setProjectFileLocation(const QString &projectFile, int line, int column)
|
||||
void RawProjectPart::setProjectFileLocation(const Utils::FilePath &projectFile, int line, int column)
|
||||
{
|
||||
this->projectFile = projectFile;
|
||||
projectFileLine = line;
|
||||
|
@@ -50,7 +50,7 @@ class PROJECTEXPLORER_EXPORT RawProjectPart
|
||||
public:
|
||||
void setDisplayName(const QString &displayName);
|
||||
|
||||
void setProjectFileLocation(const QString &projectFile, int line = -1, int column = -1);
|
||||
void setProjectFileLocation(const Utils::FilePath &projectFile, int line = -1, int column = -1);
|
||||
void setConfigFileName(const QString &configFileName);
|
||||
void setCallGroupId(const QString &id);
|
||||
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
public:
|
||||
QString displayName;
|
||||
|
||||
QString projectFile;
|
||||
Utils::FilePath projectFile;
|
||||
int projectFileLine = -1;
|
||||
int projectFileColumn = -1;
|
||||
QString callGroupId;
|
||||
|
@@ -858,9 +858,10 @@ static RawProjectPart generateProjectPart(
|
||||
rpp.setHeaderPaths(headerPaths);
|
||||
rpp.setDisplayName(groupName);
|
||||
const QJsonObject location = groupOrProduct.value("location").toObject();
|
||||
rpp.setProjectFileLocation(location.value("file-path").toString(),
|
||||
location.value("line").toInt(),
|
||||
location.value("column").toInt());
|
||||
rpp.setProjectFileLocation(
|
||||
FilePath::fromUserInput(location.value("file-path").toString()),
|
||||
location.value("line").toInt(),
|
||||
location.value("column").toInt());
|
||||
rpp.setBuildSystemTarget(QbsProductNode::getBuildKey(product));
|
||||
if (product.value("is-runnable").toBool()) {
|
||||
rpp.setBuildTargetType(BuildTargetType::Executable);
|
||||
|
@@ -324,7 +324,7 @@ void QmakeBuildSystem::updateCppCodeModel()
|
||||
warnOnToolChainMismatch(pro);
|
||||
RawProjectPart rpp;
|
||||
rpp.setDisplayName(pro->displayName());
|
||||
rpp.setProjectFileLocation(pro->filePath().toString());
|
||||
rpp.setProjectFileLocation(pro->filePath());
|
||||
rpp.setBuildSystemTarget(pro->filePath().toString());
|
||||
switch (pro->projectType()) {
|
||||
case ProjectType::ApplicationTemplate:
|
||||
|
Reference in New Issue
Block a user