2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakeprojectmanager_global.h"
|
2020-03-19 18:36:22 +01:00
|
|
|
|
2014-06-04 12:50:10 +02:00
|
|
|
#include "qmakenodes.h"
|
2017-02-09 13:56:22 +01:00
|
|
|
#include "qmakeparsernodes.h"
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-04-12 14:49:59 +02:00
|
|
|
#include <projectexplorer/deploymentdata.h>
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2020-02-24 18:34:31 +01:00
|
|
|
#include <projectexplorer/toolchain.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QFutureInterface>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2016-10-21 20:23:07 +02:00
|
|
|
class QMakeGlobals;
|
2013-05-29 20:18:51 +02:00
|
|
|
class QMakeVfs;
|
2008-12-02 12:01:29 +01:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
namespace CppEditor { class CppProjectUpdater; }
|
2012-08-20 12:41:52 +02:00
|
|
|
namespace ProjectExplorer { class DeploymentData; }
|
2012-04-24 15:49:09 +02:00
|
|
|
namespace QtSupport { class ProFileReader; }
|
2011-05-20 21:40:53 +02:00
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
namespace QmakeProjectManager {
|
2020-03-19 18:36:22 +01:00
|
|
|
|
2020-02-18 15:55:26 +01:00
|
|
|
class QmakeBuildConfiguration;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-11-20 11:56:19 +01:00
|
|
|
namespace Internal { class CentralizedFolderWatcher; }
|
2010-08-10 16:27:35 +02:00
|
|
|
|
2020-01-29 04:15:25 +03:00
|
|
|
class QMAKEPROJECTMANAGER_EXPORT QmakeProject final : public ProjectExplorer::Project
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2019-05-28 13:49:26 +02:00
|
|
|
explicit QmakeProject(const Utils::FilePath &proFile);
|
2017-01-30 15:04:20 +01:00
|
|
|
~QmakeProject() final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-05-27 16:09:44 +02:00
|
|
|
ProjectExplorer::Tasks projectIssues(const ProjectExplorer::Kit *k) const final;
|
2009-10-09 18:14:12 +02:00
|
|
|
|
2020-06-16 13:11:10 +02:00
|
|
|
void configureAsExampleProject(ProjectExplorer::Kit *kit) final;
|
2019-10-25 09:55:32 +02:00
|
|
|
|
|
|
|
|
ProjectExplorer::ProjectImporter *projectImporter() const final;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
|
|
|
|
|
|
|
|
|
mutable ProjectExplorer::ProjectImporter *m_projectImporter = nullptr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// FIXME: This export here is only there to appease the current version
|
|
|
|
|
// of the appman plugin. This _will_ go away, one way or the other.
|
|
|
|
|
class QMAKEPROJECTMANAGER_EXPORT QmakeBuildSystem : public ProjectExplorer::BuildSystem
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit QmakeBuildSystem(QmakeBuildConfiguration *bc);
|
|
|
|
|
~QmakeBuildSystem();
|
|
|
|
|
|
|
|
|
|
bool supportsAction(ProjectExplorer::Node *context,
|
|
|
|
|
ProjectExplorer::ProjectAction action,
|
|
|
|
|
const ProjectExplorer::Node *node) const override;
|
|
|
|
|
|
|
|
|
|
bool addFiles(ProjectExplorer::Node *context,
|
2021-07-14 16:49:42 +02:00
|
|
|
const Utils::FilePaths &filePaths,
|
|
|
|
|
Utils::FilePaths *notAdded = nullptr) override;
|
2019-10-25 09:55:32 +02:00
|
|
|
ProjectExplorer::RemovedFilesFromProject removeFiles(ProjectExplorer::Node *context,
|
2021-07-14 16:49:42 +02:00
|
|
|
const Utils::FilePaths &filePaths,
|
|
|
|
|
Utils::FilePaths *notRemoved = nullptr) override;
|
2019-10-25 09:55:32 +02:00
|
|
|
bool deleteFiles(ProjectExplorer::Node *context,
|
2021-07-14 16:49:42 +02:00
|
|
|
const Utils::FilePaths &filePaths) override;
|
2019-10-25 09:55:32 +02:00
|
|
|
bool canRenameFile(ProjectExplorer::Node *context,
|
2021-06-11 14:34:34 +02:00
|
|
|
const Utils::FilePath &oldFilePath,
|
|
|
|
|
const Utils::FilePath &newFilePath) override;
|
2019-10-25 09:55:32 +02:00
|
|
|
bool renameFile(ProjectExplorer::Node *context,
|
2021-06-11 14:34:34 +02:00
|
|
|
const Utils::FilePath &oldFilePath,
|
|
|
|
|
const Utils::FilePath &newFilePath) override;
|
2019-10-25 09:55:32 +02:00
|
|
|
bool addDependencies(ProjectExplorer::Node *context,
|
|
|
|
|
const QStringList &dependencies) override;
|
|
|
|
|
void triggerParsing() final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2021-07-14 16:49:42 +02:00
|
|
|
Utils::FilePaths filesGeneratedFrom(const Utils::FilePath &file) const final;
|
2020-06-26 13:59:38 +02:00
|
|
|
QVariant additionalData(Utils::Id id) const final;
|
2019-10-25 09:55:32 +02:00
|
|
|
|
|
|
|
|
void asyncUpdate();
|
|
|
|
|
void buildFinished(bool success);
|
|
|
|
|
void activeTargetWasChanged(ProjectExplorer::Target *);
|
|
|
|
|
|
2021-06-17 12:21:23 +02:00
|
|
|
Utils::FilePath executableFor(const QmakeProFile *file);
|
2019-10-25 09:55:32 +02:00
|
|
|
|
|
|
|
|
void updateCppCodeModel();
|
|
|
|
|
void updateQmlJSCodeModel();
|
|
|
|
|
|
|
|
|
|
static bool equalFileList(const QStringList &a, const QStringList &b);
|
|
|
|
|
|
|
|
|
|
void updateBuildSystemData();
|
|
|
|
|
void collectData(const QmakeProFile *file, ProjectExplorer::DeploymentData &deploymentData);
|
|
|
|
|
void collectApplicationData(const QmakeProFile *file,
|
|
|
|
|
ProjectExplorer::DeploymentData &deploymentData);
|
|
|
|
|
void collectLibraryData(const QmakeProFile *file,
|
|
|
|
|
ProjectExplorer::DeploymentData &deploymentData);
|
|
|
|
|
void startAsyncTimer(QmakeProFile::AsyncUpdateDelay delay);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
void warnOnToolChainMismatch(const QmakeProFile *pro) const;
|
|
|
|
|
void testToolChain(ProjectExplorer::ToolChain *tc, const Utils::FilePath &path) const;
|
2008-12-02 18:14:06 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2017-03-01 15:14:29 +01:00
|
|
|
QtSupport::ProFileReader *createProFileReader(const QmakeProFile *qmakeProFile);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2016-10-21 20:23:07 +02:00
|
|
|
QMakeGlobals *qmakeGlobals();
|
2011-10-07 15:40:38 +02:00
|
|
|
/// \internal
|
2014-09-10 12:53:55 +02:00
|
|
|
QMakeVfs *qmakeVfs();
|
|
|
|
|
/// \internal
|
2016-10-21 20:23:07 +02:00
|
|
|
QString qmakeSysroot();
|
|
|
|
|
/// \internal
|
2011-05-20 21:40:53 +02:00
|
|
|
void destroyProFileReader(QtSupport::ProFileReader *reader);
|
2020-02-06 18:13:38 +01:00
|
|
|
void deregisterFromCacheManager();
|
2009-12-07 20:49:39 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2019-10-25 09:55:32 +02:00
|
|
|
void scheduleAsyncUpdateFile(QmakeProFile *file,
|
|
|
|
|
QmakeProFile::AsyncUpdateDelay delay = QmakeProFile::ParseLater);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
|
|
|
|
void incrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
2017-11-02 14:32:18 +01:00
|
|
|
void decrementPendingEvaluateFutures();
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
|
|
|
|
bool wasEvaluateCanceled();
|
|
|
|
|
|
2011-09-15 12:15:10 +02:00
|
|
|
void updateCodeModels();
|
2020-02-03 12:38:08 +01:00
|
|
|
void updateDocuments();
|
2010-10-27 16:27:22 +02:00
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
void watchFolders(const QStringList &l, QmakePriFile *file);
|
|
|
|
|
void unwatchFolders(const QStringList &l, QmakePriFile *file);
|
2011-08-18 16:46:44 +02:00
|
|
|
|
2020-11-27 14:36:32 +01:00
|
|
|
static void proFileParseError(const QString &errorMessage, const Utils::FilePath &filePath);
|
2012-07-13 17:14:42 +02:00
|
|
|
|
2014-11-18 17:05:09 +01:00
|
|
|
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
|
|
|
|
|
AsyncUpdateState asyncUpdateState() const;
|
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
QmakeProFile *rootProFile() const;
|
2018-08-20 14:03:01 +02:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
void notifyChanged(const Utils::FilePath &name);
|
2009-06-22 15:51:21 +02:00
|
|
|
|
2020-03-20 15:56:43 +01:00
|
|
|
enum Action { BUILD, REBUILD, CLEAN };
|
|
|
|
|
void buildHelper(Action action, bool isFileBuild,
|
|
|
|
|
QmakeProFileNode *profile,
|
|
|
|
|
ProjectExplorer::FileNode *buildableFile);
|
|
|
|
|
|
2020-03-20 14:55:49 +01:00
|
|
|
Utils::FilePath buildDir(const Utils::FilePath &proFilePath) const;
|
2020-03-19 18:36:22 +01:00
|
|
|
QmakeBuildConfiguration *qmakeBuildConfiguration() const;
|
|
|
|
|
|
2020-04-23 13:13:59 +02:00
|
|
|
void scheduleUpdateAllNowOrLater();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void scheduleUpdateAll(QmakeProFile::AsyncUpdateDelay delay);
|
|
|
|
|
void scheduleUpdateAllLater() { scheduleUpdateAll(QmakeProFile::ParseLater); }
|
|
|
|
|
|
2019-05-28 13:49:26 +02:00
|
|
|
mutable QSet<const QPair<Utils::FilePath, Utils::FilePath>> m_toolChainWarnings;
|
2016-09-23 15:53:31 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Current configuration
|
|
|
|
|
QString m_oldQtIncludePath;
|
|
|
|
|
QString m_oldQtLibsPath;
|
|
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
std::unique_ptr<QmakeProFile> m_rootProFile;
|
|
|
|
|
|
2015-06-18 15:14:06 +02:00
|
|
|
QMakeVfs *m_qmakeVfs = nullptr;
|
2013-05-29 20:18:51 +02:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
// cached data during project rescan
|
2017-11-24 13:32:20 +01:00
|
|
|
std::unique_ptr<QMakeGlobals> m_qmakeGlobals;
|
2015-06-18 15:14:06 +02:00
|
|
|
int m_qmakeGlobalsRefCnt = 0;
|
2018-04-13 15:36:24 +02:00
|
|
|
bool m_invalidateQmakeVfsContents = false;
|
2010-03-10 16:55:37 +01:00
|
|
|
|
2016-10-21 20:23:07 +02:00
|
|
|
QString m_qmakeSysroot;
|
|
|
|
|
|
2021-07-08 13:01:36 +02:00
|
|
|
std::unique_ptr<QFutureInterface<void>> m_asyncUpdateFutureInterface;
|
2015-06-18 15:14:06 +02:00
|
|
|
int m_pendingEvaluateFuturesCount = 0;
|
|
|
|
|
AsyncUpdateState m_asyncUpdateState = Base;
|
|
|
|
|
bool m_cancelEvaluate = false;
|
2017-02-10 11:16:18 +01:00
|
|
|
QList<QmakeProFile *> m_partialEvaluate;
|
2009-05-04 18:22:40 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
CppEditor::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
|
2009-12-03 18:37:27 +01:00
|
|
|
|
2015-06-18 15:14:06 +02:00
|
|
|
Internal::CentralizedFolderWatcher *m_centralizedFolderWatcher = nullptr;
|
2010-08-10 16:27:35 +02:00
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
ProjectExplorer::BuildSystem::ParseGuard m_guard;
|
|
|
|
|
bool m_firstParseNeeded = true;
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|