forked from qt-creator/qt-creator
QmlJS: Proliferate FilePath use, part 2
Change-Id: I631df6ba5e782e2db9e03de4e5df843d15c19f37 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -632,6 +632,10 @@ LibraryInfo Snapshot::libraryInfo(const QString &path) const
|
|||||||
return _libraries.value(QDir::cleanPath(path));
|
return _libraries.value(QDir::cleanPath(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LibraryInfo Snapshot::libraryInfo(const Utils::FilePath &path) const
|
||||||
|
{
|
||||||
|
return _libraries.value(path.cleanPath().toString());
|
||||||
|
}
|
||||||
|
|
||||||
void ModuleApiInfo::addToHash(QCryptographicHash &hash) const
|
void ModuleApiInfo::addToHash(QCryptographicHash &hash) const
|
||||||
{
|
{
|
||||||
|
@@ -256,7 +256,8 @@ public:
|
|||||||
|
|
||||||
Document::Ptr document(const QString &fileName) const;
|
Document::Ptr document(const QString &fileName) const;
|
||||||
QList<Document::Ptr> documentsInDirectory(const QString &path) const;
|
QList<Document::Ptr> documentsInDirectory(const QString &path) const;
|
||||||
LibraryInfo libraryInfo(const QString &path) const;
|
LibraryInfo libraryInfo(const QString &path) const; // FIXME: Remove
|
||||||
|
LibraryInfo libraryInfo(const Utils::FilePath &path) const;
|
||||||
|
|
||||||
Document::MutablePtr documentFromSource(const QString &code,
|
Document::MutablePtr documentFromSource(const QString &code,
|
||||||
const QString &fileName,
|
const QString &fileName,
|
||||||
|
@@ -684,19 +684,19 @@ void ModelManagerInterface::updateDocument(const Document::Ptr &doc)
|
|||||||
emit documentUpdated(doc);
|
emit documentUpdated(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelManagerInterface::updateLibraryInfo(const QString &path, const LibraryInfo &info)
|
void ModelManagerInterface::updateLibraryInfo(const FilePath &path, const LibraryInfo &info)
|
||||||
{
|
{
|
||||||
if (!info.pluginTypeInfoError().isEmpty())
|
if (!info.pluginTypeInfoError().isEmpty())
|
||||||
qCDebug(qmljsLog) << "Dumping errors for " << path << ":" << info.pluginTypeInfoError();
|
qCDebug(qmljsLog) << "Dumping errors for " << path << ":" << info.pluginTypeInfoError();
|
||||||
|
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
m_validSnapshot.insertLibraryInfo(path, info);
|
m_validSnapshot.insertLibraryInfo(path.toString(), info);
|
||||||
m_newestSnapshot.insertLibraryInfo(path, info);
|
m_newestSnapshot.insertLibraryInfo(path.toString(), info);
|
||||||
}
|
}
|
||||||
// only emit if we got new useful information
|
// only emit if we got new useful information
|
||||||
if (info.isValid())
|
if (info.isValid())
|
||||||
emit libraryInfoUpdated(path, info);
|
emit libraryInfoUpdated(path.toString(), info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList filesInDirectoryForLanguages(const QString &path,
|
static QStringList filesInDirectoryForLanguages(const QString &path,
|
||||||
@@ -773,7 +773,7 @@ enum class LibraryStatus {
|
|||||||
Unknown
|
Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
static LibraryStatus libraryStatus(const QString &path, const Snapshot &snapshot,
|
static LibraryStatus libraryStatus(const FilePath &path, const Snapshot &snapshot,
|
||||||
QSet<QString> *newLibraries)
|
QSet<QString> *newLibraries)
|
||||||
{
|
{
|
||||||
if (path.isEmpty())
|
if (path.isEmpty())
|
||||||
@@ -782,7 +782,7 @@ static LibraryStatus libraryStatus(const QString &path, const Snapshot &snapshot
|
|||||||
const LibraryInfo &existingInfo = snapshot.libraryInfo(path);
|
const LibraryInfo &existingInfo = snapshot.libraryInfo(path);
|
||||||
if (existingInfo.isValid())
|
if (existingInfo.isValid())
|
||||||
return LibraryStatus::Accepted;
|
return LibraryStatus::Accepted;
|
||||||
if (newLibraries->contains(path))
|
if (newLibraries->contains(path.toString()))
|
||||||
return LibraryStatus::Accepted;
|
return LibraryStatus::Accepted;
|
||||||
// if we looked at the path before, done
|
// if we looked at the path before, done
|
||||||
return existingInfo.wasScanned()
|
return existingInfo.wasScanned()
|
||||||
@@ -790,7 +790,7 @@ static LibraryStatus libraryStatus(const QString &path, const Snapshot &snapshot
|
|||||||
: LibraryStatus::Unknown;
|
: LibraryStatus::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool findNewQmlApplicationInPath(const QString &path,
|
static bool findNewQmlApplicationInPath(const FilePath &path,
|
||||||
const Snapshot &snapshot,
|
const Snapshot &snapshot,
|
||||||
ModelManagerInterface *modelManager,
|
ModelManagerInterface *modelManager,
|
||||||
QSet<QString> *newLibraries)
|
QSet<QString> *newLibraries)
|
||||||
@@ -803,8 +803,8 @@ static bool findNewQmlApplicationInPath(const QString &path,
|
|||||||
|
|
||||||
QString qmltypesFile;
|
QString qmltypesFile;
|
||||||
|
|
||||||
QDir dir(path);
|
QDir dir(path.toString());
|
||||||
QDirIterator it(path, QStringList { "*.qmltypes" }, QDir::Files);
|
QDirIterator it(path.toString(), QStringList { "*.qmltypes" }, QDir::Files);
|
||||||
|
|
||||||
if (!it.hasNext())
|
if (!it.hasNext())
|
||||||
return false;
|
return false;
|
||||||
@@ -828,7 +828,7 @@ static bool findNewQmlLibraryInPath(const QString &path,
|
|||||||
QSet<QString> *newLibraries,
|
QSet<QString> *newLibraries,
|
||||||
bool ignoreMissing)
|
bool ignoreMissing)
|
||||||
{
|
{
|
||||||
switch (libraryStatus(path, snapshot, newLibraries)) {
|
switch (libraryStatus(FilePath::fromString(path), snapshot, newLibraries)) {
|
||||||
case LibraryStatus::Accepted: return true;
|
case LibraryStatus::Accepted: return true;
|
||||||
case LibraryStatus::Rejected: return false;
|
case LibraryStatus::Rejected: return false;
|
||||||
default: break;
|
default: break;
|
||||||
@@ -839,7 +839,7 @@ static bool findNewQmlLibraryInPath(const QString &path,
|
|||||||
if (!qmldirFile.exists()) {
|
if (!qmldirFile.exists()) {
|
||||||
if (!ignoreMissing) {
|
if (!ignoreMissing) {
|
||||||
LibraryInfo libraryInfo(LibraryInfo::NotFound);
|
LibraryInfo libraryInfo(LibraryInfo::NotFound);
|
||||||
modelManager->updateLibraryInfo(path, libraryInfo);
|
modelManager->updateLibraryInfo(FilePath::fromString(path), libraryInfo);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -858,7 +858,7 @@ static bool findNewQmlLibraryInPath(const QString &path,
|
|||||||
|
|
||||||
const QString libraryPath = QFileInfo(qmldirFile).absolutePath();
|
const QString libraryPath = QFileInfo(qmldirFile).absolutePath();
|
||||||
newLibraries->insert(libraryPath);
|
newLibraries->insert(libraryPath);
|
||||||
modelManager->updateLibraryInfo(libraryPath, LibraryInfo(qmldirParser));
|
modelManager->updateLibraryInfo(FilePath::fromString(libraryPath), LibraryInfo(qmldirParser));
|
||||||
modelManager->loadPluginTypes(QFileInfo(libraryPath).canonicalFilePath(), libraryPath,
|
modelManager->loadPluginTypes(QFileInfo(libraryPath).canonicalFilePath(), libraryPath,
|
||||||
QString(), QString());
|
QString(), QString());
|
||||||
|
|
||||||
@@ -1252,7 +1252,7 @@ void ModelManagerInterface::updateImportPaths()
|
|||||||
for (const Document::Ptr &doc : qAsConst(snapshot))
|
for (const Document::Ptr &doc : qAsConst(snapshot))
|
||||||
findNewLibraryImports(doc, snapshot, this, &importedFiles, &scannedPaths, &newLibraries);
|
findNewLibraryImports(doc, snapshot, this, &importedFiles, &scannedPaths, &newLibraries);
|
||||||
for (const QString &path : qAsConst(allApplicationDirectories))
|
for (const QString &path : qAsConst(allApplicationDirectories))
|
||||||
findNewQmlApplicationInPath(path, snapshot, this, &newLibraries);
|
findNewQmlApplicationInPath(FilePath::fromString(path), snapshot, this, &newLibraries);
|
||||||
|
|
||||||
updateSourceFiles(importedFiles, true);
|
updateSourceFiles(importedFiles, true);
|
||||||
|
|
||||||
@@ -1433,7 +1433,7 @@ LibraryInfo ModelManagerInterface::builtins(const Document::Ptr &doc) const
|
|||||||
{
|
{
|
||||||
const ProjectInfo info = projectInfoForPath(doc->fileName());
|
const ProjectInfo info = projectInfoForPath(doc->fileName());
|
||||||
if (!info.qtQmlPath.isEmpty())
|
if (!info.qtQmlPath.isEmpty())
|
||||||
return m_validSnapshot.libraryInfo(info.qtQmlPath.toString());
|
return m_validSnapshot.libraryInfo(info.qtQmlPath);
|
||||||
return LibraryInfo();
|
return LibraryInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -156,7 +156,7 @@ public:
|
|||||||
void updateProjectInfo(const ProjectInfo &pinfo, ProjectExplorer::Project *p);
|
void updateProjectInfo(const ProjectInfo &pinfo, ProjectExplorer::Project *p);
|
||||||
|
|
||||||
void updateDocument(const QmlJS::Document::Ptr& doc);
|
void updateDocument(const QmlJS::Document::Ptr& doc);
|
||||||
void updateLibraryInfo(const QString &path, const QmlJS::LibraryInfo &info);
|
void updateLibraryInfo(const Utils::FilePath &path, const QmlJS::LibraryInfo &info);
|
||||||
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
|
void emitDocumentChangedOnDisk(QmlJS::Document::Ptr doc);
|
||||||
void updateQrcFile(const QString &path);
|
void updateQrcFile(const QString &path);
|
||||||
ProjectInfo projectInfoForPath(const QString &path) const;
|
ProjectInfo projectInfoForPath(const QString &path) const;
|
||||||
|
@@ -89,25 +89,23 @@ void PluginDumper::onLoadBuiltinTypes(const QmlJS::ModelManagerInterface::Projec
|
|||||||
if (info.qmlDumpPath.isEmpty() || info.qtQmlPath.isEmpty())
|
if (info.qmlDumpPath.isEmpty() || info.qtQmlPath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// FIXME: This doesn't work for non-local paths.
|
if (m_runningQmldumps.values().contains(info.qmlDumpPath))
|
||||||
const QString importsPath = QDir::cleanPath(info.qtQmlPath.toString());
|
|
||||||
if (m_runningQmldumps.values().contains(importsPath))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LibraryInfo builtinInfo;
|
LibraryInfo builtinInfo;
|
||||||
if (!force) {
|
if (!force) {
|
||||||
const Snapshot snapshot = m_modelManager->snapshot();
|
const Snapshot snapshot = m_modelManager->snapshot();
|
||||||
builtinInfo = snapshot.libraryInfo(info.qtQmlPath.toString());
|
builtinInfo = snapshot.libraryInfo(info.qtQmlPath);
|
||||||
if (builtinInfo.isValid())
|
if (builtinInfo.isValid())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
builtinInfo = LibraryInfo(LibraryInfo::Found);
|
builtinInfo = LibraryInfo(LibraryInfo::Found);
|
||||||
m_modelManager->updateLibraryInfo(info.qtQmlPath.toString(), builtinInfo);
|
m_modelManager->updateLibraryInfo(info.qtQmlPath, builtinInfo);
|
||||||
|
|
||||||
// prefer QTDIR/qml/builtins.qmltypes if available
|
// prefer QTDIR/qml/builtins.qmltypes if available
|
||||||
const QString builtinQmltypesPath = info.qtQmlPath.toString() + QLatin1String("/builtins.qmltypes");
|
const QString builtinQmltypesPath = info.qtQmlPath.toString() + QLatin1String("/builtins.qmltypes");
|
||||||
if (QFile::exists(builtinQmltypesPath)) {
|
if (QFile::exists(builtinQmltypesPath)) {
|
||||||
loadQmltypesFile(QStringList(builtinQmltypesPath), info.qtQmlPath.toString(), builtinInfo);
|
loadQmltypesFile(QStringList(builtinQmltypesPath), info.qtQmlPath, builtinInfo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +122,7 @@ static QString makeAbsolute(const QString &path, const QString &base)
|
|||||||
|
|
||||||
void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
|
void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &importPath, const QString &importUri, const QString &importVersion)
|
||||||
{
|
{
|
||||||
const QString canonicalLibraryPath = QDir::cleanPath(libraryPath);
|
const FilePath canonicalLibraryPath = FilePath::fromUserInput(libraryPath).cleanPath();
|
||||||
if (m_runningQmldumps.values().contains(canonicalLibraryPath))
|
if (m_runningQmldumps.values().contains(canonicalLibraryPath))
|
||||||
return;
|
return;
|
||||||
const Snapshot snapshot = m_modelManager->snapshot();
|
const Snapshot snapshot = m_modelManager->snapshot();
|
||||||
@@ -135,7 +133,7 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &
|
|||||||
// avoid inserting the same plugin twice
|
// avoid inserting the same plugin twice
|
||||||
int index;
|
int index;
|
||||||
for (index = 0; index < m_plugins.size(); ++index) {
|
for (index = 0; index < m_plugins.size(); ++index) {
|
||||||
if (m_plugins.at(index).qmldirPath == libraryPath)
|
if (m_plugins.at(index).qmldirPath == canonicalLibraryPath)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (index == m_plugins.size())
|
if (index == m_plugins.size())
|
||||||
@@ -148,10 +146,10 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &
|
|||||||
plugin.importVersion = importVersion;
|
plugin.importVersion = importVersion;
|
||||||
|
|
||||||
// add default qmltypes file if it exists
|
// add default qmltypes file if it exists
|
||||||
QDirIterator it(canonicalLibraryPath, QStringList { "*.qmltypes" }, QDir::Files);
|
QDirIterator it(canonicalLibraryPath.toString(), QStringList { "*.qmltypes" }, QDir::Files);
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
const QString defaultQmltypesPath = makeAbsolute(it.next(), canonicalLibraryPath);
|
const QString defaultQmltypesPath = makeAbsolute(it.next(), canonicalLibraryPath.toString());
|
||||||
|
|
||||||
if (!plugin.typeInfoPaths.contains(defaultQmltypesPath))
|
if (!plugin.typeInfoPaths.contains(defaultQmltypesPath))
|
||||||
plugin.typeInfoPaths += defaultQmltypesPath;
|
plugin.typeInfoPaths += defaultQmltypesPath;
|
||||||
@@ -159,14 +157,14 @@ void PluginDumper::onLoadPluginTypes(const QString &libraryPath, const QString &
|
|||||||
|
|
||||||
// add typeinfo files listed in qmldir
|
// add typeinfo files listed in qmldir
|
||||||
foreach (const QString &typeInfo, libraryInfo.typeInfos()) {
|
foreach (const QString &typeInfo, libraryInfo.typeInfos()) {
|
||||||
QString pathNow = makeAbsolute(typeInfo, canonicalLibraryPath);
|
QString pathNow = makeAbsolute(typeInfo, canonicalLibraryPath.toString());
|
||||||
if (!plugin.typeInfoPaths.contains(pathNow) && QFile::exists(pathNow))
|
if (!plugin.typeInfoPaths.contains(pathNow) && QFile::exists(pathNow))
|
||||||
plugin.typeInfoPaths += pathNow;
|
plugin.typeInfoPaths += pathNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// watch plugin libraries
|
// watch plugin libraries
|
||||||
foreach (const QmlDirParser::Plugin &plugin, snapshot.libraryInfo(canonicalLibraryPath).plugins()) {
|
foreach (const QmlDirParser::Plugin &plugin, snapshot.libraryInfo(canonicalLibraryPath).plugins()) {
|
||||||
const QString pluginLibrary = resolvePlugin(canonicalLibraryPath, plugin.path, plugin.name);
|
const QString pluginLibrary = resolvePlugin(canonicalLibraryPath.toString(), plugin.path, plugin.name);
|
||||||
if (!pluginLibrary.isEmpty()) {
|
if (!pluginLibrary.isEmpty()) {
|
||||||
if (!pluginWatcher()->watchesFile(pluginLibrary))
|
if (!pluginWatcher()->watchesFile(pluginLibrary))
|
||||||
pluginWatcher()->addFile(pluginLibrary, Utils::FileSystemWatcher::WatchModifiedDate);
|
pluginWatcher()->addFile(pluginLibrary, Utils::FileSystemWatcher::WatchModifiedDate);
|
||||||
@@ -195,26 +193,25 @@ void PluginDumper::dumpAllPlugins()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString noTypeinfoError(const QString &libraryPath)
|
static QString noTypeinfoError(const FilePath &libraryPath)
|
||||||
{
|
{
|
||||||
return PluginDumper::tr("QML module does not contain information about components contained in plugins.\n\n"
|
return PluginDumper::tr("QML module does not contain information about components contained in plugins.\n\n"
|
||||||
"Module path: %1\n"
|
"Module path: %1\n"
|
||||||
"See \"Using QML Modules with Plugins\" in the documentation.").arg(
|
"See \"Using QML Modules with Plugins\" in the documentation.").arg(
|
||||||
libraryPath);
|
libraryPath.toUserOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString qmldumpErrorMessage(const QString &libraryPath, const QString &error)
|
static QString qmldumpErrorMessage(const FilePath &libraryPath, const QString &error)
|
||||||
{
|
{
|
||||||
return noTypeinfoError(libraryPath) + QLatin1String("\n\n") +
|
return noTypeinfoError(libraryPath) + "\n\n" +
|
||||||
PluginDumper::tr("Automatic type dump of QML module failed.\nErrors:\n%1").
|
PluginDumper::tr("Automatic type dump of QML module failed.\nErrors:\n%1").
|
||||||
arg(error) + QLatin1Char('\n');
|
arg(error) + QLatin1Char('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString qmldumpFailedMessage(const QString &libraryPath, const QString &error)
|
static QString qmldumpFailedMessage(const FilePath &libraryPath, const QString &error)
|
||||||
{
|
{
|
||||||
QString firstLines =
|
QString firstLines = QStringList(error.split('\n').mid(0, 10)).join('\n');
|
||||||
QStringList(error.split(QLatin1Char('\n')).mid(0, 10)).join(QLatin1Char('\n'));
|
return noTypeinfoError(libraryPath) + "\n\n" +
|
||||||
return noTypeinfoError(libraryPath) + QLatin1String("\n\n") +
|
|
||||||
PluginDumper::tr("Automatic type dump of QML module failed.\n"
|
PluginDumper::tr("Automatic type dump of QML module failed.\n"
|
||||||
"First 10 lines or errors:\n"
|
"First 10 lines or errors:\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -224,11 +221,11 @@ static QString qmldumpFailedMessage(const QString &libraryPath, const QString &e
|
|||||||
).arg(firstLines);
|
).arg(firstLines);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printParseWarnings(const QString &libraryPath, const QString &warning)
|
static void printParseWarnings(const FilePath &libraryPath, const QString &warning)
|
||||||
{
|
{
|
||||||
ModelManagerInterface::writeWarning(
|
ModelManagerInterface::writeWarning(
|
||||||
PluginDumper::tr("Warnings while parsing QML type information of %1:\n"
|
PluginDumper::tr("Warnings while parsing QML type information of %1:\n"
|
||||||
"%2").arg(libraryPath, warning));
|
"%2").arg(libraryPath.toUserOutput(), warning));
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString qmlPluginDumpErrorMessage(QtcProcess *process)
|
static QString qmlPluginDumpErrorMessage(QtcProcess *process)
|
||||||
@@ -269,7 +266,7 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process)
|
|||||||
{
|
{
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
|
|
||||||
const QString libraryPath = m_runningQmldumps.take(process);
|
const FilePath libraryPath = m_runningQmldumps.take(process);
|
||||||
if (libraryPath.isEmpty())
|
if (libraryPath.isEmpty())
|
||||||
return;
|
return;
|
||||||
const Snapshot snapshot = m_modelManager->snapshot();
|
const Snapshot snapshot = m_modelManager->snapshot();
|
||||||
@@ -298,7 +295,7 @@ void PluginDumper::qmlPluginTypeDumpDone(QtcProcess *process)
|
|||||||
CppQmlTypesInfo infos;
|
CppQmlTypesInfo infos;
|
||||||
CppQmlTypesLoader::parseQmlTypeDescriptions(output, &infos.objectsList, &infos.moduleApis, &infos.dependencies,
|
CppQmlTypesLoader::parseQmlTypeDescriptions(output, &infos.objectsList, &infos.moduleApis, &infos.dependencies,
|
||||||
&infos.error, &infos.warning,
|
&infos.error, &infos.warning,
|
||||||
QLatin1String("<dump of ") + libraryPath + QLatin1Char('>'));
|
"<dump of " + libraryPath.toUserOutput() + '>');
|
||||||
future.reportFinished(&infos);
|
future.reportFinished(&infos);
|
||||||
});
|
});
|
||||||
m_modelManager->addFuture(future);
|
m_modelManager->addFuture(future);
|
||||||
@@ -338,13 +335,13 @@ void PluginDumper::qmlPluginTypeDumpError(QtcProcess *process)
|
|||||||
{
|
{
|
||||||
process->deleteLater();
|
process->deleteLater();
|
||||||
|
|
||||||
const QString libraryPath = m_runningQmldumps.take(process);
|
const FilePath libraryPath = m_runningQmldumps.take(process);
|
||||||
if (libraryPath.isEmpty())
|
if (libraryPath.isEmpty())
|
||||||
return;
|
return;
|
||||||
const QString errorMessages = qmlPluginDumpErrorMessage(process);
|
const QString errorMessages = qmlPluginDumpErrorMessage(process);
|
||||||
const Snapshot snapshot = m_modelManager->snapshot();
|
const Snapshot snapshot = m_modelManager->snapshot();
|
||||||
LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath);
|
LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath);
|
||||||
if (!libraryPath.endsWith(QLatin1String("private"), Qt::CaseInsensitive))
|
if (!libraryPath.path().endsWith(QLatin1String("private"), Qt::CaseInsensitive))
|
||||||
ModelManagerInterface::writeWarning(qmldumpErrorMessage(libraryPath, errorMessages));
|
ModelManagerInterface::writeWarning(qmldumpErrorMessage(libraryPath, errorMessages));
|
||||||
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, qmldumpFailedMessage(libraryPath, errorMessages));
|
libraryInfo.setPluginTypeInfoStatus(LibraryInfo::DumpError, qmldumpFailedMessage(libraryPath, errorMessages));
|
||||||
libraryInfo.updateFingerprint();
|
libraryInfo.updateFingerprint();
|
||||||
@@ -564,7 +561,7 @@ static void applyQt515MissingImportWorkaround(const QString &path, LibraryInfo &
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PluginDumper::prepareLibraryInfo(LibraryInfo &libInfo,
|
void PluginDumper::prepareLibraryInfo(LibraryInfo &libInfo,
|
||||||
const QString &libraryPath,
|
const FilePath &libraryPath,
|
||||||
const QStringList &deps,
|
const QStringList &deps,
|
||||||
const QStringList &errors,
|
const QStringList &errors,
|
||||||
const QStringList &warnings,
|
const QStringList &warnings,
|
||||||
@@ -588,13 +585,13 @@ void PluginDumper::prepareLibraryInfo(LibraryInfo &libInfo,
|
|||||||
if (!warnings.isEmpty())
|
if (!warnings.isEmpty())
|
||||||
printParseWarnings(libraryPath, warnings.join(QLatin1String("\n")));
|
printParseWarnings(libraryPath, warnings.join(QLatin1String("\n")));
|
||||||
|
|
||||||
applyQt515MissingImportWorkaround(libraryPath, libInfo);
|
applyQt515MissingImportWorkaround(libraryPath.toString(), libInfo);
|
||||||
|
|
||||||
libInfo.updateFingerprint();
|
libInfo.updateFingerprint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
void PluginDumper::loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
||||||
const QString &libraryPath,
|
const FilePath &libraryPath,
|
||||||
QmlJS::LibraryInfo libraryInfo)
|
QmlJS::LibraryInfo libraryInfo)
|
||||||
{
|
{
|
||||||
Utils::onFinished(loadQmlTypeDescription(qmltypesFilePaths), this, [=](const QFuture<PluginDumper::QmlTypeDescription> &typesFuture)
|
Utils::onFinished(loadQmlTypeDescription(qmltypesFilePaths), this, [=](const QFuture<PluginDumper::QmlTypeDescription> &typesFuture)
|
||||||
@@ -640,7 +637,7 @@ void PluginDumper::runQmlDump(const ModelManagerInterface::ProjectInfo &info,
|
|||||||
connect(process, &QtcProcess::finished, this, [this, process] { qmlPluginTypeDumpDone(process); });
|
connect(process, &QtcProcess::finished, this, [this, process] { qmlPluginTypeDumpDone(process); });
|
||||||
connect(process, &QtcProcess::errorOccurred, this, [this, process] { qmlPluginTypeDumpError(process); });
|
connect(process, &QtcProcess::errorOccurred, this, [this, process] { qmlPluginTypeDumpError(process); });
|
||||||
process->start();
|
process->start();
|
||||||
m_runningQmldumps.insert(process, importPath.toString());
|
m_runningQmldumps.insert(process, importPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginDumper::dump(const Plugin &plugin)
|
void PluginDumper::dump(const Plugin &plugin)
|
||||||
@@ -686,7 +683,7 @@ void PluginDumper::dump(const Plugin &plugin)
|
|||||||
args << plugin.importUri;
|
args << plugin.importUri;
|
||||||
args << plugin.importVersion;
|
args << plugin.importVersion;
|
||||||
args << (plugin.importPath.isEmpty() ? QLatin1String(".") : plugin.importPath);
|
args << (plugin.importPath.isEmpty() ? QLatin1String(".") : plugin.importPath);
|
||||||
runQmlDump(info, args, FilePath::fromString(plugin.qmldirPath));
|
runQmlDump(info, args, plugin.qmldirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -65,7 +65,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
class Plugin {
|
class Plugin {
|
||||||
public:
|
public:
|
||||||
QString qmldirPath;
|
Utils::FilePath qmldirPath;
|
||||||
QString importPath;
|
QString importPath;
|
||||||
QString importUri;
|
QString importUri;
|
||||||
QString importVersion;
|
QString importVersion;
|
||||||
@@ -98,7 +98,7 @@ private:
|
|||||||
QSharedPointer<QSet<QString>> visited) const;
|
QSharedPointer<QSet<QString>> visited) const;
|
||||||
|
|
||||||
void loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
void loadQmltypesFile(const QStringList &qmltypesFilePaths,
|
||||||
const QString &libraryPath,
|
const Utils::FilePath &libraryPath,
|
||||||
QmlJS::LibraryInfo libraryInfo);
|
QmlJS::LibraryInfo libraryInfo);
|
||||||
QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
|
QString resolvePlugin(const QDir &qmldirPath, const QString &qmldirPluginPath,
|
||||||
const QString &baseName);
|
const QString &baseName);
|
||||||
@@ -109,7 +109,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
Utils::FileSystemWatcher *pluginWatcher();
|
Utils::FileSystemWatcher *pluginWatcher();
|
||||||
void prepareLibraryInfo(LibraryInfo &libInfo,
|
void prepareLibraryInfo(LibraryInfo &libInfo,
|
||||||
const QString &libraryPath,
|
const Utils::FilePath &libraryPath,
|
||||||
const QStringList &deps,
|
const QStringList &deps,
|
||||||
const QStringList &errors,
|
const QStringList &errors,
|
||||||
const QStringList &warnings,
|
const QStringList &warnings,
|
||||||
@@ -118,7 +118,7 @@ private:
|
|||||||
|
|
||||||
ModelManagerInterface *m_modelManager;
|
ModelManagerInterface *m_modelManager;
|
||||||
Utils::FileSystemWatcher *m_pluginWatcher;
|
Utils::FileSystemWatcher *m_pluginWatcher;
|
||||||
QHash<Utils::QtcProcess *, QString> m_runningQmldumps;
|
QHash<Utils::QtcProcess *, Utils::FilePath> m_runningQmldumps;
|
||||||
QList<Plugin> m_plugins;
|
QList<Plugin> m_plugins;
|
||||||
QHash<QString, int> m_libraryToPluginIndex;
|
QHash<QString, int> m_libraryToPluginIndex;
|
||||||
QHash<QString, QmlJS::ModelManagerInterface::ProjectInfo> m_qtToInfo;
|
QHash<QString, QmlJS::ModelManagerInterface::ProjectInfo> m_qtToInfo;
|
||||||
|
Reference in New Issue
Block a user