2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2008-12-02 12:01:29 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2009-02-25 09:15:00 +01:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2008-12-02 14:17:16 +01:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2008-12-02 16:19:05 +01:00
|
|
|
|
2013-10-16 12:10:22 +02:00
|
|
|
#ifndef QMAKEPROJECT_H
|
|
|
|
|
#define QMAKEPROJECT_H
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-10-16 12:10:22 +02:00
|
|
|
#include "qmakeprojectmanager_global.h"
|
2014-06-04 12:50:10 +02:00
|
|
|
#include "qmakenodes.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
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
|
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
|
2012-08-28 18:18:07 +02:00
|
|
|
class ProFileGlobals;
|
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;
|
2013-10-29 15:15:10 +01:00
|
|
|
class QmakeManager;
|
2013-10-29 14:22:31 +01:00
|
|
|
class QmakePriFileNode;
|
|
|
|
|
class QmakeProFileNode;
|
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;
|
2013-10-29 14:22:31 +01:00
|
|
|
class QmakeProjectFiles;
|
2013-10-29 15:15:10 +01:00
|
|
|
class QmakeProjectConfigWidget;
|
2013-10-29 14:22:31 +01:00
|
|
|
class QmakeProjectFile;
|
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);
|
2013-10-29 14:22:31 +01:00
|
|
|
virtual ~QmakeProject();
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-01-07 18:17:24 +01:00
|
|
|
QString displayName() const;
|
2012-02-14 16:43:51 +01:00
|
|
|
Core::IDocument *document() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
ProjectExplorer::IProjectManager *projectManager() const;
|
2013-10-29 17:37:39 +01:00
|
|
|
QmakeManager *qmakeProjectManager() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2012-09-20 11:16:47 +02:00
|
|
|
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMesage) const;
|
2009-10-09 18:14:12 +02:00
|
|
|
|
2011-08-18 16:46:44 +02:00
|
|
|
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProFileNode *rootQmakeProjectNode() const;
|
2010-10-27 16:27:22 +02:00
|
|
|
bool validParse(const QString &proFilePath) const;
|
2011-06-10 15:37:10 +02:00
|
|
|
bool parseInProgress(const QString &proFilePath) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
virtual QStringList files(FilesMode fileMode) const;
|
2009-12-03 16:23:15 +01:00
|
|
|
virtual QString generatedUiHeader(const QString &formFile) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-06-18 19:12:48 +02:00
|
|
|
enum Parsing {ExactParse, ExactAndCumulativeParse };
|
2014-06-04 12:50:10 +02:00
|
|
|
QList<QmakeProFileNode *> allProFiles(const QList<QmakeProjectType> &projectTypes = QList<QmakeProjectType>(),
|
|
|
|
|
Parsing parse = ExactParse) const;
|
2013-10-29 14:22:31 +01:00
|
|
|
QList<QmakeProFileNode *> applicationProFiles(Parsing parse = ExactParse) const;
|
2010-01-19 13:41:02 +01:00
|
|
|
bool hasApplicationProFile(const QString &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
|
|
|
|
2008-12-02 18:14:06 +01:00
|
|
|
void notifyChanged(const QString &name);
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2013-10-29 14:22:31 +01:00
|
|
|
QtSupport::ProFileReader *createProFileReader(const QmakeProFileNode *qmakeProFileNode, QmakeBuildConfiguration *bc = 0);
|
2010-03-10 16:55:37 +01:00
|
|
|
/// \internal
|
2012-08-28 18:18:07 +02:00
|
|
|
ProFileGlobals *qmakeGlobals();
|
2011-10-07 15:40:38 +02:00
|
|
|
/// \internal
|
2014-09-10 12:53:55 +02:00
|
|
|
QMakeVfs *qmakeVfs();
|
|
|
|
|
/// \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,
|
|
|
|
|
QmakeProFileNode::AsyncUpdateDelay delay = QmakeProFileNode::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
|
|
|
|
2011-10-28 10:15:04 +00:00
|
|
|
bool needsConfiguration() const;
|
|
|
|
|
|
2012-03-06 13:14:42 +01:00
|
|
|
void configureAsExampleProject(const QStringList &platforms);
|
|
|
|
|
|
2014-07-11 12:04:30 +02:00
|
|
|
bool requiresTargetPanel() const;
|
2012-09-06 16:19:14 +02:00
|
|
|
|
2012-05-09 12:44:37 +02:00
|
|
|
/// \internal
|
|
|
|
|
QString disabledReasonForRunConfiguration(const QString &proFilePath);
|
|
|
|
|
|
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
|
|
|
|
2013-08-13 10:52:57 +02:00
|
|
|
ProjectExplorer::ProjectImporter *createProjectImporter() const;
|
|
|
|
|
|
2014-11-18 17:05:09 +01:00
|
|
|
enum AsyncUpdateState { Base, AsyncFullUpdatePending, AsyncPartialUpdatePending, AsyncUpdateInProgress, ShuttingDown };
|
|
|
|
|
AsyncUpdateState asyncUpdateState() const;
|
|
|
|
|
|
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
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
public slots:
|
2014-10-24 12:43:14 +02:00
|
|
|
void scheduleAsyncUpdate(QmakeProFileNode::AsyncUpdateDelay delay = QmakeProFileNode::ParseLater);
|
2015-02-01 18:44:47 +02:00
|
|
|
void scheduleAsyncUpdateLater() { scheduleAsyncUpdate(); }
|
2010-03-10 16:55:37 +01:00
|
|
|
|
|
|
|
|
protected:
|
2012-04-24 15:49:09 +02:00
|
|
|
bool fromMap(const QVariantMap &map);
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
private slots:
|
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();
|
|
|
|
|
|
|
|
|
|
private:
|
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,
|
|
|
|
|
const QList<QmakeProjectManager::QmakeProjectType> &projectTypes);
|
2013-10-29 14:22:31 +01:00
|
|
|
static void findProFile(const QString& fileName, QmakeProFileNode *root, QList<QmakeProFileNode *> &list);
|
|
|
|
|
static bool hasSubNode(QmakePriFileNode *root, const QString &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);
|
2014-10-24 12:43:14 +02:00
|
|
|
void startAsyncTimer(QmakeProFileNode::AsyncUpdateDelay delay);
|
2014-10-20 17:23:07 +02:00
|
|
|
bool matchesKit(const ProjectExplorer::Kit *kit);
|
2012-08-20 12:41:52 +02:00
|
|
|
|
2013-10-29 15:15:10 +01:00
|
|
|
QmakeManager *m_manager;
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProFileNode *m_rootProjectNode;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
Internal::QmakeProjectFile *m_fileInfo;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
|
|
|
|
// Current configuration
|
|
|
|
|
QString m_oldQtIncludePath;
|
|
|
|
|
QString m_oldQtLibsPath;
|
|
|
|
|
|
|
|
|
|
// cached lists of all of files
|
2013-10-29 14:22:31 +01:00
|
|
|
Internal::QmakeProjectFiles *m_projectFiles;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2013-05-29 20:18:51 +02:00
|
|
|
QMakeVfs *m_qmakeVfs;
|
|
|
|
|
|
2010-03-10 16:55:37 +01:00
|
|
|
// cached data during project rescan
|
2012-08-28 18:18:07 +02:00
|
|
|
ProFileGlobals *m_qmakeGlobals;
|
2012-05-02 15:20:08 +02:00
|
|
|
int m_qmakeGlobalsRefCnt;
|
2010-03-10 16:55:37 +01:00
|
|
|
|
|
|
|
|
QTimer m_asyncUpdateTimer;
|
|
|
|
|
QFutureInterface<void> *m_asyncUpdateFutureInterface;
|
|
|
|
|
int m_pendingEvaluateFuturesCount;
|
|
|
|
|
AsyncUpdateState m_asyncUpdateState;
|
|
|
|
|
bool m_cancelEvaluate;
|
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
|
|
|
|
2011-08-18 16:46:44 +02:00
|
|
|
Internal::CentralizedFolderWatcher *m_centralizedFolderWatcher;
|
2010-08-10 16:27:35 +02:00
|
|
|
|
2012-07-17 15:56:43 +02:00
|
|
|
ProjectExplorer::Target *m_activeTarget;
|
2014-09-26 15:24:32 +02:00
|
|
|
bool m_checkForTemplateUpdate; // initialized to true, set to false after first parse
|
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
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-12-10 19:02:19 +01:00
|
|
|
|
2013-10-16 12:10:22 +02:00
|
|
|
#endif // QMAKEPROJECT_H
|