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
|
|
|
|
|
|
2022-05-14 02:27:28 +02:00
|
|
|
#include "builddirparameters.h"
|
2020-04-03 11:43:29 +02:00
|
|
|
#include "cmakebuildtarget.h"
|
|
|
|
|
#include "cmakeprojectnodes.h"
|
2021-09-01 19:49:08 +02:00
|
|
|
#include "fileapidataextractor.h"
|
2020-04-03 11:43:29 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/rawprojectpart.h>
|
2021-06-16 11:33:35 +02:00
|
|
|
#include <projectexplorer/treescanner.h>
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-05-13 12:59:23 +02:00
|
|
|
#include <utils/filesystemwatcher.h>
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2022-07-08 17:07:33 +02:00
|
|
|
#include <QDateTime>
|
2019-06-13 14:24:04 +02:00
|
|
|
#include <QFuture>
|
2020-04-03 11:43:29 +02:00
|
|
|
#include <QObject>
|
2020-04-17 15:30:05 +02:00
|
|
|
|
2021-05-31 13:38:41 +02:00
|
|
|
#include <memory>
|
2022-08-26 10:30:00 +02:00
|
|
|
#include <optional>
|
2021-05-31 13:38:41 +02:00
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
namespace ProjectExplorer { class ProjectNode; }
|
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
|
|
|
|
2022-05-14 02:27:28 +02:00
|
|
|
class CMakeProcess;
|
2019-06-13 14:24:04 +02:00
|
|
|
class FileApiQtcData;
|
|
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
class FileApiReader final : public QObject
|
2019-06-13 14:24:04 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
FileApiReader();
|
2020-04-03 11:43:29 +02:00
|
|
|
~FileApiReader();
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
void setParameters(const BuildDirParameters &p);
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
void resetData();
|
2020-04-02 14:49:05 +02:00
|
|
|
void parse(bool forceCMakeRun, bool forceInitialConfiguration, bool forceExtraConfiguration);
|
2020-04-03 11:43:29 +02:00
|
|
|
void stop();
|
2021-12-22 15:18:00 +01:00
|
|
|
void stopCMakeRun();
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
bool isParsing() const;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
QSet<Utils::FilePath> projectFilesToWatch() const;
|
|
|
|
|
QList<CMakeBuildTarget> takeBuildTargets(QString &errorMessage);
|
|
|
|
|
CMakeConfig takeParsedConfiguration(QString &errorMessage);
|
2020-09-28 15:10:04 +02:00
|
|
|
QString ctestPath() const;
|
2020-04-03 11:43:29 +02:00
|
|
|
ProjectExplorer::RawProjectParts createRawProjectParts(QString &errorMessage);
|
|
|
|
|
|
2021-01-14 16:38:55 +01:00
|
|
|
bool isMultiConfig() const;
|
|
|
|
|
bool usesAllCapsTargets() const;
|
|
|
|
|
|
2021-09-21 22:22:37 +02:00
|
|
|
int lastCMakeExitCode() const;
|
|
|
|
|
|
2021-09-27 17:26:40 +02:00
|
|
|
std::unique_ptr<CMakeProjectNode> rootProjectNode();
|
|
|
|
|
|
|
|
|
|
Utils::FilePath topCmakeFile() const;
|
|
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
signals:
|
|
|
|
|
void configurationStarted() const;
|
2021-09-21 22:22:37 +02:00
|
|
|
void dataAvailable(bool restoredFromBackup) const;
|
2020-04-03 11:43:29 +02:00
|
|
|
void dirty() const;
|
|
|
|
|
void errorOccurred(const QString &message) const;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void startState();
|
2021-09-21 22:22:37 +02:00
|
|
|
void endState(const Utils::FilePath &replyFilePath, bool restoredFromBackup);
|
2019-06-13 14:24:04 +02:00
|
|
|
void startCMakeState(const QStringList &configurationArguments);
|
2021-06-08 13:40:45 +02:00
|
|
|
void cmakeFinishedState();
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-05-13 12:59:23 +02:00
|
|
|
void replyDirectoryHasChanged(const QString &directory) const;
|
2021-02-04 16:22:40 +01:00
|
|
|
void makeBackupConfiguration(bool store);
|
2020-05-13 12:59:23 +02:00
|
|
|
|
2021-05-28 12:02:18 +02:00
|
|
|
void writeConfigurationIntoBuildDirectory(const QStringList &configuration);
|
|
|
|
|
|
2019-06-13 14:24:04 +02:00
|
|
|
std::unique_ptr<CMakeProcess> m_cmakeProcess;
|
|
|
|
|
|
|
|
|
|
// cmake data:
|
|
|
|
|
CMakeConfig m_cache;
|
2021-09-01 19:49:08 +02:00
|
|
|
QSet<CMakeFileInfo> m_cmakeFiles;
|
2019-06-13 14:24:04 +02:00
|
|
|
QList<CMakeBuildTarget> m_buildTargets;
|
2019-08-28 18:22:45 +02:00
|
|
|
ProjectExplorer::RawProjectParts m_projectParts;
|
2019-06-13 14:24:04 +02:00
|
|
|
std::unique_ptr<CMakeProjectNode> m_rootProjectNode;
|
2020-09-28 15:10:04 +02:00
|
|
|
QString m_ctestPath;
|
2021-01-14 16:38:55 +01:00
|
|
|
bool m_isMultiConfig = false;
|
|
|
|
|
bool m_usesAllCapsTargets = false;
|
2020-09-28 15:10:04 +02:00
|
|
|
int m_lastCMakeExitCode = 0;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2022-08-26 10:30:00 +02:00
|
|
|
std::optional<QFuture<std::shared_ptr<FileApiQtcData>>> m_future;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
// Update related:
|
|
|
|
|
bool m_isParsing = false;
|
2020-04-03 11:43:29 +02:00
|
|
|
BuildDirParameters m_parameters;
|
2020-05-13 12:59:23 +02:00
|
|
|
|
|
|
|
|
// Notification on changes outside of creator:
|
|
|
|
|
Utils::FileSystemWatcher m_watcher;
|
|
|
|
|
QDateTime m_lastReplyTimestamp;
|
2019-06-13 14:24:04 +02:00
|
|
|
};
|
|
|
|
|
|
2022-09-29 15:26:31 +02:00
|
|
|
} // CMakeProjectManager::Internal
|