2018-08-13 11:15:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2018 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
|
|
|
|
|
|
2019-05-16 15:36:55 +02:00
|
|
|
#include "compilationdatabaseutils.h"
|
|
|
|
|
|
2019-04-18 10:18:44 +02:00
|
|
|
#include <projectexplorer/buildconfiguration.h>
|
2019-10-25 09:55:32 +02:00
|
|
|
#include <projectexplorer/buildsystem.h>
|
2018-08-13 11:15:27 +02:00
|
|
|
#include <projectexplorer/project.h>
|
2019-10-25 09:55:32 +02:00
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
#include <texteditor/texteditor.h>
|
2019-10-25 09:55:32 +02:00
|
|
|
|
2019-03-14 11:09:36 +01:00
|
|
|
#include <utils/filesystemwatcher.h>
|
2018-08-13 11:15:27 +02:00
|
|
|
|
|
|
|
|
#include <QFutureWatcher>
|
|
|
|
|
|
2019-05-16 15:36:55 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QTimer;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2019-10-28 17:15:38 +01:00
|
|
|
namespace CppTools { class CppProjectUpdater; }
|
|
|
|
|
namespace ProjectExplorer { class Kit; }
|
|
|
|
|
namespace Utils { class FileSystemWatcher; }
|
2018-10-30 10:31:34 +01:00
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
namespace CompilationDatabaseProjectManager {
|
|
|
|
|
namespace Internal {
|
2019-05-16 15:36:55 +02:00
|
|
|
class CompilationDbParser;
|
2018-08-13 11:15:27 +02:00
|
|
|
|
|
|
|
|
class CompilationDatabaseProject : public ProjectExplorer::Project
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2019-05-28 13:49:26 +02:00
|
|
|
explicit CompilationDatabaseProject(const Utils::FilePath &filename);
|
2019-10-25 09:55:32 +02:00
|
|
|
|
2018-10-30 10:31:34 +01:00
|
|
|
bool needsConfiguration() const override { return false; }
|
2018-08-13 11:15:27 +02:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
ProjectExplorer::Kit *kit() const { return m_kit.get(); }
|
|
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
private:
|
2019-10-25 09:55:32 +02:00
|
|
|
std::unique_ptr<ProjectExplorer::Kit> m_kit;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CompilationDatabaseBuildSystem : public ProjectExplorer::BuildSystem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit CompilationDatabaseBuildSystem(ProjectExplorer::Target *target);
|
|
|
|
|
~CompilationDatabaseBuildSystem();
|
|
|
|
|
|
|
|
|
|
void triggerParsing() final;
|
2019-04-12 14:49:59 +02:00
|
|
|
|
2019-03-14 15:34:14 +01:00
|
|
|
void reparseProject();
|
2019-10-28 17:15:38 +01:00
|
|
|
void updateDeploymentData();
|
2019-05-16 15:36:55 +02:00
|
|
|
void buildTreeAndProjectParts();
|
2018-10-30 10:31:34 +01:00
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
QFutureWatcher<void> m_parserWatcher;
|
|
|
|
|
std::unique_ptr<CppTools::CppProjectUpdater> m_cppCodeModelUpdater;
|
2019-05-16 15:36:55 +02:00
|
|
|
MimeBinaryCache m_mimeBinaryCache;
|
2019-10-22 09:43:24 +02:00
|
|
|
QByteArray m_projectFileHash;
|
2019-05-16 15:36:55 +02:00
|
|
|
QTimer * const m_parseDelay;
|
|
|
|
|
CompilationDbParser *m_parser = nullptr;
|
2019-10-28 17:15:38 +01:00
|
|
|
Utils::FileSystemWatcher * const m_deployFileWatcher;
|
2018-08-13 11:15:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CompilationDatabaseEditorFactory : public TextEditor::TextEditorFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
CompilationDatabaseEditorFactory();
|
|
|
|
|
};
|
|
|
|
|
|
2019-04-18 10:18:44 +02:00
|
|
|
class CompilationDatabaseBuildConfigurationFactory
|
|
|
|
|
: public ProjectExplorer::BuildConfigurationFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
CompilationDatabaseBuildConfigurationFactory();
|
|
|
|
|
|
2019-06-27 10:22:13 +02:00
|
|
|
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
|
|
|
|
|
const Utils::FilePath &projectPath,
|
|
|
|
|
bool forSetup) const override;
|
2019-04-18 10:18:44 +02:00
|
|
|
};
|
|
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CompilationDatabaseProjectManager
|