Commit fa242669 authored by Fawzi Mohamed's avatar Fawzi Mohamed

qmljs: improve handling of relocatable dumps

Change-Id: Ie329911a3f7f9266ead41087cbc7d78b95c1497a
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent c44cffa4
......@@ -554,10 +554,29 @@ void Snapshot::insertLibraryInfo(const QString &path, const LibraryInfo &info)
}
QStringList splitPath = path.split(QLatin1Char('/'));
QRegExp vNr(QLatin1String("^(.+)\\.([0-9]+)(?:\\.([0-9]+))?$"));
QRegExp safeName(QLatin1String("^[a-zA-Z_][[a-zA-Z0-9_]*$"));
foreach (const ImportKey &importKey, packages) {
QString requiredPath = QStringList(splitPath.mid(0, splitPath.size() - importKey.splitPath.size()))
.join(QLatin1String("/"));
cImport.possibleExports << Export(importKey, requiredPath, true);
if (importKey.splitPath.size() == 1 && importKey.splitPath.at(0).isEmpty()) {
// relocatable
QStringList myPath = splitPath;
if (vNr.indexIn(myPath.last()) == 0) {
myPath.last() = vNr.cap(1);
}
for (int iPath = myPath.size(); iPath != 0; ) {
--iPath;
if (safeName.indexIn(myPath.at(iPath)) != 0)
break;
ImportKey iKey(ImportType::Library, QStringList(myPath.mid(iPath)).join(QLatin1Char('.')),
importKey.majorVersion, importKey.minorVersion);
cImport.possibleExports.append(Export(iKey, QStringList(myPath.mid(0, iPath))
.join(QLatin1Char('/')), true));
}
} else {
QString requiredPath = QStringList(splitPath.mid(0, splitPath.size() - importKey.splitPath.size()))
.join(QLatin1String("/"));
cImport.possibleExports << Export(importKey, requiredPath, true);
}
}
foreach (const QmlDirParser::Component &component, info.components()) {
foreach (const Export &e, cImport.possibleExports)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment