2019-06-13 14:24:04 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 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
|
|
|
|
|
|
2020-04-03 11:43:29 +02:00
|
|
|
#include "cmakebuildtarget.h"
|
2019-06-13 14:24:04 +02:00
|
|
|
#include "cmakeprocess.h"
|
2020-04-03 11:43:29 +02:00
|
|
|
#include "cmakeprojectnodes.h"
|
|
|
|
|
#include "fileapiparser.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/rawprojectpart.h>
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
#include <utils/optional.h>
|
|
|
|
|
|
|
|
|
|
#include <QFuture>
|
2020-04-03 11:43:29 +02:00
|
|
|
#include <QObject>
|
2019-06-13 14:24:04 +02:00
|
|
|
|
2020-04-17 15:30:05 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2019-06-13 14:24:04 +02:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class ProjectNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
void parse(bool forceCMakeRun, bool forceConfiguration);
|
|
|
|
|
void stop();
|
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);
|
2019-06-13 14:24:04 +02:00
|
|
|
std::unique_ptr<CMakeProjectNode> generateProjectTree(
|
2020-04-03 11:43:29 +02:00
|
|
|
const QList<const ProjectExplorer::FileNode *> &allFiles, QString &errorMessage);
|
|
|
|
|
ProjectExplorer::RawProjectParts createRawProjectParts(QString &errorMessage);
|
|
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void configurationStarted() const;
|
|
|
|
|
void dataAvailable() const;
|
|
|
|
|
void dirty() const;
|
|
|
|
|
void errorOccurred(const QString &message) const;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void startState();
|
|
|
|
|
void endState(const QFileInfo &replyFi);
|
|
|
|
|
void startCMakeState(const QStringList &configurationArguments);
|
|
|
|
|
void cmakeFinishedState(int code, QProcess::ExitStatus status);
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<CMakeProcess> m_cmakeProcess;
|
|
|
|
|
|
|
|
|
|
// cmake data:
|
|
|
|
|
CMakeConfig m_cache;
|
|
|
|
|
QSet<Utils::FilePath> m_cmakeFiles;
|
|
|
|
|
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;
|
2019-06-20 15:51:04 +02:00
|
|
|
QSet<Utils::FilePath> m_knownHeaders;
|
2019-06-13 14:24:04 +02:00
|
|
|
|
|
|
|
|
Utils::optional<QFuture<FileApiQtcData *>> m_future;
|
|
|
|
|
|
|
|
|
|
// Update related:
|
|
|
|
|
bool m_isParsing = false;
|
|
|
|
|
|
|
|
|
|
std::unique_ptr<FileApiParser> m_fileApi;
|
2020-04-03 11:43:29 +02:00
|
|
|
|
|
|
|
|
BuildDirParameters m_parameters;
|
2019-06-13 14:24:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CMakeProjectManager
|