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>
|
2018-08-13 11:15:27 +02:00
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <texteditor/texteditor.h>
|
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
|
|
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
namespace CppTools {
|
|
|
|
|
class CppProjectUpdater;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-14 15:34:14 +01:00
|
|
|
namespace ProjectExplorer {
|
|
|
|
|
class Kit;
|
|
|
|
|
}
|
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:
|
|
|
|
|
explicit CompilationDatabaseProject(const Utils::FileName &filename);
|
|
|
|
|
~CompilationDatabaseProject() override;
|
2018-10-30 10:31:34 +01:00
|
|
|
bool needsConfiguration() const override { return false; }
|
2019-04-18 10:18:44 +02:00
|
|
|
bool needsBuildConfigurations() const override { return true; }
|
2018-08-13 11:15:27 +02:00
|
|
|
|
|
|
|
|
private:
|
2019-03-14 15:34:14 +01:00
|
|
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
|
2019-04-12 14:49:59 +02:00
|
|
|
|
2019-03-14 15:34:14 +01:00
|
|
|
void reparseProject();
|
2019-05-16 15:36:55 +02:00
|
|
|
void buildTreeAndProjectParts();
|
2019-04-11 12:42:13 +02:00
|
|
|
Utils::FileName rootPathFromSettings() const;
|
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;
|
2018-10-30 10:31:34 +01:00
|
|
|
std::unique_ptr<ProjectExplorer::Kit> m_kit;
|
2019-03-14 11:09:36 +01:00
|
|
|
Utils::FileSystemWatcher m_fileSystemWatcher;
|
2019-05-16 15:36:55 +02:00
|
|
|
MimeBinaryCache m_mimeBinaryCache;
|
|
|
|
|
QTimer * const m_parseDelay;
|
|
|
|
|
CompilationDbParser *m_parser = nullptr;
|
2019-03-14 11:09:36 +01:00
|
|
|
bool m_hasTarget = false;
|
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 CompilationDatabaseBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
CompilationDatabaseBuildConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
|
|
|
|
ProjectExplorer::NamedWidget *createConfigWidget() override;
|
|
|
|
|
BuildType buildType() const override;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void initialize(const ProjectExplorer::BuildInfo &info) override;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CompilationDatabaseBuildConfigurationFactory
|
|
|
|
|
: public ProjectExplorer::BuildConfigurationFactory
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
CompilationDatabaseBuildConfigurationFactory();
|
|
|
|
|
|
|
|
|
|
QList<ProjectExplorer::BuildInfo> availableBuilds(
|
|
|
|
|
const ProjectExplorer::Target *parent) const override;
|
|
|
|
|
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
|
|
|
|
|
const QString &projectPath) const override;
|
|
|
|
|
};
|
|
|
|
|
|
2018-08-13 11:15:27 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CompilationDatabaseProjectManager
|