2013-01-30 18:19:31 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2013-01-30 18:19:31 +01:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
|
**
|
|
|
|
|
** 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 Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** 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.
|
2013-01-30 18:19:31 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QBSPROJECT_H
|
|
|
|
|
#define QBSPROJECT_H
|
|
|
|
|
|
|
|
|
|
#include "qbsprojectmanager.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/projectnodes.h>
|
|
|
|
|
#include <projectexplorer/task.h>
|
|
|
|
|
|
2013-06-06 18:30:17 +02:00
|
|
|
#include <utils/environment.h>
|
|
|
|
|
|
2014-07-10 17:01:54 +02:00
|
|
|
#include <qbs.h>
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <QFuture>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
|
|
|
|
namespace Core { class IDocument; }
|
|
|
|
|
namespace ProjectExplorer { class BuildConfiguration; }
|
|
|
|
|
|
|
|
|
|
namespace QbsProjectManager {
|
|
|
|
|
namespace Internal {
|
2014-07-18 15:46:24 +02:00
|
|
|
class QbsBaseProjectNode;
|
2013-01-30 18:19:31 +01:00
|
|
|
class QbsProjectNode;
|
2014-07-10 17:01:54 +02:00
|
|
|
class QbsRootProjectNode;
|
2014-06-16 14:42:21 +02:00
|
|
|
class QbsProjectParser;
|
2013-01-30 18:19:31 +01:00
|
|
|
class QbsBuildConfiguration;
|
|
|
|
|
|
|
|
|
|
class QbsProject : public ProjectExplorer::Project
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
QbsProject(QbsManager *manager, const QString &filename);
|
|
|
|
|
~QbsProject();
|
|
|
|
|
|
|
|
|
|
QString displayName() const;
|
|
|
|
|
Core::IDocument *document() const;
|
|
|
|
|
QbsManager *projectManager() const;
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::ProjectNode *rootProjectNode() const;
|
|
|
|
|
|
|
|
|
|
QStringList files(FilesMode fileMode) const;
|
|
|
|
|
|
2014-07-24 12:18:29 +02:00
|
|
|
bool isProjectEditable() const;
|
2014-07-18 15:46:24 +02:00
|
|
|
bool addFilesToProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
|
|
|
|
|
const qbs::ProductData &productData, const qbs::GroupData &groupData,
|
|
|
|
|
QStringList *notAdded);
|
|
|
|
|
bool removeFilesFromProduct(QbsBaseProjectNode *node, const QStringList &filePaths,
|
|
|
|
|
const qbs::ProductData &productData, const qbs::GroupData &groupData,
|
|
|
|
|
QStringList *notRemoved);
|
2014-09-11 17:12:03 +02:00
|
|
|
bool renameFileInProduct(QbsBaseProjectNode *node, const QString &oldPath,
|
|
|
|
|
const QString &newPath, const qbs::ProductData &productData,
|
|
|
|
|
const qbs::GroupData &groupData);
|
2014-07-18 15:46:24 +02:00
|
|
|
|
2013-06-10 15:40:18 +02:00
|
|
|
qbs::BuildJob *build(const qbs::BuildOptions &opts, QStringList products = QStringList());
|
2013-02-28 13:06:15 +01:00
|
|
|
qbs::CleanJob *clean(const qbs::CleanOptions &opts);
|
2013-04-12 16:19:52 +02:00
|
|
|
qbs::InstallJob *install(const qbs::InstallOptions &opts);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
static ProjectExplorer::FileType fileTypeFor(const QSet<QString> &tags);
|
|
|
|
|
|
|
|
|
|
QString profileForTarget(const ProjectExplorer::Target *t) const;
|
|
|
|
|
bool isParsing() const;
|
|
|
|
|
bool hasParseResult() const;
|
2014-07-17 12:02:56 +02:00
|
|
|
void parseCurrentBuildConfiguration();
|
2014-07-11 12:44:12 +02:00
|
|
|
void scheduleParsing() { m_parsingScheduled = true; }
|
|
|
|
|
bool parsingScheduled() const { return m_parsingScheduled; }
|
2014-07-14 14:22:27 +02:00
|
|
|
void cancelParsing();
|
2014-07-11 12:44:12 +02:00
|
|
|
void updateAfterBuild();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-06-16 14:42:21 +02:00
|
|
|
void registerQbsProjectParser(QbsProjectParser *p);
|
|
|
|
|
|
2014-05-02 11:44:32 +02:00
|
|
|
static Utils::FileName defaultBuildDirectory(const QString &projectFilePath,
|
|
|
|
|
const ProjectExplorer::Kit *k,
|
|
|
|
|
const QString &bcName);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2013-09-06 18:02:46 +02:00
|
|
|
qbs::Project qbsProject() const;
|
2014-07-22 09:49:51 +02:00
|
|
|
qbs::ProjectData qbsProjectData() const;
|
2013-04-16 13:14:07 +02:00
|
|
|
|
2013-05-06 11:16:41 +02:00
|
|
|
bool needsSpecialDeployment() const;
|
2014-06-16 14:42:21 +02:00
|
|
|
void generateErrors(const qbs::ErrorInfo &e);
|
2013-05-06 11:16:41 +02:00
|
|
|
|
2014-09-05 12:08:15 +02:00
|
|
|
static QString productDisplayName(const qbs::Project &project,
|
|
|
|
|
const qbs::ProductData &product);
|
|
|
|
|
static QString uniqueProductName(const qbs::ProductData &product);
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
public slots:
|
|
|
|
|
void invalidate();
|
2013-06-06 18:45:53 +02:00
|
|
|
void delayParsing();
|
2014-06-24 12:06:13 +02:00
|
|
|
void readQbsData();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void projectParsingStarted();
|
|
|
|
|
void projectParsingDone(bool);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void handleQbsParsingDone(bool success);
|
|
|
|
|
|
|
|
|
|
void targetWasAdded(ProjectExplorer::Target *t);
|
|
|
|
|
void changeActiveTarget(ProjectExplorer::Target *t);
|
|
|
|
|
void buildConfigurationChanged(ProjectExplorer::BuildConfiguration *bc);
|
2013-11-26 16:19:43 +01:00
|
|
|
void startParsing();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool fromMap(const QVariantMap &map);
|
|
|
|
|
|
2013-06-06 18:30:17 +02:00
|
|
|
void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
void prepareForParsing();
|
2013-06-18 15:52:29 +02:00
|
|
|
void updateDocuments(const QSet<QString> &files);
|
2014-09-11 13:58:47 +02:00
|
|
|
void updateCppCodeModel();
|
|
|
|
|
void updateQmlJsCodeModel();
|
2014-09-05 12:08:15 +02:00
|
|
|
void updateApplicationTargets();
|
|
|
|
|
void updateDeploymentInfo();
|
2014-07-11 12:44:12 +02:00
|
|
|
void updateBuildTargetData();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-08-18 16:30:43 +02:00
|
|
|
static bool ensureWriteableQbsFile(const QString &file);
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
QbsManager *const m_manager;
|
|
|
|
|
const QString m_projectName;
|
|
|
|
|
const QString m_fileName;
|
2014-07-10 17:01:54 +02:00
|
|
|
qbs::Project m_qbsProject;
|
2014-07-17 12:33:03 +02:00
|
|
|
qbs::ProjectData m_projectData;
|
2013-01-30 18:19:31 +01:00
|
|
|
QSet<Core::IDocument *> m_qbsDocuments;
|
2014-07-10 17:01:54 +02:00
|
|
|
QbsRootProjectNode *m_rootProjectNode;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-06-16 14:42:21 +02:00
|
|
|
QbsProjectParser *m_qbsProjectParser;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
2014-06-16 14:42:21 +02:00
|
|
|
QFutureInterface<bool> *m_qbsUpdateFutureInterface;
|
2014-07-11 12:44:12 +02:00
|
|
|
bool m_parsingScheduled;
|
2014-07-14 14:22:27 +02:00
|
|
|
|
|
|
|
|
enum CancelStatus {
|
|
|
|
|
CancelStatusNone,
|
|
|
|
|
CancelStatusCancelingForReparse,
|
|
|
|
|
CancelStatusCancelingAltoghether
|
|
|
|
|
} m_cancelStatus;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
QFuture<void> m_codeModelFuture;
|
|
|
|
|
|
|
|
|
|
QbsBuildConfiguration *m_currentBc;
|
2013-06-06 18:45:53 +02:00
|
|
|
|
|
|
|
|
QTimer m_parsingDelay;
|
2013-01-30 18:19:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QbsProjectManager
|
|
|
|
|
|
|
|
|
|
#endif // QBSPROJECT_H
|