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
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** 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>
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
#include <QFuture>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QVariantMap>
|
|
|
|
|
|
|
|
|
|
namespace qbs {
|
|
|
|
|
class BuildJob;
|
|
|
|
|
class CleanJob;
|
|
|
|
|
class Error;
|
|
|
|
|
class ProjectData;
|
|
|
|
|
class SetupProjectJob;
|
2013-07-23 14:10:35 +03:00
|
|
|
class CleanOptions;
|
|
|
|
|
class InstallJob;
|
|
|
|
|
class InstallOptions;
|
|
|
|
|
class Project;
|
|
|
|
|
class ErrorInfo;
|
|
|
|
|
class BuildOptions;
|
2013-01-30 18:19:31 +01:00
|
|
|
} // namespace qbs
|
|
|
|
|
|
|
|
|
|
namespace Core { class IDocument; }
|
|
|
|
|
namespace ProjectExplorer { class BuildConfiguration; }
|
|
|
|
|
|
|
|
|
|
namespace QbsProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class QbsProjectNode;
|
|
|
|
|
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;
|
|
|
|
|
|
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;
|
2013-11-26 16:19:43 +01:00
|
|
|
void parseCurrentBuildConfiguration(bool force);
|
2013-01-30 18:19:31 +01:00
|
|
|
|
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;
|
2013-06-21 15:09:01 +02:00
|
|
|
const qbs::ProjectData qbsProjectData() const;
|
2013-04-16 13:14:07 +02:00
|
|
|
|
2013-05-06 11:16:41 +02:00
|
|
|
bool needsSpecialDeployment() const;
|
|
|
|
|
|
2013-01-30 18:19:31 +01:00
|
|
|
public slots:
|
|
|
|
|
void invalidate();
|
2013-06-06 18:45:53 +02:00
|
|
|
void delayParsing();
|
2013-06-11 18:10:42 +02:00
|
|
|
void delayForcedParsing();
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
void projectParsingStarted();
|
|
|
|
|
void projectParsingDone(bool);
|
|
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void handleQbsParsingDone(bool success);
|
|
|
|
|
void handleQbsParsingProgress(int progress);
|
|
|
|
|
void handleQbsParsingTaskSetup(const QString &description, int maximumProgressValue);
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2013-06-18 12:06:11 +02:00
|
|
|
void generateErrors(const qbs::ErrorInfo &e);
|
2013-01-30 18:19:31 +01:00
|
|
|
void prepareForParsing();
|
2013-06-18 15:52:29 +02:00
|
|
|
void updateDocuments(const QSet<QString> &files);
|
2013-06-21 15:09:01 +02:00
|
|
|
void updateCppCodeModel(const qbs::ProjectData &prj);
|
|
|
|
|
void updateQmlJsCodeModel(const qbs::ProjectData &prj);
|
2013-09-02 10:12:37 +02:00
|
|
|
void updateApplicationTargets(const qbs::ProjectData &projectData);
|
2013-09-06 18:02:46 +02:00
|
|
|
void updateDeploymentInfo(const qbs::Project &project);
|
2014-02-25 16:39:09 +01:00
|
|
|
QString resourcesBaseDirectory() const;
|
|
|
|
|
QString pluginsBaseDirectory() const;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
QbsManager *const m_manager;
|
|
|
|
|
const QString m_projectName;
|
|
|
|
|
const QString m_fileName;
|
|
|
|
|
QSet<Core::IDocument *> m_qbsDocuments;
|
2013-05-16 16:24:37 +02:00
|
|
|
QbsProjectNode *m_rootProjectNode;
|
2013-01-30 18:19:31 +01:00
|
|
|
|
|
|
|
|
qbs::SetupProjectJob *m_qbsSetupProjectJob;
|
|
|
|
|
|
|
|
|
|
QFutureInterface<void> *m_qbsUpdateFutureInterface;
|
|
|
|
|
int m_currentProgressBase;
|
2013-06-11 18:10:42 +02:00
|
|
|
bool m_forceParsing;
|
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
|