2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "cmakeconfigitem.h"
|
|
|
|
|
|
2021-05-31 15:09:28 +02:00
|
|
|
#include "fileapidataextractor.h"
|
|
|
|
|
|
2019-06-13 14:24:04 +02:00
|
|
|
#include <projectexplorer/headerpath.h>
|
|
|
|
|
#include <projectexplorer/projectmacro.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/filesystemwatcher.h>
|
|
|
|
|
#include <utils/fileutils.h>
|
|
|
|
|
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <QDir>
|
2021-05-31 15:09:28 +02:00
|
|
|
#include <QFutureInterface>
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <QString>
|
|
|
|
|
#include <QVector>
|
2021-08-19 18:51:18 +02:00
|
|
|
#include <QVersionNumber>
|
2020-04-17 15:30:05 +02:00
|
|
|
|
|
|
|
|
#include <vector>
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
namespace CMakeProjectManager::Internal {
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
namespace FileApiDetails {
|
|
|
|
|
|
|
|
|
|
class ReplyObject
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString kind;
|
|
|
|
|
QString file;
|
|
|
|
|
std::pair<int, int> version;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ReplyFileContents
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString generator;
|
2021-01-14 16:38:55 +01:00
|
|
|
bool isMultiConfig = false;
|
2019-06-13 14:24:04 +02:00
|
|
|
QString cmakeExecutable;
|
2020-09-28 15:10:04 +02:00
|
|
|
QString ctestExecutable;
|
2019-06-13 14:24:04 +02:00
|
|
|
QString cmakeRoot;
|
|
|
|
|
|
|
|
|
|
QVector<ReplyObject> replies;
|
2021-08-19 18:51:18 +02:00
|
|
|
QVersionNumber cmakeVersion;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2021-06-08 14:42:59 +02:00
|
|
|
Utils::FilePath jsonFile(const QString &kind, const Utils::FilePath &replyDir) const;
|
2019-06-13 14:24:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Directory
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString buildPath;
|
|
|
|
|
QString sourcePath;
|
|
|
|
|
int parent = -1;
|
|
|
|
|
int project = -1;
|
|
|
|
|
std::vector<int> children;
|
|
|
|
|
std::vector<int> targets;
|
|
|
|
|
bool hasInstallRule = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Project
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString name;
|
|
|
|
|
int parent = -1;
|
|
|
|
|
std::vector<int> children;
|
|
|
|
|
std::vector<int> directories;
|
|
|
|
|
std::vector<int> targets;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Target
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
// From codemodel file:
|
|
|
|
|
QString name;
|
|
|
|
|
QString id;
|
|
|
|
|
int directory = -1;
|
|
|
|
|
int project = -1;
|
|
|
|
|
QString jsonFile;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Configuration
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString name;
|
|
|
|
|
std::vector<Directory> directories;
|
|
|
|
|
std::vector<Project> projects;
|
|
|
|
|
std::vector<Target> targets;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class InstallDestination
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString path;
|
|
|
|
|
int backtrace;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class FragmentInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString fragment;
|
|
|
|
|
QString role;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class LinkInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString language;
|
|
|
|
|
std::vector<FragmentInfo> fragments;
|
|
|
|
|
bool isLto = false;
|
|
|
|
|
QString sysroot;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ArchiveInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
std::vector<FragmentInfo> fragments;
|
|
|
|
|
bool isLto = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DependencyInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString targetId;
|
|
|
|
|
int backtrace;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class SourceInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString path;
|
|
|
|
|
int compileGroup = -1;
|
|
|
|
|
int sourceGroup = -1;
|
|
|
|
|
int backtrace = -1;
|
|
|
|
|
bool isGenerated = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class IncludeInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ProjectExplorer::HeaderPath path;
|
|
|
|
|
int backtrace;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DefineInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ProjectExplorer::Macro define;
|
|
|
|
|
int backtrace;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CompileInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
std::vector<int> sources;
|
|
|
|
|
QString language;
|
|
|
|
|
QStringList fragments;
|
|
|
|
|
std::vector<IncludeInfo> includes;
|
|
|
|
|
std::vector<DefineInfo> defines;
|
|
|
|
|
QString sysroot;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class BacktraceNode
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
int file = -1;
|
|
|
|
|
int line = -1;
|
|
|
|
|
int command = -1;
|
|
|
|
|
int parent = -1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class BacktraceInfo
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
std::vector<QString> commands;
|
|
|
|
|
std::vector<QString> files;
|
|
|
|
|
std::vector<BacktraceNode> nodes;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TargetDetails
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString name;
|
|
|
|
|
QString id;
|
|
|
|
|
QString type;
|
|
|
|
|
QString folderTargetProperty;
|
|
|
|
|
Utils::FilePath sourceDir;
|
|
|
|
|
Utils::FilePath buildDir;
|
|
|
|
|
int backtrace = -1;
|
|
|
|
|
bool isGeneratorProvided = false;
|
|
|
|
|
QString nameOnDisk;
|
|
|
|
|
QList<Utils::FilePath> artifacts;
|
|
|
|
|
QString installPrefix;
|
|
|
|
|
std::vector<InstallDestination> installDestination;
|
2022-08-26 10:30:00 +02:00
|
|
|
std::optional<LinkInfo> link;
|
|
|
|
|
std::optional<ArchiveInfo> archive;
|
2019-06-13 14:24:04 +02:00
|
|
|
std::vector<DependencyInfo> dependencies;
|
|
|
|
|
std::vector<SourceInfo> sources;
|
|
|
|
|
std::vector<QString> sourceGroups;
|
|
|
|
|
std::vector<CompileInfo> compileGroups;
|
|
|
|
|
BacktraceInfo backtraceGraph;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace FileApiDetails
|
|
|
|
|
|
|
|
|
|
class FileApiData
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
FileApiDetails::ReplyFileContents replyFile;
|
|
|
|
|
CMakeConfig cache;
|
2021-09-01 19:49:08 +02:00
|
|
|
std::vector<CMakeFileInfo> cmakeFiles;
|
2021-01-14 16:38:55 +01:00
|
|
|
FileApiDetails::Configuration codemodel;
|
2019-06-13 14:24:04 +02:00
|
|
|
std::vector<FileApiDetails::TargetDetails> targetDetails;
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-13 12:59:23 +02:00
|
|
|
class FileApiParser
|
2019-06-13 14:24:04 +02:00
|
|
|
{
|
|
|
|
|
public:
|
2021-05-31 15:09:28 +02:00
|
|
|
static FileApiData parseData(QFutureInterface<std::shared_ptr<FileApiQtcData>> &fi,
|
2021-06-08 14:42:59 +02:00
|
|
|
const Utils::FilePath &replyFilePath,
|
2021-05-31 15:09:28 +02:00
|
|
|
const QString &cmakeBuildType,
|
2021-01-14 16:38:55 +01:00
|
|
|
QString &errorMessage);
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-05-13 12:24:59 +02:00
|
|
|
static bool setupCMakeFileApi(const Utils::FilePath &buildDirectory,
|
|
|
|
|
Utils::FileSystemWatcher &watcher);
|
|
|
|
|
|
2021-06-08 14:42:59 +02:00
|
|
|
static Utils::FilePaths cmakeQueryFilePaths(const Utils::FilePath &buildDirectory);
|
2020-05-13 12:24:59 +02:00
|
|
|
|
2021-06-08 14:42:59 +02:00
|
|
|
static Utils::FilePath scanForCMakeReplyFile(const Utils::FilePath &buildDirectory);
|
2019-06-13 14:24:04 +02:00
|
|
|
};
|
|
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
} // CMakeProjectManager::Internal
|