qmldump: Use the new qmldump correctly.

This commit is contained in:
Christian Kamm
2011-02-08 13:29:21 +01:00
parent 2ec429e8ce
commit c935fd36d7
6 changed files with 20 additions and 11 deletions

View File

@@ -291,7 +291,8 @@ ObjectValue *Link::importNonFile(Document::Ptr doc, const ImportInfo &importInfo
if (libraryInfo.dumpStatus() == LibraryInfo::DumpNotStartedOrRunning) { if (libraryInfo.dumpStatus() == LibraryInfo::DumpNotStartedOrRunning) {
ModelManagerInterface *modelManager = ModelManagerInterface::instance(); ModelManagerInterface *modelManager = ModelManagerInterface::instance();
if (modelManager) if (modelManager)
modelManager->loadPluginTypes(libraryPath, importPath, packageName); modelManager->loadPluginTypes(libraryPath, importPath,
packageName, version.toString());
warning(doc, locationFromRange(importInfo.ast()->firstSourceLocation(), warning(doc, locationFromRange(importInfo.ast()->firstSourceLocation(),
importInfo.ast()->lastSourceLocation()), importInfo.ast()->lastSourceLocation()),
tr("Library contains C++ plugins, type dump is in progress.")); tr("Library contains C++ plugins, type dump is in progress."));

View File

@@ -131,7 +131,8 @@ public:
virtual QStringList importPaths() const = 0; virtual QStringList importPaths() const = 0;
virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri) = 0; virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri, const QString &importVersion) = 0;
virtual CppQmlTypeHash cppQmlTypes() const = 0; virtual CppQmlTypeHash cppQmlTypes() const = 0;

View File

@@ -571,9 +571,10 @@ void ModelManager::updateImportPaths()
updateSourceFiles(importedFiles, true); updateSourceFiles(importedFiles, true);
} }
void ModelManager::loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri) void ModelManager::loadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri, const QString &importVersion)
{ {
m_pluginDumper->loadPluginTypes(libraryPath, importPath, importUri); m_pluginDumper->loadPluginTypes(libraryPath, importPath, importUri, importVersion);
} }
void ModelManager::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc) void ModelManager::queueCppQmlTypeUpdate(const CPlusPlus::Document::Ptr &doc)

View File

@@ -83,7 +83,8 @@ public:
virtual QStringList importPaths() const; virtual QStringList importPaths() const;
virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri); virtual void loadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri, const QString &importVersion);
virtual CppQmlTypeHash cppQmlTypes() const; virtual CppQmlTypeHash cppQmlTypes() const;

View File

@@ -55,16 +55,17 @@ PluginDumper::PluginDumper(ModelManager *modelManager)
connect(m_pluginWatcher, SIGNAL(fileChanged(QString)), SLOT(pluginChanged(QString))); connect(m_pluginWatcher, SIGNAL(fileChanged(QString)), SLOT(pluginChanged(QString)));
} }
void PluginDumper::loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri) void PluginDumper::loadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
{ {
// move to the owning thread // move to the owning thread
metaObject()->invokeMethod(this, "onLoadPluginTypes", metaObject()->invokeMethod(this, "onLoadPluginTypes",
Q_ARG(QString, libraryPath), Q_ARG(QString, libraryPath),
Q_ARG(QString, importPath), Q_ARG(QString, importPath),
Q_ARG(QString, importUri)); Q_ARG(QString, importUri),
Q_ARG(QString, importVersion));
} }
void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri) void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
{ {
const QString canonicalLibraryPath = QDir::cleanPath(libraryPath); const QString canonicalLibraryPath = QDir::cleanPath(libraryPath);
if (m_runningQmldumps.values().contains(canonicalLibraryPath)) if (m_runningQmldumps.values().contains(canonicalLibraryPath))
@@ -87,6 +88,7 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &
plugin.qmldirPath = canonicalLibraryPath; plugin.qmldirPath = canonicalLibraryPath;
plugin.importPath = importPath; plugin.importPath = importPath;
plugin.importUri = importUri; plugin.importUri = importUri;
plugin.importVersion = importVersion;
// watch plugin libraries // watch plugin libraries
foreach (const QmlDirParser::Plugin &plugin, snapshot.libraryInfo(canonicalLibraryPath).plugins()) { foreach (const QmlDirParser::Plugin &plugin, snapshot.libraryInfo(canonicalLibraryPath).plugins()) {
@@ -277,8 +279,10 @@ void PluginDumper::dump(const Plugin &plugin)
connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int))); connect(process, SIGNAL(finished(int)), SLOT(qmlPluginTypeDumpDone(int)));
connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(qmlPluginTypeDumpError(QProcess::ProcessError))); connect(process, SIGNAL(error(QProcess::ProcessError)), SLOT(qmlPluginTypeDumpError(QProcess::ProcessError)));
QStringList args; QStringList args;
args << plugin.importPath; args << QLatin1String("--notrelocatable"); // ### temporary until relocatable libraries work
args << plugin.importUri; args << plugin.importUri;
args << plugin.importVersion;
args << plugin.importPath;
process->start(info.qmlDumpPath, args); process->start(info.qmlDumpPath, args);
m_runningQmldumps.insert(process, plugin.qmldirPath); m_runningQmldumps.insert(process, plugin.qmldirPath);
} }

View File

@@ -59,12 +59,12 @@ public:
public: public:
void loadPluginTypes(const QString &libraryPath, const QString &importPath, void loadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri); const QString &importUri, const QString &importVersion);
void scheduleCompleteRedump(); void scheduleCompleteRedump();
private slots: private slots:
void onLoadPluginTypes(const QString &libraryPath, const QString &importPath, void onLoadPluginTypes(const QString &libraryPath, const QString &importPath,
const QString &importUri); const QString &importUri, const QString &importVersion);
void dumpAllPlugins(); void dumpAllPlugins();
void qmlPluginTypeDumpDone(int exitCode); void qmlPluginTypeDumpDone(int exitCode);
void qmlPluginTypeDumpError(QProcess::ProcessError error); void qmlPluginTypeDumpError(QProcess::ProcessError error);
@@ -76,6 +76,7 @@ private:
QString qmldirPath; QString qmldirPath;
QString importPath; QString importPath;
QString importUri; QString importUri;
QString importVersion;
bool hasPredumpedQmlTypesFile() const; bool hasPredumpedQmlTypesFile() const;
QString predumpedQmlTypesFilePath() const; QString predumpedQmlTypesFilePath() const;