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"
|
2016-01-08 11:31:06 +01:00
|
|
|
#include "qmakeprojectmanager.h"
|
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
|
|
|
|
2010-03-17 17:45:33 +01:00
|
|
|
#include <projectexplorer/project.h>
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QFutureInterface>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QFuture>
|
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
|
|
|
|
|
|
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 {
|
2013-10-16 14:00:45 +02:00
|
|
|
class QmakeBuildConfiguration;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-08-10 16:27:35 +02:00
|
|
|
namespace Internal {
|
2011-08-18 16:46:44 +02:00
|
|
|
class CentralizedFolderWatcher;
|
2016-01-08 11:09:37 +01:00
|
|
|
class QmakeProjectFile;
|
2013-10-29 14:22:31 +01:00
|
|
|
class QmakeProjectFiles;
|
2013-10-29 15:15:10 +01:00
|
|
|
class QmakeProjectConfigWidget;
|
2010-08-10 16:27:35 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-29 15:58:10 +01:00
|
|
|
class QMAKEPROJECTMANAGER_EXPORT QmakeProject : public ProjectExplorer::Project
|
2008-12-02 12:01:29 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2013-10-29 15:15:10 +01:00
|
|
|
QmakeProject(QmakeManager *manager, const QString &proFile);
|
2017-01-30 15:04:20 +01:00
|
|
|
~QmakeProject() final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
QString displayName() const final;
|
|
|
|
|
QmakeManager *projectManager() const final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMesage) const final;
|
2009-10-09 18:14:12 +02:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
QmakeProFileNode *rootProjectNode() const final;
|
2015-02-02 00:37:38 +02:00
|
|
|
bool validParse(const Utils::FileName &proFilePath) const;
|
|
|
|
|
bool parseInProgress(const Utils::FileName &proFilePath) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
virtual QStringList files(FilesMode fileMode) const final;
|
|
|
|
|
virtual QStringList filesGeneratedFrom(const QString &file) const final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-06-18 19:12:48 +02:00
|
|
|
enum Parsing {ExactParse, ExactAndCumulativeParse };
|
2017-02-09 13:56:22 +01:00
|
|
|
QList<QmakeProFileNode *> allProFiles(const QList<ProjectType> &projectTypes = QList<ProjectType>(),
|
2014-06-04 12:50:10 +02:00
|
|
|
Parsing parse = ExactParse) const;
|
2013-10-29 14:22:31 +01:00
|
|
|
QList<QmakeProFileNode *> applicationProFiles(Parsing parse = ExactParse) const;
|
2015-02-02 00:37:38 +02:00
|
|
|
bool hasApplicationProFile(const Utils::FileName &path) const;
|
2014-06-04 13:11:25 +02:00
|
|
|
|
2014-06-12 16:24:52 +02:00
|
|
|
static QList<QmakeProFileNode *> nodesWithQtcRunnable(QList<QmakeProFileNode *> nodes);
|
2014-07-01 11:08:26 +02:00
|
|
|
static QList<Core::Id> idsForNodes(Core::Id base, const QList<QmakeProFileNode *> &nodes);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2015-02-02 00:37:38 +02:00
|
|
|
void notifyChanged(const Utils::FileName &name);
|
2008-12-02 18:14:06 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2017-02-10 11:52:35 +01:00
|
|
|
QtSupport::ProFileReader *createProFileReader(const QmakeProFileNode *qmakeProFileNode,
|
|
|
|
|
QmakeBuildConfiguration *bc = nullptr);
|
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);
|
2009-12-07 20:49:39 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2014-10-24 12:43:14 +02:00
|
|
|
void scheduleAsyncUpdate(QmakeProjectManager::QmakeProFileNode *node,
|
2017-02-10 11:57:10 +01:00
|
|
|
QmakeParserProFileNode::AsyncUpdateDelay delay = QmakeParserProFileNode::ParseLater);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
|
|
|
|
void incrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
|
|
|
|
void decrementPendingEvaluateFutures();
|
|
|
|
|
/// \internal
|
|
|
|
|
bool wasEvaluateCanceled();
|
|
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
// For QmakeProFileNode after a on disk change
|
2010-11-04 14:02:45 +01:00
|
|
|
void updateFileList();
|
2011-09-15 12:15:10 +02:00
|
|
|
void updateCodeModels();
|
2010-10-27 16:27:22 +02:00
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
void watchFolders(const QStringList &l, QmakePriFileNode *node);
|
|
|
|
|
void unwatchFolders(const QStringList &l, QmakePriFileNode *node);
|
2011-08-18 16:46:44 +02:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
bool needsConfiguration() const final;
|
2011-10-28 10:15:04 +00:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
void configureAsExampleProject(const QSet<Core::Id> &platforms) final;
|
2012-03-06 13:14:42 +01:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
bool requiresTargetPanel() const final;
|
2012-09-06 16:19:14 +02:00
|
|
|
|
2012-05-09 12:44:37 +02:00
|
|
|
/// \internal
|
2015-02-02 00:37:38 +02:00
|
|
|
QString disabledReasonForRunConfiguration(const Utils::FileName &proFilePath);
|
2012-05-09 12:44:37 +02:00
|
|
|
|
2012-04-24 15:49:09 +02:00
|
|
|
/// used by the default implementation of shadowBuildDirectory
|
2012-09-09 20:41:30 +03:00
|
|
|
static QString buildNameFor(const ProjectExplorer::Kit *k);
|
2012-04-24 15:49:09 +02:00
|
|
|
|
2012-07-13 17:14:42 +02:00
|
|
|
void emitBuildDirectoryInitialized();
|
2013-09-26 18:38:44 +02:00
|
|
|
static void proFileParseError(const QString &errorMessage);
|
2012-07-13 17:14:42 +02:00
|
|
|
|
2017-01-30 15:04:20 +01:00
|
|
|
ProjectExplorer::ProjectImporter *projectImporter() const final;
|
2013-08-13 10:52:57 +02:00
|
|
|
|
2014-11-18 17:05:09 +01:00
|
|
|
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
|
|
|
|
|
AsyncUpdateState asyncUpdateState() const;
|
|
|
|
|
|
2017-01-27 14:28:49 +01:00
|
|
|
QString mapProFilePathToTarget(const Utils::FileName &proFilePath);
|
|
|
|
|
|
2009-06-22 15:51:21 +02:00
|
|
|
signals:
|
2013-10-29 14:22:31 +01:00
|
|
|
void proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool, bool);
|
2012-07-13 17:14:42 +02:00
|
|
|
void buildDirectoryInitialized();
|
2012-07-17 15:56:43 +02:00
|
|
|
void proFilesEvaluated();
|
2009-06-22 15:51:21 +02:00
|
|
|
|
2016-05-24 23:21:57 +03:00
|
|
|
public:
|
2017-02-10 11:57:10 +01:00
|
|
|
void scheduleAsyncUpdate(QmakeParserProFileNode::AsyncUpdateDelay delay = QmakeParserProFileNode::ParseLater);
|
2015-02-01 18:44:47 +02:00
|
|
|
void scheduleAsyncUpdateLater() { scheduleAsyncUpdate(); }
|
2010-03-10 16:55:37 +01:00
|
|
|
|
|
|
|
|
protected:
|
2017-01-30 15:04:20 +01:00
|
|
|
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) final;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-01-07 18:01:04 +01:00
|
|
|
private:
|
2010-03-10 16:55:37 +01:00
|
|
|
void asyncUpdate();
|
2013-05-29 20:18:51 +02:00
|
|
|
void buildFinished(bool success);
|
2010-03-10 16:55:37 +01:00
|
|
|
void activeTargetWasChanged();
|
|
|
|
|
|
2016-11-02 12:10:18 +01:00
|
|
|
void setAllBuildConfigurationsEnabled(bool enabled);
|
|
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
QString executableFor(const QmakeProFileNode *node);
|
2012-07-17 15:56:43 +02:00
|
|
|
void updateRunConfigurations();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-09-21 14:28:55 +02:00
|
|
|
void updateCppCodeModel();
|
|
|
|
|
void updateQmlJSCodeModel();
|
2010-11-04 14:02:45 +01:00
|
|
|
|
2014-06-04 12:50:10 +02:00
|
|
|
static void collectAllProFiles(QList<QmakeProFileNode *> &list, QmakeProFileNode *node, Parsing parse,
|
2017-02-09 13:56:22 +01:00
|
|
|
const QList<ProjectType> &projectTypes);
|
2015-02-02 00:37:38 +02:00
|
|
|
static void findProFile(const Utils::FileName &fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list);
|
|
|
|
|
static bool hasSubNode(QmakePriFileNode *root, const Utils::FileName &path);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
static bool equalFileList(const QStringList &a, const QStringList &b);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-08-20 12:41:52 +02:00
|
|
|
void updateBuildSystemData();
|
2013-10-29 14:22:31 +01:00
|
|
|
void collectData(const QmakeProFileNode *node, ProjectExplorer::DeploymentData &deploymentData);
|
|
|
|
|
void collectApplicationData(const QmakeProFileNode *node,
|
2013-03-12 14:09:18 +01:00
|
|
|
ProjectExplorer::DeploymentData &deploymentData);
|
2013-10-29 14:22:31 +01:00
|
|
|
void collectLibraryData(const QmakeProFileNode *node,
|
2012-08-20 12:41:52 +02:00
|
|
|
ProjectExplorer::DeploymentData &deploymentData);
|
2017-02-10 11:57:10 +01:00
|
|
|
void startAsyncTimer(QmakeParserProFileNode::AsyncUpdateDelay delay);
|
2014-10-20 17:23:07 +02:00
|
|
|
bool matchesKit(const ProjectExplorer::Kit *kit);
|
2012-08-20 12:41:52 +02:00
|
|
|
|
2016-09-23 15:53:31 +02:00
|
|
|
void warnOnToolChainMismatch(const QmakeProFileNode *pro) const;
|
|
|
|
|
void testToolChain(ProjectExplorer::ToolChain *tc, const Utils::FileName &path) const;
|
|
|
|
|
|
|
|
|
|
mutable QSet<const QPair<Utils::FileName, Utils::FileName>> m_toolChainWarnings;
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
// Current configuration
|
|
|
|
|
QString m_oldQtIncludePath;
|
|
|
|
|
QString m_oldQtLibsPath;
|
|
|
|
|
|
|
|
|
|
// cached lists of all of files
|
2015-06-18 15:14:06 +02:00
|
|
|
Internal::QmakeProjectFiles *m_projectFiles = nullptr;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
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
|
2016-10-21 20:23:07 +02:00
|
|
|
QMakeGlobals *m_qmakeGlobals = nullptr;
|
2015-06-18 15:14:06 +02:00
|
|
|
int m_qmakeGlobalsRefCnt = 0;
|
2010-03-10 16:55:37 +01:00
|
|
|
|
2016-10-21 20:23:07 +02:00
|
|
|
QString m_qmakeSysroot;
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
QTimer m_asyncUpdateTimer;
|
2015-06-18 15:14:06 +02:00
|
|
|
QFutureInterface<void> *m_asyncUpdateFutureInterface = nullptr;
|
|
|
|
|
int m_pendingEvaluateFuturesCount = 0;
|
|
|
|
|
AsyncUpdateState m_asyncUpdateState = Base;
|
|
|
|
|
bool m_cancelEvaluate = false;
|
2013-10-29 14:22:31 +01:00
|
|
|
QList<QmakeProFileNode *> m_partialEvaluate;
|
2009-05-04 18:22:40 +02:00
|
|
|
|
2010-03-02 12:51:47 +01:00
|
|
|
QFuture<void> m_codeModelFuture;
|
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
|
|
|
|
2015-06-18 15:14:06 +02:00
|
|
|
ProjectExplorer::Target *m_activeTarget = nullptr;
|
2016-10-05 08:31:16 +02:00
|
|
|
mutable ProjectExplorer::ProjectImporter *m_projectImporter = nullptr;
|
2012-07-17 15:56:43 +02:00
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
friend class Internal::QmakeProjectFile;
|
2013-10-29 15:15:10 +01:00
|
|
|
friend class Internal::QmakeProjectConfigWidget;
|
|
|
|
|
friend class QmakeManager; // to schedule a async update if the unconfigured settings change
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
2013-10-16 11:02:37 +02:00
|
|
|
} // namespace QmakeProjectManager
|