2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-11-10 15:07:53 +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:58:39 +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.
|
2010-11-10 15:07:53 +01:00
|
|
|
**
|
2016-01-15 14:58:39 +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 17:14:20 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-11-10 15:07:53 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-11-10 15:07:53 +01:00
|
|
|
|
2011-06-28 12:01:56 +02:00
|
|
|
#include <qmljs/qmljsmodelmanagerinterface.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QHash>
|
|
|
|
|
#include <QProcess>
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QDir;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Utils { class FileSystemWatcher; }
|
2010-11-10 15:07:53 +01:00
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
namespace QmlJS {
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
class PluginDumper : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2014-01-23 14:28:31 +01:00
|
|
|
explicit PluginDumper(ModelManagerInterface *modelManager);
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
public:
|
2011-06-28 12:01:56 +02:00
|
|
|
void loadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info);
|
2010-11-10 15:07:53 +01:00
|
|
|
void loadPluginTypes(const QString &libraryPath, const QString &importPath,
|
2011-02-08 13:29:21 +01:00
|
|
|
const QString &importUri, const QString &importVersion);
|
2011-06-28 12:01:56 +02:00
|
|
|
void scheduleRedumpPlugins();
|
|
|
|
|
void scheduleMaybeRedumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info);
|
2010-11-10 15:07:53 +01:00
|
|
|
|
2016-06-27 22:25:11 +03:00
|
|
|
private:
|
|
|
|
|
Q_INVOKABLE void onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::ProjectInfo &info,
|
|
|
|
|
bool force = false);
|
|
|
|
|
Q_INVOKABLE void onLoadPluginTypes(const QString &libraryPath, const QString &importPath,
|
|
|
|
|
const QString &importUri, const QString &importVersion);
|
|
|
|
|
Q_INVOKABLE void dumpBuiltins(const QmlJS::ModelManagerInterface::ProjectInfo &info);
|
|
|
|
|
Q_INVOKABLE void dumpAllPlugins();
|
2010-11-10 15:07:53 +01:00
|
|
|
void qmlPluginTypeDumpDone(int exitCode);
|
|
|
|
|
void qmlPluginTypeDumpError(QProcess::ProcessError error);
|
|
|
|
|
void pluginChanged(const QString &pluginLibrary);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class Plugin {
|
|
|
|
|
public:
|
|
|
|
|
QString qmldirPath;
|
|
|
|
|
QString importPath;
|
|
|
|
|
QString importUri;
|
2011-02-08 13:29:21 +01:00
|
|
|
QString importVersion;
|
2011-09-02 13:25:08 +02:00
|
|
|
QStringList typeInfoPaths;
|
2010-11-10 15:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
2016-01-20 12:38:56 +01:00
|
|
|
void runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &info, const QStringList &arguments, const QString &importPath);
|
2010-11-10 15:07:53 +01:00
|
|
|
void dump(const Plugin &plugin);
|
2016-02-26 17:28:30 +01:00
|
|
|
void loadQmlTypeDescription(const QStringList &path, QStringList &errors, QStringList &warnings,
|
|
|
|
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> &objects,
|
|
|
|
|
QList<ModuleApiInfo> *moduleApi,
|
|
|
|
|
QStringList *dependencies) const;
|
|
|
|
|
QString buildQmltypesPath(const QString &name) const;
|
|
|
|
|
void loadDependencies(const QStringList &dependencies,
|
|
|
|
|
QStringList &errors,
|
|
|
|
|
QStringList &warnings,
|
2016-07-13 16:38:36 +02:00
|
|
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> &objects,
|
|
|
|
|
QSet<QString> *visited=0) const;
|
2011-09-02 13:25:08 +02:00
|
|
|
void loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
2011-06-28 12:01:56 +02:00
|
|
|
const QString &libraryPath,
|
|
|
|
|
QmlJS::LibraryInfo libraryInfo);
|
2010-11-10 15:07:53 +01:00
|
|
|
QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
|
|
|
|
|
const QString &baseName);
|
|
|
|
|
QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
|
|
|
|
|
const QString &baseName, const QStringList &suffixes,
|
2010-11-11 14:21:04 +01:00
|
|
|
const QString &prefix = QString());
|
2010-11-10 15:07:53 +01:00
|
|
|
|
|
|
|
|
private:
|
2011-04-15 15:55:11 +02:00
|
|
|
Utils::FileSystemWatcher *pluginWatcher();
|
|
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
ModelManagerInterface *m_modelManager;
|
2011-04-15 15:55:11 +02:00
|
|
|
Utils::FileSystemWatcher *m_pluginWatcher;
|
2010-11-10 15:07:53 +01:00
|
|
|
QHash<QProcess *, QString> m_runningQmldumps;
|
|
|
|
|
QList<Plugin> m_plugins;
|
|
|
|
|
QHash<QString, int> m_libraryToPluginIndex;
|
2011-06-28 12:01:56 +02:00
|
|
|
QHash<QString, QmlJS::ModelManagerInterface::ProjectInfo> m_qtToInfo;
|
2010-11-10 15:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
} // namespace QmlJS
|