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>
|
|
|
|
|
|
2021-10-12 17:32:48 +02:00
|
|
|
#include <utils/qtcprocess.h>
|
|
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QObject>
|
|
|
|
|
#include <QHash>
|
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();
|
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 dumpAllPlugins();
|
2021-10-12 17:32:48 +02:00
|
|
|
void qmlPluginTypeDumpDone(Utils::QtcProcess *process);
|
|
|
|
|
void qmlPluginTypeDumpError(Utils::QtcProcess *process);
|
2010-11-10 15:07:53 +01:00
|
|
|
void pluginChanged(const QString &pluginLibrary);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class Plugin {
|
|
|
|
|
public:
|
2021-10-12 18:00:17 +02:00
|
|
|
Utils::FilePath qmldirPath;
|
2010-11-10 15:07:53 +01:00
|
|
|
QString importPath;
|
|
|
|
|
QString importUri;
|
2011-02-08 13:29:21 +01:00
|
|
|
QString importVersion;
|
2021-10-28 15:02:33 +02:00
|
|
|
Utils::FilePaths typeInfoPaths;
|
2010-11-10 15:07:53 +01:00
|
|
|
};
|
|
|
|
|
|
2020-04-17 11:40:42 +02:00
|
|
|
class QmlTypeDescription {
|
|
|
|
|
public:
|
|
|
|
|
QStringList errors;
|
|
|
|
|
QStringList warnings;
|
|
|
|
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> objects;
|
|
|
|
|
QList<ModuleApiInfo> moduleApis;
|
|
|
|
|
QStringList dependencies;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DependencyInfo {
|
|
|
|
|
public:
|
|
|
|
|
QStringList errors;
|
|
|
|
|
QStringList warnings;
|
|
|
|
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> objects;
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-12 17:32:48 +02:00
|
|
|
void runQmlDump(const QmlJS::ModelManagerInterface::ProjectInfo &info, const QStringList &arguments,
|
|
|
|
|
const Utils::FilePath &importPath);
|
2010-11-10 15:07:53 +01:00
|
|
|
void dump(const Plugin &plugin);
|
2021-10-28 15:02:33 +02:00
|
|
|
QFuture<QmlTypeDescription> loadQmlTypeDescription(const Utils::FilePaths &path) const;
|
2016-02-26 17:28:30 +01:00
|
|
|
QString buildQmltypesPath(const QString &name) const;
|
2020-04-17 11:40:42 +02:00
|
|
|
|
2021-10-28 15:02:33 +02:00
|
|
|
QFuture<PluginDumper::DependencyInfo> loadDependencies(const Utils::FilePaths &dependencies,
|
|
|
|
|
QSharedPointer<QSet<Utils::FilePath> > visited) const;
|
2020-04-17 11:40:42 +02:00
|
|
|
|
2021-10-28 15:02:33 +02:00
|
|
|
void loadQmltypesFile(const Utils::FilePaths &qmltypesFilePaths,
|
2021-10-12 18:00:17 +02:00
|
|
|
const Utils::FilePath &libraryPath,
|
2011-06-28 12:01:56 +02:00
|
|
|
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();
|
2020-04-24 16:08:25 +02:00
|
|
|
void prepareLibraryInfo(LibraryInfo &libInfo,
|
2021-10-12 18:00:17 +02:00
|
|
|
const Utils::FilePath &libraryPath,
|
2020-04-24 16:08:25 +02:00
|
|
|
const QStringList &deps,
|
|
|
|
|
const QStringList &errors,
|
|
|
|
|
const QStringList &warnings,
|
|
|
|
|
const QList<ModuleApiInfo> &moduleApis,
|
|
|
|
|
QList<LanguageUtils::FakeMetaObject::ConstPtr> &objects);
|
2011-04-15 15:55:11 +02:00
|
|
|
|
2014-01-23 14:28:31 +01:00
|
|
|
ModelManagerInterface *m_modelManager;
|
2011-04-15 15:55:11 +02:00
|
|
|
Utils::FileSystemWatcher *m_pluginWatcher;
|
2021-10-12 18:00:17 +02:00
|
|
|
QHash<Utils::QtcProcess *, Utils::FilePath> m_runningQmldumps;
|
2010-11-10 15:07:53 +01:00
|
|
|
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
|