forked from qt-creator/qt-creator
QmlDesigner: Remove '.' workaround in project storage
The '.' file paths were always a workaround. Since some time the context id is now part of the source id. So a source ids can be generated from source context id without a file name. Task-number: QDS-14672 Change-Id: Ia278b9d06030ca8ea6e150d0c7ffd762979d5d62 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -50,7 +50,9 @@ long long FileSystem::lastModified(SourceId sourceId) const
|
|||||||
|
|
||||||
FileStatus FileSystem::fileStatus(SourceId sourceId) const
|
FileStatus FileSystem::fileStatus(SourceId sourceId) const
|
||||||
{
|
{
|
||||||
QFileInfo fileInfo(QString(m_sourcePathCache.sourcePath(sourceId)));
|
auto path = sourceId.mainId() ? m_sourcePathCache.sourcePath(sourceId)
|
||||||
|
: m_sourcePathCache.sourceContextPath(sourceId.contextId());
|
||||||
|
QFileInfo fileInfo(QString{path});
|
||||||
|
|
||||||
fileInfo.refresh();
|
fileInfo.refresh();
|
||||||
|
|
||||||
|
@@ -649,31 +649,31 @@ struct ProjectStorage::Statements
|
|||||||
"DELETE FROM exportedTypeNames WHERE exportedTypeNameId=?", database};
|
"DELETE FROM exportedTypeNames WHERE exportedTypeNameId=?", database};
|
||||||
Sqlite::WriteStatement<2> updateExportedTypeNameTypeIdStatement{
|
Sqlite::WriteStatement<2> updateExportedTypeNameTypeIdStatement{
|
||||||
"UPDATE exportedTypeNames SET typeId=?2 WHERE exportedTypeNameId=?1", database};
|
"UPDATE exportedTypeNames SET typeId=?2 WHERE exportedTypeNameId=?1", database};
|
||||||
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForSourceIdsStatement{
|
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForDirectoryIdsStatement{
|
||||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
"SELECT directoryId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||||
"directorySourceId IN carray(?1) ORDER BY directorySourceId, sourceId",
|
"directoryId IN carray(?1) ORDER BY directoryId, sourceId",
|
||||||
database};
|
database};
|
||||||
Sqlite::WriteStatement<4> insertDirectoryInfoStatement{
|
Sqlite::WriteStatement<4> insertDirectoryInfoStatement{
|
||||||
"INSERT INTO directoryInfos(directorySourceId, sourceId, "
|
"INSERT INTO directoryInfos(directoryId, sourceId, "
|
||||||
"moduleId, fileType) VALUES(?1, ?2, ?3, ?4)",
|
"moduleId, fileType) VALUES(?1, ?2, ?3, ?4)",
|
||||||
database};
|
database};
|
||||||
Sqlite::WriteStatement<2> deleteDirectoryInfoStatement{
|
Sqlite::WriteStatement<2> deleteDirectoryInfoStatement{
|
||||||
"DELETE FROM directoryInfos WHERE directorySourceId=?1 AND sourceId=?2", database};
|
"DELETE FROM directoryInfos WHERE directoryId=?1 AND sourceId=?2", database};
|
||||||
Sqlite::WriteStatement<4> updateDirectoryInfoStatement{
|
Sqlite::WriteStatement<4> updateDirectoryInfoStatement{
|
||||||
"UPDATE directoryInfos SET moduleId=?3, fileType=?4 WHERE directorySourceId=?1 AND sourceId=?2",
|
"UPDATE directoryInfos SET moduleId=?3, fileType=?4 WHERE directoryId=?1 AND sourceId=?2",
|
||||||
database};
|
database};
|
||||||
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForSourceIdStatement{
|
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfosForDirectoryIdStatement{
|
||||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
"SELECT directoryId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||||
"directorySourceId=?1",
|
"directoryId=?1",
|
||||||
database};
|
database};
|
||||||
mutable Sqlite::ReadStatement<4, 2> selectDirectoryInfosForSourceIdAndFileTypeStatement{
|
mutable Sqlite::ReadStatement<4, 2> selectDirectoryInfosForDiectoryIdAndFileTypeStatement{
|
||||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
"SELECT directoryId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||||
"directorySourceId=?1 AND fileType=?2",
|
"directoryId=?1 AND fileType=?2",
|
||||||
database};
|
database};
|
||||||
mutable Sqlite::ReadStatement<1, 2> selectDirectoryInfosSourceIdsForSourceIdAndFileTypeStatement{
|
mutable Sqlite::ReadStatement<1, 2> selectDirectoryInfosSourceIdsForDirectoryIdAndFileTypeStatement{
|
||||||
"SELECT sourceId FROM directoryInfos WHERE directorySourceId=?1 AND fileType=?2", database};
|
"SELECT sourceId FROM directoryInfos WHERE directoryId=?1 AND fileType=?2", database};
|
||||||
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfoForSourceIdStatement{
|
mutable Sqlite::ReadStatement<4, 1> selectDirectoryInfoForSourceIdStatement{
|
||||||
"SELECT directorySourceId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
"SELECT directoryId, sourceId, moduleId, fileType FROM directoryInfos WHERE "
|
||||||
"sourceId=?1 LIMIT 1",
|
"sourceId=?1 LIMIT 1",
|
||||||
database};
|
database};
|
||||||
mutable Sqlite::ReadStatement<1, 1> selectTypeIdsForSourceIdsStatement{
|
mutable Sqlite::ReadStatement<1, 1> selectTypeIdsForSourceIdsStatement{
|
||||||
@@ -817,7 +817,7 @@ struct ProjectStorage::Statements
|
|||||||
database};
|
database};
|
||||||
Sqlite::WriteStatement<7> insertTypeAnnotationStatement{
|
Sqlite::WriteStatement<7> insertTypeAnnotationStatement{
|
||||||
"INSERT INTO "
|
"INSERT INTO "
|
||||||
" typeAnnotations(typeId, sourceId, directorySourceId, typeName, iconPath, itemLibrary, "
|
" typeAnnotations(typeId, sourceId, directoryId, typeName, iconPath, itemLibrary, "
|
||||||
" hints) "
|
" hints) "
|
||||||
"VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7)",
|
"VALUES(?1, ?2, ?3, ?4, ?5, ?6, ?7)",
|
||||||
database};
|
database};
|
||||||
@@ -836,9 +836,9 @@ struct ProjectStorage::Statements
|
|||||||
"WHERE typeId=?1 AND hints IS NOT NULL",
|
"WHERE typeId=?1 AND hints IS NOT NULL",
|
||||||
database};
|
database};
|
||||||
mutable Sqlite::ReadStatement<1, 1> selectTypeAnnotationSourceIdsStatement{
|
mutable Sqlite::ReadStatement<1, 1> selectTypeAnnotationSourceIdsStatement{
|
||||||
"SELECT sourceId FROM typeAnnotations WHERE directorySourceId=?1 ORDER BY sourceId", database};
|
"SELECT sourceId FROM typeAnnotations WHERE directoryId=?1 ORDER BY sourceId", database};
|
||||||
mutable Sqlite::ReadStatement<1, 0> selectTypeAnnotationDirectorySourceIdsStatement{
|
mutable Sqlite::ReadStatement<1, 0> selectTypeAnnotationDirectoryIdsStatement{
|
||||||
"SELECT DISTINCT directorySourceId FROM typeAnnotations ORDER BY directorySourceId", database};
|
"SELECT DISTINCT directoryId FROM typeAnnotations ORDER BY directoryId", database};
|
||||||
mutable Sqlite::ReadStatement<10> selectItemLibraryEntriesStatement{
|
mutable Sqlite::ReadStatement<10> selectItemLibraryEntriesStatement{
|
||||||
"SELECT typeId, typeName, i.value->>'$.name', i.value->>'$.iconPath', "
|
"SELECT typeId, typeName, i.value->>'$.name', i.value->>'$.iconPath', "
|
||||||
" i.value->>'$.category', i.value->>'$.import', i.value->>'$.toolTip', "
|
" i.value->>'$.category', i.value->>'$.import', i.value->>'$.toolTip', "
|
||||||
@@ -1222,15 +1222,14 @@ public:
|
|||||||
table.setUseIfNotExists(true);
|
table.setUseIfNotExists(true);
|
||||||
table.setUseWithoutRowId(true);
|
table.setUseWithoutRowId(true);
|
||||||
table.setName("directoryInfos");
|
table.setName("directoryInfos");
|
||||||
auto &directorySourceIdColumn = table.addColumn("directorySourceId",
|
auto &directoryIdColumn = table.addColumn("directoryId", Sqlite::StrictColumnType::Integer);
|
||||||
Sqlite::StrictColumnType::Integer);
|
|
||||||
auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
|
auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
|
||||||
table.addColumn("moduleId", Sqlite::StrictColumnType::Integer);
|
table.addColumn("moduleId", Sqlite::StrictColumnType::Integer);
|
||||||
auto &fileTypeColumn = table.addColumn("fileType", Sqlite::StrictColumnType::Integer);
|
auto &fileTypeColumn = table.addColumn("fileType", Sqlite::StrictColumnType::Integer);
|
||||||
|
|
||||||
table.addPrimaryKeyContraint({directorySourceIdColumn, sourceIdColumn});
|
table.addPrimaryKeyContraint({directoryIdColumn, sourceIdColumn});
|
||||||
table.addUniqueIndex({sourceIdColumn});
|
table.addUniqueIndex({sourceIdColumn});
|
||||||
table.addIndex({directorySourceIdColumn, fileTypeColumn});
|
table.addIndex({directoryIdColumn, fileTypeColumn});
|
||||||
|
|
||||||
table.initialize(database);
|
table.initialize(database);
|
||||||
}
|
}
|
||||||
@@ -1260,15 +1259,14 @@ public:
|
|||||||
Sqlite::StrictColumnType::Integer,
|
Sqlite::StrictColumnType::Integer,
|
||||||
{Sqlite::PrimaryKey{}});
|
{Sqlite::PrimaryKey{}});
|
||||||
auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
|
auto &sourceIdColumn = table.addColumn("sourceId", Sqlite::StrictColumnType::Integer);
|
||||||
auto &directorySourceIdColumn = table.addColumn("directorySourceId",
|
auto &directoryIdColumn = table.addColumn("directoryId", Sqlite::StrictColumnType::Integer);
|
||||||
Sqlite::StrictColumnType::Integer);
|
|
||||||
table.addColumn("typeName", Sqlite::StrictColumnType::Text);
|
table.addColumn("typeName", Sqlite::StrictColumnType::Text);
|
||||||
table.addColumn("iconPath", Sqlite::StrictColumnType::Text);
|
table.addColumn("iconPath", Sqlite::StrictColumnType::Text);
|
||||||
table.addColumn("itemLibrary", Sqlite::StrictColumnType::Text);
|
table.addColumn("itemLibrary", Sqlite::StrictColumnType::Text);
|
||||||
table.addColumn("hints", Sqlite::StrictColumnType::Text);
|
table.addColumn("hints", Sqlite::StrictColumnType::Text);
|
||||||
|
|
||||||
table.addUniqueIndex({sourceIdColumn, typeIdColumn});
|
table.addUniqueIndex({sourceIdColumn, typeIdColumn});
|
||||||
table.addIndex({directorySourceIdColumn});
|
table.addIndex({directoryIdColumn});
|
||||||
|
|
||||||
table.initialize(database);
|
table.initialize(database);
|
||||||
}
|
}
|
||||||
@@ -1337,7 +1335,7 @@ void ProjectStorage::synchronize(Storage::Synchronization::SynchronizationPackag
|
|||||||
package.updatedSourceIds);
|
package.updatedSourceIds);
|
||||||
synchronizeTypeAnnotations(package.typeAnnotations, package.updatedTypeAnnotationSourceIds);
|
synchronizeTypeAnnotations(package.typeAnnotations, package.updatedTypeAnnotationSourceIds);
|
||||||
synchronizePropertyEditorQmlPaths(package.propertyEditorQmlPaths,
|
synchronizePropertyEditorQmlPaths(package.propertyEditorQmlPaths,
|
||||||
package.updatedPropertyEditorQmlPathSourceIds);
|
package.updatedPropertyEditorQmlPathSourceContextIds);
|
||||||
|
|
||||||
deleteNotUpdatedTypes(updatedTypeIds,
|
deleteNotUpdatedTypes(updatedTypeIds,
|
||||||
package.updatedSourceIds,
|
package.updatedSourceIds,
|
||||||
@@ -1358,7 +1356,7 @@ void ProjectStorage::synchronize(Storage::Synchronization::SynchronizationPackag
|
|||||||
|
|
||||||
linkAliases(aliasPropertyDeclarationsToLink, RaiseError::Yes);
|
linkAliases(aliasPropertyDeclarationsToLink, RaiseError::Yes);
|
||||||
|
|
||||||
synchronizeDirectoryInfos(package.directoryInfos, package.updatedDirectoryInfoSourceIds);
|
synchronizeDirectoryInfos(package.directoryInfos, package.updatedDirectoryInfoDirectoryIds);
|
||||||
|
|
||||||
commonTypeCache_.resetTypeIds();
|
commonTypeCache_.resetTypeIds();
|
||||||
});
|
});
|
||||||
@@ -1748,7 +1746,7 @@ Storage::Info::TypeHints ProjectStorage::typeHints(TypeId typeId) const
|
|||||||
return typeHints;
|
return typeHints;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallSourceIds<4> ProjectStorage::typeAnnotationSourceIds(SourceId directoryId) const
|
SmallSourceIds<4> ProjectStorage::typeAnnotationSourceIds(SourceContextId directoryId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"get type annotaion source ids",
|
NanotraceHR::Tracer tracer{"get type annotaion source ids",
|
||||||
@@ -1763,13 +1761,13 @@ SmallSourceIds<4> ProjectStorage::typeAnnotationSourceIds(SourceId directoryId)
|
|||||||
return sourceIds;
|
return sourceIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallSourceIds<64> ProjectStorage::typeAnnotationDirectorySourceIds() const
|
SmallSourceContextIds<64> ProjectStorage::typeAnnotationDirectoryIds() const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"get type annotaion source ids", projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"get type annotaion source ids", projectStorageCategory()};
|
||||||
|
|
||||||
auto sourceIds = s->selectTypeAnnotationDirectorySourceIdsStatement
|
auto sourceIds = s->selectTypeAnnotationDirectoryIdsStatement
|
||||||
.valuesWithTransaction<SmallSourceIds<64>>();
|
.valuesWithTransaction<SmallSourceContextIds<64>>();
|
||||||
|
|
||||||
tracer.end(keyValue("source ids", sourceIds));
|
tracer.end(keyValue("source ids", sourceIds));
|
||||||
|
|
||||||
@@ -2198,16 +2196,16 @@ std::optional<Storage::Synchronization::DirectoryInfo> ProjectStorage::fetchDire
|
|||||||
return directoryInfo;
|
return directoryInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(SourceId directorySourceId) const
|
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(SourceContextId directoryId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch directory infos by source id",
|
NanotraceHR::Tracer tracer{"fetch directory infos by directory id",
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("source id", directorySourceId)};
|
keyValue("directory id", directoryId)};
|
||||||
|
|
||||||
auto directoryInfos = s->selectDirectoryInfosForSourceIdStatement
|
auto directoryInfos = s->selectDirectoryInfosForDirectoryIdStatement
|
||||||
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 1024>(
|
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 1024>(
|
||||||
directorySourceId);
|
directoryId);
|
||||||
|
|
||||||
tracer.end(keyValue("directory infos", directoryInfos));
|
tracer.end(keyValue("directory infos", directoryInfos));
|
||||||
|
|
||||||
@@ -2215,17 +2213,17 @@ Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(Sou
|
|||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
||||||
SourceId directorySourceId, Storage::Synchronization::FileType fileType) const
|
SourceContextId directoryId, Storage::Synchronization::FileType fileType) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch directory infos by source id and file type",
|
NanotraceHR::Tracer tracer{"fetch directory infos by source id and file type",
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("source id", directorySourceId),
|
keyValue("directory id", directoryId),
|
||||||
keyValue("file type", fileType)};
|
keyValue("file type", fileType)};
|
||||||
|
|
||||||
auto directoryInfos = s->selectDirectoryInfosForSourceIdAndFileTypeStatement
|
auto directoryInfos = s->selectDirectoryInfosForDiectoryIdAndFileTypeStatement
|
||||||
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 16>(
|
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 16>(
|
||||||
directorySourceId, fileType);
|
directoryId, fileType);
|
||||||
|
|
||||||
tracer.end(keyValue("directory infos", directoryInfos));
|
tracer.end(keyValue("directory infos", directoryInfos));
|
||||||
|
|
||||||
@@ -2233,36 +2231,40 @@ Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
Storage::Synchronization::DirectoryInfos ProjectStorage::fetchDirectoryInfos(
|
||||||
const SourceIds &directorySourceIds) const
|
const SourceContextIds &directoryIds) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch directory infos by source ids",
|
NanotraceHR::Tracer tracer{"fetch directory infos by source ids",
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("source ids", directorySourceIds)};
|
keyValue("directory ids", directoryIds)};
|
||||||
|
|
||||||
auto directoryInfos = s->selectDirectoryInfosForSourceIdsStatement
|
auto directoryInfos = s->selectDirectoryInfosForDirectoryIdsStatement
|
||||||
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 64>(
|
.valuesWithTransaction<Storage::Synchronization::DirectoryInfo, 64>(
|
||||||
toIntegers(directorySourceIds));
|
toIntegers(directoryIds));
|
||||||
|
|
||||||
tracer.end(keyValue("directory infos", directoryInfos));
|
tracer.end(keyValue("directory infos", directoryInfos));
|
||||||
|
|
||||||
return directoryInfos;
|
return directoryInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallSourceIds<32> ProjectStorage::fetchSubdirectorySourceIds(SourceId directorySourceId) const
|
SmallSourceContextIds<32> ProjectStorage::fetchSubdirectoryIds(SourceContextId directoryId) const
|
||||||
{
|
{
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch subdirectory source ids",
|
NanotraceHR::Tracer tracer{"fetch subdirectory source ids",
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("source id", directorySourceId)};
|
keyValue("directory id", directoryId)};
|
||||||
|
|
||||||
auto sourceIds = s->selectDirectoryInfosSourceIdsForSourceIdAndFileTypeStatement
|
auto sourceIds = s->selectDirectoryInfosSourceIdsForDirectoryIdAndFileTypeStatement
|
||||||
.valuesWithTransaction<SmallSourceIds<32>>(
|
.rangeWithTransaction<SourceId>(directoryId,
|
||||||
directorySourceId, Storage::Synchronization::FileType::Directory);
|
Storage::Synchronization::FileType::Directory);
|
||||||
|
|
||||||
tracer.end(keyValue("source ids", sourceIds));
|
SmallSourceContextIds<32> directoryIds;
|
||||||
|
for (SourceId sourceId : sourceIds)
|
||||||
|
directoryIds.push_back(sourceId.contextId());
|
||||||
|
|
||||||
return sourceIds;
|
tracer.end(keyValue("directory ids", directoryIds));
|
||||||
|
|
||||||
|
return directoryIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorage::setPropertyEditorPathId(TypeId typeId, SourceId pathId)
|
void ProjectStorage::setPropertyEditorPathId(TypeId typeId, SourceId pathId)
|
||||||
@@ -2447,7 +2449,7 @@ void ProjectStorage::synchronizeTypeAnnotations(Storage::Synchronization::TypeAn
|
|||||||
|
|
||||||
s->insertTypeAnnotationStatement.write(annotation.typeId,
|
s->insertTypeAnnotationStatement.write(annotation.typeId,
|
||||||
annotation.sourceId,
|
annotation.sourceId,
|
||||||
annotation.directorySourceId,
|
annotation.directoryId,
|
||||||
annotation.typeName,
|
annotation.typeName,
|
||||||
annotation.iconPath,
|
annotation.iconPath,
|
||||||
createEmptyAsNull(annotation.itemLibraryJson),
|
createEmptyAsNull(annotation.itemLibraryJson),
|
||||||
@@ -2571,22 +2573,23 @@ void ProjectStorage::synchronizeTypes(Storage::Synchronization::Types &types,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||||
const SourceIds &updatedDirectoryInfoSourceIds)
|
const SourceContextIds &updatedDirectoryInfoDirectoryIds)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"synchronize directory infos", projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"synchronize directory infos", projectStorageCategory()};
|
||||||
|
|
||||||
auto compareKey = [](auto &&first, auto &&second) {
|
auto compareKey = [](auto &&first, auto &&second) {
|
||||||
return std::tie(first.directorySourceId, first.sourceId)
|
return std::tie(first.directoryId, first.sourceId)
|
||||||
<=> std::tie(second.directorySourceId, second.sourceId);
|
<=> std::tie(second.directoryId, second.sourceId);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ranges::sort(directoryInfos, [&](auto &&first, auto &&second) {
|
std::ranges::sort(directoryInfos, [&](auto &&first, auto &&second) {
|
||||||
return std::tie(first.directorySourceId, first.sourceId)
|
return std::tie(first.directoryId, first.sourceId)
|
||||||
< std::tie(second.directorySourceId, second.sourceId);
|
< std::tie(second.directoryId, second.sourceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
auto range = s->selectDirectoryInfosForSourceIdsStatement.range<Storage::Synchronization::DirectoryInfo>(
|
auto range = s->selectDirectoryInfosForDirectoryIdsStatement
|
||||||
toIntegers(updatedDirectoryInfoSourceIds));
|
.range<Storage::Synchronization::DirectoryInfo>(
|
||||||
|
toIntegers(updatedDirectoryInfoDirectoryIds));
|
||||||
|
|
||||||
auto insert = [&](const Storage::Synchronization::DirectoryInfo &directoryInfo) {
|
auto insert = [&](const Storage::Synchronization::DirectoryInfo &directoryInfo) {
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
@@ -2594,12 +2597,12 @@ void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::Directo
|
|||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("directory info", directoryInfo)};
|
keyValue("directory info", directoryInfo)};
|
||||||
|
|
||||||
if (!directoryInfo.directorySourceId)
|
if (!directoryInfo.directoryId)
|
||||||
throw DirectoryInfoHasInvalidProjectSourceId{};
|
throw DirectoryInfoHasInvalidProjectSourceId{};
|
||||||
if (!directoryInfo.sourceId)
|
if (!directoryInfo.sourceId)
|
||||||
throw DirectoryInfoHasInvalidSourceId{};
|
throw DirectoryInfoHasInvalidSourceId{};
|
||||||
|
|
||||||
s->insertDirectoryInfoStatement.write(directoryInfo.directorySourceId,
|
s->insertDirectoryInfoStatement.write(directoryInfo.directoryId,
|
||||||
directoryInfo.sourceId,
|
directoryInfo.sourceId,
|
||||||
directoryInfo.moduleId,
|
directoryInfo.moduleId,
|
||||||
directoryInfo.fileType);
|
directoryInfo.fileType);
|
||||||
@@ -2616,7 +2619,7 @@ void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::Directo
|
|||||||
keyValue("directory info from database",
|
keyValue("directory info from database",
|
||||||
directoryInfoFromDatabase)};
|
directoryInfoFromDatabase)};
|
||||||
|
|
||||||
s->updateDirectoryInfoStatement.write(directoryInfo.directorySourceId,
|
s->updateDirectoryInfoStatement.write(directoryInfo.directoryId,
|
||||||
directoryInfo.sourceId,
|
directoryInfo.sourceId,
|
||||||
directoryInfo.moduleId,
|
directoryInfo.moduleId,
|
||||||
directoryInfo.fileType);
|
directoryInfo.fileType);
|
||||||
@@ -2632,7 +2635,7 @@ void ProjectStorage::synchronizeDirectoryInfos(Storage::Synchronization::Directo
|
|||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("directory info", directoryInfo)};
|
keyValue("directory info", directoryInfo)};
|
||||||
|
|
||||||
s->deleteDirectoryInfoStatement.write(directoryInfo.directorySourceId, directoryInfo.sourceId);
|
s->deleteDirectoryInfoStatement.write(directoryInfo.directoryId, directoryInfo.sourceId);
|
||||||
};
|
};
|
||||||
|
|
||||||
Sqlite::insertUpdateDelete(range, directoryInfos, compareKey, insert, update, remove);
|
Sqlite::insertUpdateDelete(range, directoryInfos, compareKey, insert, update, remove);
|
||||||
@@ -4003,14 +4006,15 @@ void ProjectStorage::addTypeIdToPropertyEditorQmlPaths(
|
|||||||
path.typeId = fetchTypeIdByModuleIdAndExportedName(path.moduleId, path.typeName);
|
path.typeId = fetchTypeIdByModuleIdAndExportedName(path.moduleId, path.typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorage::synchronizePropertyEditorPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
void ProjectStorage::synchronizePropertyEditorPaths(
|
||||||
SourceIds updatedPropertyEditorQmlPathsSourceIds)
|
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
|
SourceContextIds updatedPropertyEditorQmlPathsSourceContextIds)
|
||||||
{
|
{
|
||||||
using Storage::Synchronization::PropertyEditorQmlPath;
|
using Storage::Synchronization::PropertyEditorQmlPath;
|
||||||
std::ranges::sort(paths, std::ranges::less{}, &PropertyEditorQmlPath::typeId);
|
std::ranges::sort(paths, std::ranges::less{}, &PropertyEditorQmlPath::typeId);
|
||||||
|
|
||||||
auto range = s->selectPropertyEditorPathsForForSourceIdsStatement.range<PropertyEditorQmlPathView>(
|
auto range = s->selectPropertyEditorPathsForForSourceIdsStatement.range<PropertyEditorQmlPathView>(
|
||||||
toIntegers(updatedPropertyEditorQmlPathsSourceIds));
|
toIntegers(updatedPropertyEditorQmlPathsSourceContextIds));
|
||||||
|
|
||||||
auto compareKey = [](const PropertyEditorQmlPathView &view, const PropertyEditorQmlPath &value) {
|
auto compareKey = [](const PropertyEditorQmlPathView &view, const PropertyEditorQmlPath &value) {
|
||||||
return view.typeId <=> value.typeId;
|
return view.typeId <=> value.typeId;
|
||||||
@@ -4057,7 +4061,7 @@ void ProjectStorage::synchronizePropertyEditorPaths(Storage::Synchronization::Pr
|
|||||||
|
|
||||||
void ProjectStorage::synchronizePropertyEditorQmlPaths(
|
void ProjectStorage::synchronizePropertyEditorQmlPaths(
|
||||||
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceIds updatedPropertyEditorQmlPathsSourceIds)
|
SourceContextIds updatedPropertyEditorQmlPathsSourceIds)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"synchronize property editor qml paths", projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"synchronize property editor qml paths", projectStorageCategory()};
|
||||||
|
|
||||||
|
@@ -105,9 +105,9 @@ public:
|
|||||||
|
|
||||||
Storage::Info::TypeHints typeHints(TypeId typeId) const override;
|
Storage::Info::TypeHints typeHints(TypeId typeId) const override;
|
||||||
|
|
||||||
SmallSourceIds<4> typeAnnotationSourceIds(SourceId directoryId) const override;
|
SmallSourceIds<4> typeAnnotationSourceIds(SourceContextId directoryId) const override;
|
||||||
|
|
||||||
SmallSourceIds<64> typeAnnotationDirectorySourceIds() const override;
|
SmallSourceContextIds<64> typeAnnotationDirectoryIds() const override;
|
||||||
|
|
||||||
Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const override;
|
Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const override;
|
||||||
|
|
||||||
@@ -222,11 +222,11 @@ public:
|
|||||||
|
|
||||||
std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const override;
|
std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const override;
|
||||||
|
|
||||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceId directorySourceId) const override;
|
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceContextId directoryId) const override;
|
||||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
||||||
SourceId directorySourceId, Storage::Synchronization::FileType fileType) const override;
|
SourceContextId directoryId, Storage::Synchronization::FileType fileType) const override;
|
||||||
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(const SourceIds &directorySourceIds) const;
|
Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(const SourceContextIds &directoryIds) const;
|
||||||
SmallSourceIds<32> fetchSubdirectorySourceIds(SourceId directorySourceId) const override;
|
SmallSourceContextIds<32> fetchSubdirectoryIds(SourceContextId directoryId) const override;
|
||||||
|
|
||||||
void setPropertyEditorPathId(TypeId typeId, SourceId pathId);
|
void setPropertyEditorPathId(TypeId typeId, SourceId pathId);
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ private:
|
|||||||
const SourceIds &updatedSourceIds);
|
const SourceIds &updatedSourceIds);
|
||||||
|
|
||||||
void synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
void synchronizeDirectoryInfos(Storage::Synchronization::DirectoryInfos &directoryInfos,
|
||||||
const SourceIds &updatedDirectoryInfoSourceIds);
|
const SourceContextIds &updatedDirectoryInfoDirectoryIds);
|
||||||
|
|
||||||
void synchronizeFileStatuses(FileStatuses &fileStatuses, const SourceIds &updatedSourceIds);
|
void synchronizeFileStatuses(FileStatuses &fileStatuses, const SourceIds &updatedSourceIds);
|
||||||
|
|
||||||
@@ -781,7 +781,7 @@ private:
|
|||||||
class PropertyEditorQmlPathView
|
class PropertyEditorQmlPathView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyEditorQmlPathView(TypeId typeId, SourceId pathId, SourceId directoryId)
|
PropertyEditorQmlPathView(TypeId typeId, SourceId pathId, SourceContextId directoryId)
|
||||||
: typeId{typeId}
|
: typeId{typeId}
|
||||||
, pathId{pathId}
|
, pathId{pathId}
|
||||||
, directoryId{directoryId}
|
, directoryId{directoryId}
|
||||||
@@ -803,14 +803,14 @@ private:
|
|||||||
public:
|
public:
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
SourceId pathId;
|
SourceId pathId;
|
||||||
SourceId directoryId;
|
SourceContextId directoryId;
|
||||||
};
|
};
|
||||||
|
|
||||||
void synchronizePropertyEditorPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
void synchronizePropertyEditorPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceIds updatedPropertyEditorQmlPathsSourceIds);
|
SourceContextIds updatedPropertyEditorQmlPathsSourceContextIds);
|
||||||
|
|
||||||
void synchronizePropertyEditorQmlPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
void synchronizePropertyEditorQmlPaths(Storage::Synchronization::PropertyEditorQmlPaths &paths,
|
||||||
SourceIds updatedPropertyEditorQmlPathsSourceIds);
|
SourceContextIds updatedPropertyEditorQmlPathsSourceIds);
|
||||||
|
|
||||||
void synchronizeFunctionDeclarations(
|
void synchronizeFunctionDeclarations(
|
||||||
TypeId typeId, Storage::Synchronization::FunctionDeclarations &functionsDeclarations);
|
TypeId typeId, Storage::Synchronization::FunctionDeclarations &functionsDeclarations);
|
||||||
|
@@ -58,8 +58,8 @@ public:
|
|||||||
= 0;
|
= 0;
|
||||||
virtual PropertyDeclarationId defaultPropertyDeclarationId(TypeId typeId) const = 0;
|
virtual PropertyDeclarationId defaultPropertyDeclarationId(TypeId typeId) const = 0;
|
||||||
virtual std::optional<Storage::Info::Type> type(TypeId typeId) const = 0;
|
virtual std::optional<Storage::Info::Type> type(TypeId typeId) const = 0;
|
||||||
virtual SmallSourceIds<4> typeAnnotationSourceIds(SourceId directoryId) const = 0;
|
virtual SmallSourceIds<4> typeAnnotationSourceIds(SourceContextId directoryId) const = 0;
|
||||||
virtual SmallSourceIds<64> typeAnnotationDirectorySourceIds() const = 0;
|
virtual SmallSourceContextIds<64> typeAnnotationDirectoryIds() const = 0;
|
||||||
virtual Utils::PathString typeIconPath(TypeId typeId) const = 0;
|
virtual Utils::PathString typeIconPath(TypeId typeId) const = 0;
|
||||||
virtual Storage::Info::TypeHints typeHints(TypeId typeId) const = 0;
|
virtual Storage::Info::TypeHints typeHints(TypeId typeId) const = 0;
|
||||||
virtual Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const = 0;
|
virtual Storage::Info::ItemLibraryEntries itemLibraryEntries(TypeId typeId) const = 0;
|
||||||
@@ -81,12 +81,13 @@ public:
|
|||||||
virtual bool isBasedOn(TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId) const = 0;
|
virtual bool isBasedOn(TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId, TypeId) const = 0;
|
||||||
|
|
||||||
virtual FileStatus fetchFileStatus(SourceId sourceId) const = 0;
|
virtual FileStatus fetchFileStatus(SourceId sourceId) const = 0;
|
||||||
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceId sourceId) const = 0;
|
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(SourceContextId directoryId) const = 0;
|
||||||
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
virtual Storage::Synchronization::DirectoryInfos fetchDirectoryInfos(
|
||||||
SourceId directorySourceId, Storage::Synchronization::FileType) const
|
SourceContextId directoryId, Storage::Synchronization::FileType) const
|
||||||
= 0;
|
= 0;
|
||||||
virtual std::optional<Storage::Synchronization::DirectoryInfo> fetchDirectoryInfo(SourceId sourceId) const = 0;
|
virtual std::optional<Storage::Synchronization::DirectoryInfo>
|
||||||
virtual SmallSourceIds<32> fetchSubdirectorySourceIds(SourceId directorySourceId) const = 0;
|
fetchDirectoryInfo(SourceId sourceId) const = 0;
|
||||||
|
virtual SmallSourceContextIds<32> fetchSubdirectoryIds(SourceContextId directoryId) const = 0;
|
||||||
|
|
||||||
virtual SourceId propertyEditorPathId(TypeId typeId) const = 0;
|
virtual SourceId propertyEditorPathId(TypeId typeId) const = 0;
|
||||||
virtual const Storage::Info::CommonTypeCache<ProjectStorageType> &commonTypeCache() const = 0;
|
virtual const Storage::Info::CommonTypeCache<ProjectStorageType> &commonTypeCache() const = 0;
|
||||||
|
@@ -1149,7 +1149,10 @@ using Types = std::vector<Type>;
|
|||||||
class PropertyEditorQmlPath
|
class PropertyEditorQmlPath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertyEditorQmlPath(ModuleId moduleId, TypeNameString typeName, SourceId pathId, SourceId directoryId)
|
PropertyEditorQmlPath(ModuleId moduleId,
|
||||||
|
TypeNameString typeName,
|
||||||
|
SourceId pathId,
|
||||||
|
SourceContextId directoryId)
|
||||||
: typeName{typeName}
|
: typeName{typeName}
|
||||||
, pathId{pathId}
|
, pathId{pathId}
|
||||||
, directoryId{directoryId}
|
, directoryId{directoryId}
|
||||||
@@ -1174,7 +1177,7 @@ public:
|
|||||||
TypeNameString typeName;
|
TypeNameString typeName;
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
SourceId pathId;
|
SourceId pathId;
|
||||||
SourceId directoryId;
|
SourceContextId directoryId;
|
||||||
ModuleId moduleId;
|
ModuleId moduleId;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1183,8 +1186,8 @@ using PropertyEditorQmlPaths = std::vector<class PropertyEditorQmlPath>;
|
|||||||
class DirectoryInfo
|
class DirectoryInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DirectoryInfo(SourceId directorySourceId, SourceId sourceId, ModuleId moduleId, FileType fileType)
|
DirectoryInfo(SourceContextId directoryId, SourceId sourceId, ModuleId moduleId, FileType fileType)
|
||||||
: directorySourceId{directorySourceId}
|
: directoryId{directoryId}
|
||||||
, sourceId{sourceId}
|
, sourceId{sourceId}
|
||||||
, moduleId{moduleId}
|
, moduleId{moduleId}
|
||||||
, fileType{fileType}
|
, fileType{fileType}
|
||||||
@@ -1192,7 +1195,7 @@ public:
|
|||||||
|
|
||||||
friend bool operator==(const DirectoryInfo &first, const DirectoryInfo &second)
|
friend bool operator==(const DirectoryInfo &first, const DirectoryInfo &second)
|
||||||
{
|
{
|
||||||
return first.directorySourceId == second.directorySourceId && first.sourceId == second.sourceId
|
return first.directoryId == second.directoryId && first.sourceId == second.sourceId
|
||||||
&& first.moduleId.internalId() == second.moduleId.internalId()
|
&& first.moduleId.internalId() == second.moduleId.internalId()
|
||||||
&& first.fileType == second.fileType;
|
&& first.fileType == second.fileType;
|
||||||
}
|
}
|
||||||
@@ -1202,7 +1205,7 @@ public:
|
|||||||
{
|
{
|
||||||
using NanotraceHR::dictonary;
|
using NanotraceHR::dictonary;
|
||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
auto dict = dictonary(keyValue("project source id", directoryInfo.directorySourceId),
|
auto dict = dictonary(keyValue("directory id", directoryInfo.directoryId),
|
||||||
keyValue("source id", directoryInfo.sourceId),
|
keyValue("source id", directoryInfo.sourceId),
|
||||||
keyValue("module id", directoryInfo.moduleId),
|
keyValue("module id", directoryInfo.moduleId),
|
||||||
keyValue("file type", directoryInfo.fileType));
|
keyValue("file type", directoryInfo.fileType));
|
||||||
@@ -1211,7 +1214,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SourceId directorySourceId;
|
SourceContextId directoryId;
|
||||||
SourceId sourceId;
|
SourceId sourceId;
|
||||||
ModuleId moduleId;
|
ModuleId moduleId;
|
||||||
FileType fileType;
|
FileType fileType;
|
||||||
@@ -1222,13 +1225,13 @@ using DirectoryInfos = std::vector<DirectoryInfo>;
|
|||||||
class TypeAnnotation
|
class TypeAnnotation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TypeAnnotation(SourceId sourceId, SourceId directorySourceId)
|
TypeAnnotation(SourceId sourceId, SourceContextId directoryId)
|
||||||
: sourceId{sourceId}
|
: sourceId{sourceId}
|
||||||
, directorySourceId{directorySourceId}
|
, directoryId{directoryId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TypeAnnotation(SourceId sourceId,
|
TypeAnnotation(SourceId sourceId,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Utils::SmallStringView iconPath,
|
Utils::SmallStringView iconPath,
|
||||||
@@ -1242,7 +1245,7 @@ public:
|
|||||||
, sourceId{sourceId}
|
, sourceId{sourceId}
|
||||||
, moduleId{moduleId}
|
, moduleId{moduleId}
|
||||||
, traits{traits}
|
, traits{traits}
|
||||||
, directorySourceId{directorySourceId}
|
, directoryId{directoryId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
template<typename String>
|
template<typename String>
|
||||||
@@ -1271,7 +1274,7 @@ public:
|
|||||||
SourceId sourceId;
|
SourceId sourceId;
|
||||||
ModuleId moduleId;
|
ModuleId moduleId;
|
||||||
TypeTraits traits;
|
TypeTraits traits;
|
||||||
SourceId directorySourceId;
|
SourceContextId directoryId;
|
||||||
};
|
};
|
||||||
|
|
||||||
using TypeAnnotations = std::vector<TypeAnnotation>;
|
using TypeAnnotations = std::vector<TypeAnnotation>;
|
||||||
@@ -1311,9 +1314,10 @@ public:
|
|||||||
, fileStatuses(std::move(fileStatuses))
|
, fileStatuses(std::move(fileStatuses))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SynchronizationPackage(SourceIds updatedDirectoryInfoSourceIds, DirectoryInfos directoryInfos)
|
SynchronizationPackage(SourceContextIds updatedDirectoryInfoDirectoryIds,
|
||||||
|
DirectoryInfos directoryInfos)
|
||||||
: directoryInfos(std::move(directoryInfos))
|
: directoryInfos(std::move(directoryInfos))
|
||||||
, updatedDirectoryInfoSourceIds(std::move(updatedDirectoryInfoSourceIds))
|
, updatedDirectoryInfoDirectoryIds(std::move(updatedDirectoryInfoDirectoryIds))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -1323,13 +1327,13 @@ public:
|
|||||||
SourceIds updatedFileStatusSourceIds;
|
SourceIds updatedFileStatusSourceIds;
|
||||||
FileStatuses fileStatuses;
|
FileStatuses fileStatuses;
|
||||||
DirectoryInfos directoryInfos;
|
DirectoryInfos directoryInfos;
|
||||||
SourceIds updatedDirectoryInfoSourceIds;
|
SourceContextIds updatedDirectoryInfoDirectoryIds;
|
||||||
Imports moduleDependencies;
|
Imports moduleDependencies;
|
||||||
SourceIds updatedModuleDependencySourceIds;
|
SourceIds updatedModuleDependencySourceIds;
|
||||||
ModuleExportedImports moduleExportedImports;
|
ModuleExportedImports moduleExportedImports;
|
||||||
ModuleIds updatedModuleIds;
|
ModuleIds updatedModuleIds;
|
||||||
PropertyEditorQmlPaths propertyEditorQmlPaths;
|
PropertyEditorQmlPaths propertyEditorQmlPaths;
|
||||||
SourceIds updatedPropertyEditorQmlPathSourceIds;
|
SourceContextIds updatedPropertyEditorQmlPathSourceContextIds;
|
||||||
TypeAnnotations typeAnnotations;
|
TypeAnnotations typeAnnotations;
|
||||||
SourceIds updatedTypeAnnotationSourceIds;
|
SourceIds updatedTypeAnnotationSourceIds;
|
||||||
};
|
};
|
||||||
|
@@ -88,11 +88,11 @@ ProjectStorageUpdater::Components createComponents(
|
|||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
ModuleId pathModuleId,
|
ModuleId pathModuleId,
|
||||||
FileSystemInterface &fileSystem,
|
FileSystemInterface &fileSystem,
|
||||||
const Utils::PathString &directory)
|
const QString &directory)
|
||||||
{
|
{
|
||||||
ProjectStorageUpdater::Components components;
|
ProjectStorageUpdater::Components components;
|
||||||
|
|
||||||
auto qmlFileNames = fileSystem.qmlFileNames(QString{directory});
|
auto qmlFileNames = fileSystem.qmlFileNames(directory);
|
||||||
|
|
||||||
components.reserve(static_cast<std::size_t>(qmlDirParserComponents.size() + qmlFileNames.size()));
|
components.reserve(static_cast<std::size_t>(qmlDirParserComponents.size() + qmlFileNames.size()));
|
||||||
|
|
||||||
@@ -250,8 +250,7 @@ std::vector<IdPaths> createIdPaths(ProjectStorageUpdater::WatchedSourceIdsIds wa
|
|||||||
std::vector<IdPaths> idPaths;
|
std::vector<IdPaths> idPaths;
|
||||||
idPaths.reserve(4);
|
idPaths.reserve(4);
|
||||||
|
|
||||||
idPaths.push_back(
|
idPaths.push_back({projectPartId, SourceType::Directory, std::move(watchedSourceIds.directoryIds)});
|
||||||
{projectPartId, SourceType::Directory, std::move(watchedSourceIds.directorySourceIds)});
|
|
||||||
idPaths.push_back({projectPartId, SourceType::QmlDir, std::move(watchedSourceIds.qmldirSourceIds)});
|
idPaths.push_back({projectPartId, SourceType::QmlDir, std::move(watchedSourceIds.qmldirSourceIds)});
|
||||||
idPaths.push_back({projectPartId, SourceType::Qml, std::move(watchedSourceIds.qmlSourceIds)});
|
idPaths.push_back({projectPartId, SourceType::Qml, std::move(watchedSourceIds.qmlSourceIds)});
|
||||||
idPaths.push_back(
|
idPaths.push_back(
|
||||||
@@ -304,11 +303,10 @@ ProjectStorageUpdater::FileState combineState(FileStates... fileStates)
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPath,
|
void ProjectStorageUpdater::updateDirectoryChanged(Utils::SmallStringView directoryPath,
|
||||||
FileState qmldirState,
|
FileState qmldirState,
|
||||||
SourcePath qmldirSourcePath,
|
SourcePath qmldirSourcePath,
|
||||||
SourceId qmldirSourceId,
|
SourceId qmldirSourceId,
|
||||||
SourceId directorySourceId,
|
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
@@ -341,7 +339,7 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
|
|||||||
tracer.tick("append updated module id", keyValue("module id", moduleId));
|
tracer.tick("append updated module id", keyValue("module id", moduleId));
|
||||||
package.updatedModuleIds.push_back(moduleId);
|
package.updatedModuleIds.push_back(moduleId);
|
||||||
|
|
||||||
const auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId);
|
const auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directoryId);
|
||||||
addSourceIds(package.updatedSourceIds, qmlDirectoryInfos, "append updated source id", tracer);
|
addSourceIds(package.updatedSourceIds, qmlDirectoryInfos, "append updated source id", tracer);
|
||||||
addSourceIds(package.updatedFileStatusSourceIds,
|
addSourceIds(package.updatedFileStatusSourceIds,
|
||||||
qmlDirectoryInfos,
|
qmlDirectoryInfos,
|
||||||
@@ -350,20 +348,24 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
|
|||||||
|
|
||||||
auto qmlTypes = filterMultipleEntries(parser.typeInfos());
|
auto qmlTypes = filterMultipleEntries(parser.typeInfos());
|
||||||
|
|
||||||
|
QString directoryPathAsQString{directoryPath};
|
||||||
|
|
||||||
if (!qmlTypes.isEmpty()) {
|
if (!qmlTypes.isEmpty()) {
|
||||||
parseTypeInfos(qmlTypes,
|
parseTypeInfos(qmlTypes,
|
||||||
filterMultipleEntries(parser.dependencies()),
|
filterMultipleEntries(parser.dependencies()),
|
||||||
imports,
|
imports,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
directoryPath,
|
directoryPathAsQString,
|
||||||
cppModuleId,
|
cppModuleId,
|
||||||
package,
|
package,
|
||||||
notUpdatedSourceIds,
|
notUpdatedSourceIds,
|
||||||
watchedSourceIdsIds);
|
watchedSourceIdsIds);
|
||||||
}
|
}
|
||||||
parseQmlComponents(
|
parseQmlComponents(createComponents(parser.components(),
|
||||||
createComponents(parser.components(), moduleId, pathModuleId, m_fileSystem, directoryPath),
|
moduleId,
|
||||||
directorySourceId,
|
pathModuleId,
|
||||||
|
m_fileSystem,
|
||||||
|
directoryPathAsQString),
|
||||||
directoryId,
|
directoryId,
|
||||||
package,
|
package,
|
||||||
notUpdatedSourceIds,
|
notUpdatedSourceIds,
|
||||||
@@ -371,7 +373,7 @@ void ProjectStorageUpdater::updateDirectoryChanged(std::string_view directoryPat
|
|||||||
qmldirState,
|
qmldirState,
|
||||||
qmldirSourceId);
|
qmldirSourceId);
|
||||||
tracer.tick("append updated project source id", keyValue("module id", moduleId));
|
tracer.tick("append updated project source id", keyValue("module id", moduleId));
|
||||||
package.updatedDirectoryInfoSourceIds.push_back(directorySourceId);
|
package.updatedDirectoryInfoDirectoryIds.push_back(directoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
||||||
@@ -386,7 +388,7 @@ void ProjectStorageUpdater::updateDirectories(const QStringList &directories,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &directoryPath,
|
void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &directoryPath,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
FileState directoryState,
|
FileState directoryState,
|
||||||
const SourceContextIds &subdirectoriesToIgnore,
|
const SourceContextIds &subdirectoriesToIgnore,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
@@ -395,51 +397,22 @@ void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &direct
|
|||||||
{
|
{
|
||||||
struct Directory
|
struct Directory
|
||||||
{
|
{
|
||||||
Directory(Utils::SmallStringView path, SourceId sourceId)
|
Directory(Utils::SmallStringView path, SourceContextId sourceContextId)
|
||||||
: path{path}
|
: path{path}
|
||||||
, sourceId{sourceId}
|
, sourceContextId{sourceContextId}
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool operator<(const Directory &other) const
|
|
||||||
{
|
|
||||||
return sourceId.contextId() < other.sourceId.contextId();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const Directory &other) const
|
|
||||||
{
|
|
||||||
return sourceId.contextId() == other.sourceId.contextId();
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils::PathString path;
|
Utils::PathString path;
|
||||||
SourceId sourceId;
|
SourceContextId sourceContextId;
|
||||||
};
|
|
||||||
|
|
||||||
struct Compare
|
|
||||||
{
|
|
||||||
bool operator()(const Directory &first, const Directory &second) const
|
|
||||||
{
|
|
||||||
return first.sourceId.contextId() < second.sourceId.contextId();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()(const Directory &first, SourceContextId second) const
|
|
||||||
{
|
|
||||||
return first.sourceId.contextId() < second;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator()(SourceContextId first, const Directory &second) const
|
|
||||||
{
|
|
||||||
return first < second.sourceId.contextId();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using Directories = QVarLengthArray<Directory, 32>;
|
using Directories = QVarLengthArray<Directory, 32>;
|
||||||
|
|
||||||
auto subdirectorySourceIds = m_projectStorage.fetchSubdirectorySourceIds(directorySourceId);
|
auto subdirectoryIds = m_projectStorage.fetchSubdirectoryIds(directoryId);
|
||||||
auto subdirectories = Utils::transform<Directories>(
|
auto subdirectories = Utils::transform<Directories>(
|
||||||
subdirectorySourceIds, [&](SourceId sourceId) -> Directory {
|
subdirectoryIds, [&](SourceContextId sourceContextId) -> Directory {
|
||||||
auto sourceContextId = sourceId.contextId();
|
|
||||||
auto subdirectoryPath = m_pathCache.sourceContextPath(sourceContextId);
|
auto subdirectoryPath = m_pathCache.sourceContextPath(sourceContextId);
|
||||||
return {subdirectoryPath, sourceId};
|
return {subdirectoryPath, sourceContextId};
|
||||||
});
|
});
|
||||||
|
|
||||||
auto exisitingSubdirectoryPaths = m_fileSystem.subdirectories(directoryPath.toQString());
|
auto exisitingSubdirectoryPaths = m_fileSystem.subdirectories(directoryPath.toQString());
|
||||||
@@ -449,32 +422,32 @@ void ProjectStorageUpdater::updateSubdirectories(const Utils::PathString &direct
|
|||||||
|| subdirectory.endsWith("/QtQuick/Scene3D"))
|
|| subdirectory.endsWith("/QtQuick/Scene3D"))
|
||||||
continue;
|
continue;
|
||||||
Utils::PathString subdirectoryPath = subdirectory;
|
Utils::PathString subdirectoryPath = subdirectory;
|
||||||
SourceId sourceId = m_pathCache.sourceId(SourcePath{subdirectoryPath + "/."});
|
SourceContextId sourceContextId = m_pathCache.sourceContextId(subdirectoryPath);
|
||||||
subdirectories.emplace_back(subdirectoryPath, sourceId);
|
subdirectories.emplace_back(subdirectoryPath, sourceContextId);
|
||||||
existingSubdirecories.emplace_back(subdirectoryPath, sourceId);
|
existingSubdirecories.emplace_back(subdirectoryPath, sourceContextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort(subdirectories.begin(), subdirectories.end());
|
std::ranges::sort(subdirectories, {}, &Directory::sourceContextId);
|
||||||
subdirectories.erase(std::unique(subdirectories.begin(), subdirectories.end()),
|
auto removed = std::ranges::unique(subdirectories, {}, &Directory::sourceContextId);
|
||||||
subdirectories.end());
|
subdirectories.erase(removed.begin(), removed.end());
|
||||||
|
|
||||||
std::set_difference(subdirectories.begin(),
|
Utils::set_greedy_difference(
|
||||||
subdirectories.end(),
|
subdirectories,
|
||||||
subdirectoriesToIgnore.begin(),
|
subdirectoriesToIgnore,
|
||||||
subdirectoriesToIgnore.end(),
|
[&](const Directory &subdirectory) {
|
||||||
Utils::make_iterator([&](const Directory &subdirectory) {
|
|
||||||
updateDirectory(subdirectory.path,
|
updateDirectory(subdirectory.path,
|
||||||
subdirectoriesToIgnore,
|
subdirectoriesToIgnore,
|
||||||
package,
|
package,
|
||||||
notUpdatedSourceIds,
|
notUpdatedSourceIds,
|
||||||
watchedSourceIdsIds);
|
watchedSourceIdsIds);
|
||||||
}),
|
},
|
||||||
Compare{});
|
{},
|
||||||
|
&Directory::sourceContextId);
|
||||||
|
|
||||||
if (directoryState == FileState::Changed) {
|
if (directoryState == FileState::Changed) {
|
||||||
for (const auto &[subdirectoryPath, subdirectorySourceId] : existingSubdirecories) {
|
for (const auto &[subdirectoryPath, subdirectoryId] : existingSubdirecories) {
|
||||||
package.directoryInfos.emplace_back(directorySourceId,
|
package.directoryInfos.emplace_back(directoryId,
|
||||||
subdirectorySourceId,
|
SourceId::create(SourceNameId{}, subdirectoryId),
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::Directory);
|
Storage::Synchronization::FileType::Directory);
|
||||||
}
|
}
|
||||||
@@ -492,11 +465,9 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
SourcePath qmldirSourcePath{directoryPath + "/qmldir"};
|
SourcePath qmldirSourcePath{directoryPath + "/qmldir"};
|
||||||
auto [directoryId, qmldirSourceId] = m_pathCache.sourceContextAndSourceId(qmldirSourcePath);
|
auto [directoryId, qmldirSourceId] = m_pathCache.sourceContextAndSourceId(qmldirSourcePath);
|
||||||
|
|
||||||
SourcePath directorySourcePath{directoryPath + "/."};
|
auto directoryState = fileState(directoryId, package, notUpdatedSourceIds);
|
||||||
auto directorySourceId = m_pathCache.sourceId(directorySourcePath);
|
|
||||||
auto directoryState = fileState(directorySourceId, package, notUpdatedSourceIds);
|
|
||||||
if (directoryState != FileState::NotExists)
|
if (directoryState != FileState::NotExists)
|
||||||
watchedSourceIdsIds.directorySourceIds.push_back(directorySourceId);
|
watchedSourceIdsIds.directoryIds.push_back(SourceId::create(SourceNameId{}, directoryId));
|
||||||
|
|
||||||
auto qmldirState = fileState(qmldirSourceId, package, notUpdatedSourceIds);
|
auto qmldirState = fileState(qmldirSourceId, package, notUpdatedSourceIds);
|
||||||
if (qmldirState != FileState::NotExists)
|
if (qmldirState != FileState::NotExists)
|
||||||
@@ -509,7 +480,6 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
qmldirState,
|
qmldirState,
|
||||||
qmldirSourcePath,
|
qmldirSourcePath,
|
||||||
qmldirSourceId,
|
qmldirSourceId,
|
||||||
directorySourceId,
|
|
||||||
directoryId,
|
directoryId,
|
||||||
package,
|
package,
|
||||||
notUpdatedSourceIds,
|
notUpdatedSourceIds,
|
||||||
@@ -520,7 +490,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
case FileState::NotChanged: {
|
case FileState::NotChanged: {
|
||||||
tracer.tick("update directory not changed");
|
tracer.tick("update directory not changed");
|
||||||
|
|
||||||
parseDirectoryInfos(m_projectStorage.fetchDirectoryInfos(directorySourceId),
|
parseDirectoryInfos(m_projectStorage.fetchDirectoryInfos(directoryId),
|
||||||
package,
|
package,
|
||||||
notUpdatedSourceIds,
|
notUpdatedSourceIds,
|
||||||
watchedSourceIdsIds);
|
watchedSourceIdsIds);
|
||||||
@@ -529,11 +499,12 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
case FileState::NotExists: {
|
case FileState::NotExists: {
|
||||||
tracer.tick("update directory don't exits");
|
tracer.tick("update directory don't exits");
|
||||||
|
|
||||||
|
auto directorySourceId = SourceId::create(SourceNameId{}, directoryId);
|
||||||
package.updatedFileStatusSourceIds.push_back(directorySourceId);
|
package.updatedFileStatusSourceIds.push_back(directorySourceId);
|
||||||
package.updatedFileStatusSourceIds.push_back(qmldirSourceId);
|
package.updatedFileStatusSourceIds.push_back(qmldirSourceId);
|
||||||
package.updatedDirectoryInfoSourceIds.push_back(directorySourceId);
|
package.updatedDirectoryInfoDirectoryIds.push_back(directoryId);
|
||||||
package.updatedSourceIds.push_back(qmldirSourceId);
|
package.updatedSourceIds.push_back(qmldirSourceId);
|
||||||
auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directorySourceId);
|
auto qmlDirectoryInfos = m_projectStorage.fetchDirectoryInfos(directoryId);
|
||||||
for (const Storage::Synchronization::DirectoryInfo &directoryInfo : qmlDirectoryInfos) {
|
for (const Storage::Synchronization::DirectoryInfo &directoryInfo : qmlDirectoryInfos) {
|
||||||
tracer.tick("append updated source id", keyValue("source id", directoryInfo.sourceId));
|
tracer.tick("append updated source id", keyValue("source id", directoryInfo.sourceId));
|
||||||
package.updatedSourceIds.push_back(directoryInfo.sourceId);
|
package.updatedSourceIds.push_back(directoryInfo.sourceId);
|
||||||
@@ -547,7 +518,7 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateSubdirectories(directoryPath,
|
updateSubdirectories(directoryPath,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
directoryState,
|
directoryState,
|
||||||
subdirectoriesToIgnore,
|
subdirectoriesToIgnore,
|
||||||
package,
|
package,
|
||||||
@@ -555,10 +526,8 @@ void ProjectStorageUpdater::updateDirectory(const Utils::PathString &directoryPa
|
|||||||
watchedSourceIdsIds);
|
watchedSourceIdsIds);
|
||||||
|
|
||||||
tracer.end(keyValue("qmldir source path", qmldirSourcePath),
|
tracer.end(keyValue("qmldir source path", qmldirSourcePath),
|
||||||
keyValue("directory source path", directorySourcePath),
|
|
||||||
keyValue("directory id", directoryId),
|
keyValue("directory id", directoryId),
|
||||||
keyValue("qmldir source id", qmldirSourceId),
|
keyValue("qmldir source id", qmldirSourceId),
|
||||||
keyValue("directory source source id", directorySourceId),
|
|
||||||
keyValue("qmldir state", qmldirState),
|
keyValue("qmldir state", qmldirState),
|
||||||
keyValue("directory state", directoryState));
|
keyValue("directory state", directoryState));
|
||||||
}
|
}
|
||||||
@@ -582,14 +551,15 @@ void ProjectStorageUpdater::updatePropertyEditorPaths(
|
|||||||
while (dirIterator.hasNext()) {
|
while (dirIterator.hasNext()) {
|
||||||
auto pathInfo = dirIterator.nextFileInfo();
|
auto pathInfo = dirIterator.nextFileInfo();
|
||||||
|
|
||||||
SourceId directorySourceId = m_pathCache.sourceId(SourcePath{pathInfo.filePath() + "/."});
|
SourceContextId directoryId = m_pathCache.sourceContextId(
|
||||||
|
Utils::PathString{pathInfo.filePath()});
|
||||||
|
|
||||||
auto state = fileState(directorySourceId, package, notUpdatedSourceIds);
|
auto state = fileState(directoryId, package, notUpdatedSourceIds);
|
||||||
|
|
||||||
if (state == FileState::Changed) {
|
if (state == FileState::Changed) {
|
||||||
updatePropertyEditorPath(pathInfo.filePath(),
|
updatePropertyEditorPath(pathInfo.filePath(),
|
||||||
package,
|
package,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
propertyEditorResourcesPath.size() + 1);
|
propertyEditorResourcesPath.size() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -618,9 +588,9 @@ void ProjectStorageUpdater::updateTypeAnnotations(const QStringList &directoryPa
|
|||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer("update type annotations", category());
|
NanotraceHR::Tracer tracer("update type annotations", category());
|
||||||
|
|
||||||
std::map<SourceId, SmallSourceIds<16>> updatedSourceIdsDictonary;
|
std::map<SourceContextId, SmallSourceIds<16>> updatedSourceIdsDictonary;
|
||||||
|
|
||||||
for (SourceId directoryId : m_projectStorage.typeAnnotationDirectorySourceIds())
|
for (SourceContextId directoryId : m_projectStorage.typeAnnotationDirectoryIds())
|
||||||
updatedSourceIdsDictonary[directoryId] = {};
|
updatedSourceIdsDictonary[directoryId] = {};
|
||||||
|
|
||||||
for (const auto &directoryPath : directoryPaths)
|
for (const auto &directoryPath : directoryPaths)
|
||||||
@@ -633,7 +603,7 @@ void ProjectStorageUpdater::updateTypeAnnotations(
|
|||||||
const QString &rootDirectoryPath,
|
const QString &rootDirectoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer("update type annotation directory",
|
NanotraceHR::Tracer tracer("update type annotation directory",
|
||||||
category(),
|
category(),
|
||||||
@@ -654,28 +624,28 @@ void ProjectStorageUpdater::updateTypeAnnotations(
|
|||||||
|
|
||||||
auto directoryPath = fileInfo.canonicalPath();
|
auto directoryPath = fileInfo.canonicalPath();
|
||||||
|
|
||||||
SourceId directorySourceId = m_pathCache.sourceId(SourcePath{directoryPath + "/."});
|
SourceContextId directoryId = m_pathCache.sourceContextId(Utils::PathString{directoryPath});
|
||||||
|
|
||||||
auto state = fileState(sourceId, package, notUpdatedSourceIds);
|
auto state = fileState(sourceId, package, notUpdatedSourceIds);
|
||||||
if (state == FileState::Changed)
|
if (state == FileState::Changed)
|
||||||
updateTypeAnnotation(directoryPath, fileInfo.filePath(), sourceId, directorySourceId, package);
|
updateTypeAnnotation(directoryPath, fileInfo.filePath(), sourceId, directoryId, package);
|
||||||
|
|
||||||
if (state != FileState::NotChanged)
|
if (state != FileState::NotChanged)
|
||||||
updatedSourceIdsDictonary[directorySourceId].push_back(sourceId);
|
updatedSourceIdsDictonary[directoryId].push_back(sourceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorageUpdater::updateTypeAnnotationDirectories(
|
void ProjectStorageUpdater::updateTypeAnnotationDirectories(
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary)
|
||||||
{
|
{
|
||||||
for (auto &[directorySourceId, updatedSourceIds] : updatedSourceIdsDictonary) {
|
for (auto &[directoryId, updatedSourceIds] : updatedSourceIdsDictonary) {
|
||||||
auto directoryState = fileState(directorySourceId, package, notUpdatedSourceIds);
|
auto directoryState = fileState(directoryId, package, notUpdatedSourceIds);
|
||||||
|
|
||||||
if (directoryState != FileState::NotChanged) {
|
if (directoryState != FileState::NotChanged) {
|
||||||
auto existingTypeAnnotationSourceIds = m_projectStorage.typeAnnotationSourceIds(
|
auto existingTypeAnnotationSourceIds = m_projectStorage.typeAnnotationSourceIds(
|
||||||
directorySourceId);
|
directoryId);
|
||||||
|
|
||||||
std::sort(updatedSourceIds.begin(), updatedSourceIds.end());
|
std::sort(updatedSourceIds.begin(), updatedSourceIds.end());
|
||||||
|
|
||||||
@@ -705,7 +675,7 @@ QString contentFromFile(const QString &path)
|
|||||||
void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
||||||
const QString &filePath,
|
const QString &filePath,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package)
|
Storage::Synchronization::SynchronizationPackage &package)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"update type annotation path",
|
NanotraceHR::Tracer tracer{"update type annotation path",
|
||||||
@@ -718,7 +688,7 @@ void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
|||||||
auto annotations = reader.parseTypeAnnotation(contentFromFile(filePath),
|
auto annotations = reader.parseTypeAnnotation(contentFromFile(filePath),
|
||||||
directoryPath,
|
directoryPath,
|
||||||
sourceId,
|
sourceId,
|
||||||
directorySourceId);
|
directoryId);
|
||||||
auto &typeAnnotations = package.typeAnnotations;
|
auto &typeAnnotations = package.typeAnnotations;
|
||||||
package.typeAnnotations.insert(typeAnnotations.end(),
|
package.typeAnnotations.insert(typeAnnotations.end(),
|
||||||
std::make_move_iterator(annotations.begin()),
|
std::make_move_iterator(annotations.begin()),
|
||||||
@@ -728,33 +698,33 @@ void ProjectStorageUpdater::updateTypeAnnotation(const QString &directoryPath,
|
|||||||
void ProjectStorageUpdater::updatePropertyEditorPath(
|
void ProjectStorageUpdater::updatePropertyEditorPath(
|
||||||
const QString &directoryPath,
|
const QString &directoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
long long pathOffset)
|
long long pathOffset)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"update property editor path",
|
NanotraceHR::Tracer tracer{"update property editor path",
|
||||||
category(),
|
category(),
|
||||||
keyValue("directory path", directoryPath),
|
keyValue("directory path", directoryPath),
|
||||||
keyValue("directory source id", directorySourceId)};
|
keyValue("directory id", directoryId)};
|
||||||
|
|
||||||
tracer.tick("append updated property editor qml path source id",
|
tracer.tick("append updated property editor qml path source id",
|
||||||
keyValue("source id", directorySourceId));
|
keyValue("source id", directoryId));
|
||||||
package.updatedPropertyEditorQmlPathSourceIds.push_back(directorySourceId);
|
package.updatedPropertyEditorQmlPathSourceContextIds.push_back(directoryId);
|
||||||
auto dir = QDir{directoryPath};
|
auto dir = QDir{directoryPath};
|
||||||
const auto fileInfos = dir.entryInfoList({"*Pane.qml", "*Specifics.qml"}, QDir::Files);
|
const auto fileInfos = dir.entryInfoList({"*Pane.qml", "*Specifics.qml"}, QDir::Files);
|
||||||
for (const auto &fileInfo : fileInfos)
|
for (const auto &fileInfo : fileInfos)
|
||||||
updatePropertyEditorFilePath(fileInfo.filePath(), package, directorySourceId, pathOffset);
|
updatePropertyEditorFilePath(fileInfo.filePath(), package, directoryId, pathOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
||||||
const QString &path,
|
const QString &path,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
long long pathOffset)
|
long long pathOffset)
|
||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"update property editor file path",
|
NanotraceHR::Tracer tracer{"update property editor file path",
|
||||||
category(),
|
category(),
|
||||||
keyValue("directory path", path),
|
keyValue("directory path", path),
|
||||||
keyValue("directory source id", directorySourceId)};
|
keyValue("directory id", directoryId)};
|
||||||
|
|
||||||
QRegularExpression regex{R"xo((.+)\/(\w+)(Specifics|Pane).qml)xo"};
|
QRegularExpression regex{R"xo((.+)\/(\w+)(Specifics|Pane).qml)xo"};
|
||||||
auto match = regex.match(QStringView{path}.mid(pathOffset));
|
auto match = regex.match(QStringView{path}.mid(pathOffset));
|
||||||
@@ -773,7 +743,7 @@ void ProjectStorageUpdater::updatePropertyEditorFilePath(
|
|||||||
const auto &paths = package.propertyEditorQmlPaths.emplace_back(moduleId,
|
const auto &paths = package.propertyEditorQmlPaths.emplace_back(moduleId,
|
||||||
typeName,
|
typeName,
|
||||||
pathId,
|
pathId,
|
||||||
directorySourceId);
|
directoryId);
|
||||||
tracer.tick("append property editor qml paths",
|
tracer.tick("append property editor qml paths",
|
||||||
keyValue("property editor qml paths", paths));
|
keyValue("property editor qml paths", paths));
|
||||||
}
|
}
|
||||||
@@ -848,26 +818,22 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto directorySourceContextIds = filterUniqueSourceContextIds(directorySourceIds);
|
auto directoryIds = filterUniqueSourceContextIds(directorySourceIds);
|
||||||
|
|
||||||
for (auto sourceContextId : directorySourceContextIds) {
|
for (auto directoryId : directoryIds) {
|
||||||
Utils::PathString directory = m_pathCache.sourceContextPath(sourceContextId);
|
Utils::PathString directory = m_pathCache.sourceContextPath(directoryId);
|
||||||
updateDirectory(directory,
|
updateDirectory(directory, directoryIds, package, notUpdatedSourceIds, watchedSourceIds);
|
||||||
directorySourceContextIds,
|
|
||||||
package,
|
|
||||||
notUpdatedSourceIds,
|
|
||||||
watchedSourceIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SourceId sourceId : filterUniqueSourceIds(qmlDocumentSourceIds)) {
|
for (SourceId sourceId : filterUniqueSourceIds(qmlDocumentSourceIds)) {
|
||||||
if (!contains(directorySourceContextIds, sourceId.contextId()))
|
if (!contains(directoryIds, sourceId.contextId()))
|
||||||
parseQmlComponent(sourceId, package, notUpdatedSourceIds);
|
parseQmlComponent(sourceId, package, notUpdatedSourceIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmltypesSourceIds))) {
|
for (SourceId sourceId : filterUniqueSourceIds(std::move(qmltypesSourceIds))) {
|
||||||
if (!contains(directorySourceContextIds, sourceId.contextId())) {
|
if (!contains(directoryIds, sourceId.contextId())) {
|
||||||
auto qmltypesPath = m_pathCache.sourcePath(sourceId);
|
QString qmltypesPath{m_pathCache.sourcePath(sourceId)};
|
||||||
auto directoryInfo = m_projectStorage.fetchDirectoryInfo(sourceId);
|
auto directoryInfo = m_projectStorage.fetchDirectoryInfo(sourceId);
|
||||||
if (directoryInfo)
|
if (directoryInfo)
|
||||||
parseTypeInfo(*directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
parseTypeInfo(*directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
||||||
@@ -889,9 +855,9 @@ void ProjectStorageUpdater::pathsWithIdsChanged(const std::vector<IdPaths> &chan
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (directorySourceContextIds.size()) {
|
if (directoryIds.size()) {
|
||||||
m_pathWatcher.updateContextIdPaths(createIdPaths(watchedSourceIds, m_projectPartId),
|
m_pathWatcher.updateContextIdPaths(createIdPaths(watchedSourceIds, m_projectPartId),
|
||||||
directorySourceContextIds);
|
directoryIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_changedIdPaths.clear();
|
m_changedIdPaths.clear();
|
||||||
@@ -902,8 +868,8 @@ void ProjectStorageUpdater::pathsChanged(const SourceIds &) {}
|
|||||||
void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
||||||
const QList<QmlDirParser::Import> &qmldirDependencies,
|
const QList<QmlDirParser::Import> &qmldirDependencies,
|
||||||
const QList<QmlDirParser::Import> &qmldirImports,
|
const QList<QmlDirParser::Import> &qmldirImports,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Utils::SmallStringView directoryPath,
|
const QString &directoryPath,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
@@ -911,16 +877,15 @@ void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
|||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"parse type infos",
|
NanotraceHR::Tracer tracer{"parse type infos",
|
||||||
category(),
|
category(),
|
||||||
keyValue("directory source id", directorySourceId),
|
keyValue("directory id", directoryId),
|
||||||
keyValue("directory path", directoryPath),
|
keyValue("directory path", directoryPath),
|
||||||
keyValue("module id", moduleId)};
|
keyValue("module id", moduleId)};
|
||||||
|
|
||||||
for (const QString &typeInfo : typeInfos) {
|
for (const QString &typeInfo : typeInfos) {
|
||||||
NanotraceHR::Tracer tracer{"parse type info", category(), keyValue("type info", typeInfo)};
|
NanotraceHR::Tracer tracer{"parse type info", category(), keyValue("type info", typeInfo)};
|
||||||
|
|
||||||
Utils::PathString qmltypesPath = Utils::PathString::join(
|
Utils::PathString qmltypesFileName = typeInfo;
|
||||||
{directoryPath, "/", Utils::SmallString{typeInfo}});
|
SourceId sourceId = m_pathCache.sourceId(directoryId, qmltypesFileName);
|
||||||
SourceId sourceId = m_pathCache.sourceId(SourcePathView{qmltypesPath});
|
|
||||||
|
|
||||||
tracer.tick("append qmltypes source id", keyValue("source id", sourceId));
|
tracer.tick("append qmltypes source id", keyValue("source id", sourceId));
|
||||||
watchedSourceIds.qmltypesSourceIds.push_back(sourceId);
|
watchedSourceIds.qmltypesSourceIds.push_back(sourceId);
|
||||||
@@ -936,9 +901,11 @@ void ProjectStorageUpdater::parseTypeInfos(const QStringList &typeInfos,
|
|||||||
package.updatedModuleDependencySourceIds.push_back(sourceId);
|
package.updatedModuleDependencySourceIds.push_back(sourceId);
|
||||||
|
|
||||||
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
||||||
directorySourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes);
|
directoryId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes);
|
||||||
tracer.tick("append project data", keyValue("source id", sourceId));
|
tracer.tick("append project data", keyValue("source id", sourceId));
|
||||||
|
|
||||||
|
const QString qmltypesPath = directoryPath + "/" + typeInfo;
|
||||||
|
|
||||||
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -956,7 +923,7 @@ void ProjectStorageUpdater::parseDirectoryInfos(
|
|||||||
case Storage::Synchronization::FileType::QmlTypes: {
|
case Storage::Synchronization::FileType::QmlTypes: {
|
||||||
watchedSourceIds.qmltypesSourceIds.push_back(directoryInfo.sourceId);
|
watchedSourceIds.qmltypesSourceIds.push_back(directoryInfo.sourceId);
|
||||||
|
|
||||||
auto qmltypesPath = m_pathCache.sourcePath(directoryInfo.sourceId);
|
QString qmltypesPath{m_pathCache.sourcePath(directoryInfo.sourceId)};
|
||||||
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
parseTypeInfo(directoryInfo, qmltypesPath, package, notUpdatedSourceIds);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -973,7 +940,7 @@ void ProjectStorageUpdater::parseDirectoryInfos(
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
||||||
Utils::SmallStringView qmltypesPath,
|
const QString &qmltypesPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds) -> FileState
|
NotUpdatedSourceIds ¬UpdatedSourceIds) -> FileState
|
||||||
{
|
{
|
||||||
@@ -987,7 +954,7 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Direct
|
|||||||
tracer.tick("append updated source ids", keyValue("source id", directoryInfo.sourceId));
|
tracer.tick("append updated source ids", keyValue("source id", directoryInfo.sourceId));
|
||||||
package.updatedSourceIds.push_back(directoryInfo.sourceId);
|
package.updatedSourceIds.push_back(directoryInfo.sourceId);
|
||||||
|
|
||||||
const auto content = m_fileSystem.contentAsQString(QString{qmltypesPath});
|
const auto content = m_fileSystem.contentAsQString(qmltypesPath);
|
||||||
m_qmlTypesParser.parse(content, package.imports, package.types, directoryInfo);
|
m_qmlTypesParser.parse(content, package.imports, package.types, directoryInfo);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1008,7 +975,7 @@ auto ProjectStorageUpdater::parseTypeInfo(const Storage::Synchronization::Direct
|
|||||||
void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFilePath,
|
void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFilePath,
|
||||||
Utils::SmallStringView directoryPath,
|
Utils::SmallStringView directoryPath,
|
||||||
Storage::Synchronization::ExportedTypes exportedTypes,
|
Storage::Synchronization::ExportedTypes exportedTypes,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIdsIds &watchedSourceIds,
|
WatchedSourceIdsIds &watchedSourceIds,
|
||||||
@@ -1020,7 +987,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
|||||||
keyValue("relative file path", relativeFilePath),
|
keyValue("relative file path", relativeFilePath),
|
||||||
keyValue("directory path", directoryPath),
|
keyValue("directory path", directoryPath),
|
||||||
keyValue("exported types", exportedTypes),
|
keyValue("exported types", exportedTypes),
|
||||||
keyValue("directory source id", directorySourceId),
|
keyValue("directory id", directoryId),
|
||||||
keyValue("qmldir state", qmldirState)};
|
keyValue("qmldir state", qmldirState)};
|
||||||
|
|
||||||
if (std::find(relativeFilePath.begin(), relativeFilePath.end(), '+') != relativeFilePath.end())
|
if (std::find(relativeFilePath.begin(), relativeFilePath.end(), '+') != relativeFilePath.end())
|
||||||
@@ -1042,7 +1009,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
|||||||
notUpdatedSourceIds.sourceIds.emplace_back(sourceId);
|
notUpdatedSourceIds.sourceIds.emplace_back(sourceId);
|
||||||
|
|
||||||
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
||||||
directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
|
directoryId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
|
||||||
tracer.tick("append project data", keyValue("project data", directoryInfo));
|
tracer.tick("append project data", keyValue("project data", directoryInfo));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1065,7 +1032,7 @@ void ProjectStorageUpdater::parseQmlComponent(Utils::SmallStringView relativeFil
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
const auto &directoryInfo = package.directoryInfos.emplace_back(
|
||||||
directorySourceId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
|
directoryId, sourceId, ModuleId{}, Storage::Synchronization::FileType::QmlDocument);
|
||||||
tracer.tick("append project data", keyValue("project data", directoryInfo));
|
tracer.tick("append project data", keyValue("project data", directoryInfo));
|
||||||
|
|
||||||
tracer.tick("append updated source id", keyValue("source id", sourceId));
|
tracer.tick("append updated source id", keyValue("source id", sourceId));
|
||||||
@@ -1111,6 +1078,15 @@ void ProjectStorageUpdater::parseQmlComponent(SourceId sourceId,
|
|||||||
package.types.push_back(std::move(type));
|
package.types.push_back(std::move(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectStorageUpdater::FileState ProjectStorageUpdater::fileState(
|
||||||
|
SourceContextId sourceContextId,
|
||||||
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
|
NotUpdatedSourceIds ¬UpdatedSourceIds) const
|
||||||
|
{
|
||||||
|
auto sourceId = SourceId::create(SourceNameId{}, sourceContextId);
|
||||||
|
return fileState(sourceId, package, notUpdatedSourceIds);
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
@@ -1166,7 +1142,6 @@ Storage::Synchronization::ExportedTypes createExportedTypes(ProjectStorageUpdate
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void ProjectStorageUpdater::parseQmlComponents(Components components,
|
void ProjectStorageUpdater::parseQmlComponents(Components components,
|
||||||
SourceId directorySourceId,
|
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
@@ -1176,7 +1151,6 @@ void ProjectStorageUpdater::parseQmlComponents(Components components,
|
|||||||
{
|
{
|
||||||
NanotraceHR::Tracer tracer{"parse qml components",
|
NanotraceHR::Tracer tracer{"parse qml components",
|
||||||
category(),
|
category(),
|
||||||
keyValue("directory source id", directorySourceId),
|
|
||||||
keyValue("directory id", directoryId),
|
keyValue("directory id", directoryId),
|
||||||
keyValue("qmldir state", qmldirState)};
|
keyValue("qmldir state", qmldirState)};
|
||||||
|
|
||||||
@@ -1191,7 +1165,7 @@ void ProjectStorageUpdater::parseQmlComponents(Components components,
|
|||||||
parseQmlComponent(fileName,
|
parseQmlComponent(fileName,
|
||||||
directoryPath,
|
directoryPath,
|
||||||
createExportedTypes(componentsWithSameFileName),
|
createExportedTypes(componentsWithSameFileName),
|
||||||
directorySourceId,
|
directoryId,
|
||||||
package,
|
package,
|
||||||
notUpdatedSourceIds,
|
notUpdatedSourceIds,
|
||||||
watchedSourceIdsIds,
|
watchedSourceIdsIds,
|
||||||
|
@@ -114,13 +114,13 @@ public:
|
|||||||
{
|
{
|
||||||
WatchedSourceIdsIds(std::size_t reserve)
|
WatchedSourceIdsIds(std::size_t reserve)
|
||||||
{
|
{
|
||||||
directorySourceIds.reserve(reserve);
|
directoryIds.reserve(reserve);
|
||||||
qmldirSourceIds.reserve(reserve);
|
qmldirSourceIds.reserve(reserve);
|
||||||
qmlSourceIds.reserve(reserve * 30);
|
qmlSourceIds.reserve(reserve * 30);
|
||||||
qmltypesSourceIds.reserve(reserve * 30);
|
qmltypesSourceIds.reserve(reserve * 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceIds directorySourceIds;
|
SourceIds directoryIds;
|
||||||
SourceIds qmldirSourceIds;
|
SourceIds qmldirSourceIds;
|
||||||
SourceIds qmlSourceIds;
|
SourceIds qmlSourceIds;
|
||||||
SourceIds qmltypesSourceIds;
|
SourceIds qmltypesSourceIds;
|
||||||
@@ -150,17 +150,16 @@ private:
|
|||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIdsIds &watchedSourceIdsIds);
|
WatchedSourceIdsIds &watchedSourceIdsIds);
|
||||||
void updateSubdirectories(const Utils::PathString &directory,
|
void updateSubdirectories(const Utils::PathString &directory,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
FileState directoryFileState,
|
FileState directoryFileState,
|
||||||
const SourceContextIds &subdirecoriesToIgnore,
|
const SourceContextIds &subdirecoriesToIgnore,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIdsIds &watchedSourceIdsIds);
|
WatchedSourceIdsIds &watchedSourceIdsIds);
|
||||||
void updateDirectoryChanged(std::string_view directoryPath,
|
void updateDirectoryChanged(Utils::SmallStringView directoryPath,
|
||||||
FileState qmldirState,
|
FileState qmldirState,
|
||||||
SourcePath qmldirSourcePath,
|
SourcePath qmldirSourcePath,
|
||||||
SourceId qmldirSourceId,
|
SourceId qmldirSourceId,
|
||||||
SourceId directorySourceId,
|
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
@@ -173,31 +172,32 @@ private:
|
|||||||
void updateTypeAnnotations(const QString &directoryPath,
|
void updateTypeAnnotations(const QString &directoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
||||||
void updateTypeAnnotationDirectories(Storage::Synchronization::SynchronizationPackage &package,
|
void updateTypeAnnotationDirectories(
|
||||||
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
std::map<SourceId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
std::map<SourceContextId, SmallSourceIds<16>> &updatedSourceIdsDictonary);
|
||||||
void updateTypeAnnotations(const QStringList &directoryPath,
|
void updateTypeAnnotations(const QStringList &directoryPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
||||||
void updateTypeAnnotation(const QString &directoryPath,
|
void updateTypeAnnotation(const QString &directoryPath,
|
||||||
const QString &filePath,
|
const QString &filePath,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package);
|
Storage::Synchronization::SynchronizationPackage &package);
|
||||||
void updatePropertyEditorPath(const QString &path,
|
void updatePropertyEditorPath(const QString &path,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
long long pathOffset);
|
long long pathOffset);
|
||||||
void updatePropertyEditorFilePath(const QString &filePath,
|
void updatePropertyEditorFilePath(const QString &filePath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
long long pathOffset);
|
long long pathOffset);
|
||||||
void parseTypeInfos(const QStringList &typeInfos,
|
void parseTypeInfos(const QStringList &typeInfos,
|
||||||
const QList<QmlDirParser::Import> &qmldirDependencies,
|
const QList<QmlDirParser::Import> &qmldirDependencies,
|
||||||
const QList<QmlDirParser::Import> &qmldirImports,
|
const QList<QmlDirParser::Import> &qmldirImports,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Utils::SmallStringView directoryPath,
|
const QString &directoryPath,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
@@ -207,11 +207,10 @@ private:
|
|||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIdsIds &watchedSourceIdsIds);
|
WatchedSourceIdsIds &watchedSourceIdsIds);
|
||||||
FileState parseTypeInfo(const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
FileState parseTypeInfo(const Storage::Synchronization::DirectoryInfo &directoryInfo,
|
||||||
Utils::SmallStringView qmltypesPath,
|
const QString &qmltypesPath,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
NotUpdatedSourceIds ¬UpdatedSourceIds);
|
||||||
void parseQmlComponents(Components components,
|
void parseQmlComponents(Components components,
|
||||||
SourceId directorySourceId,
|
|
||||||
SourceContextId directoryId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
@@ -221,7 +220,7 @@ private:
|
|||||||
void parseQmlComponent(Utils::SmallStringView fileName,
|
void parseQmlComponent(Utils::SmallStringView fileName,
|
||||||
Utils::SmallStringView directory,
|
Utils::SmallStringView directory,
|
||||||
Storage::Synchronization::ExportedTypes exportedTypes,
|
Storage::Synchronization::ExportedTypes exportedTypes,
|
||||||
SourceId directorySourceId,
|
SourceContextId directoryId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
NotUpdatedSourceIds ¬UpdatedSourceIds,
|
||||||
WatchedSourceIdsIds &watchedSourceIdsIds,
|
WatchedSourceIdsIds &watchedSourceIdsIds,
|
||||||
@@ -234,6 +233,9 @@ private:
|
|||||||
FileState fileState(SourceId sourceId,
|
FileState fileState(SourceId sourceId,
|
||||||
Storage::Synchronization::SynchronizationPackage &package,
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
||||||
|
FileState fileState(SourceContextId sourceContextId,
|
||||||
|
Storage::Synchronization::SynchronizationPackage &package,
|
||||||
|
NotUpdatedSourceIds ¬UpdatedSourceIds) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<IdPaths> m_changedIdPaths;
|
std::vector<IdPaths> m_changedIdPaths;
|
||||||
|
@@ -28,10 +28,10 @@ constexpr auto extraFileElementName = "ExtraFile"_L1;
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Synchronization::TypeAnnotations TypeAnnotationReader::parseTypeAnnotation(
|
Synchronization::TypeAnnotations TypeAnnotationReader::parseTypeAnnotation(
|
||||||
const QString &content, const QString &directoryPath, SourceId sourceId, SourceId directorySourceId)
|
const QString &content, const QString &directoryPath, SourceId sourceId, SourceContextId directoryId)
|
||||||
{
|
{
|
||||||
m_sourceId = sourceId;
|
m_sourceId = sourceId;
|
||||||
m_directorySourceId = directorySourceId;
|
m_directoryId = directoryId;
|
||||||
m_directoryPath = directoryPath;
|
m_directoryPath = directoryPath;
|
||||||
m_parserState = ParsingDocument;
|
m_parserState = ParsingDocument;
|
||||||
if (!SimpleAbstractStreamReader::readFromSource(content)) {
|
if (!SimpleAbstractStreamReader::readFromSource(content)) {
|
||||||
@@ -178,7 +178,7 @@ TypeAnnotationReader::ParserSate TypeAnnotationReader::readDocument(const QStrin
|
|||||||
TypeAnnotationReader::ParserSate TypeAnnotationReader::readMetaInfoRootElement(const QString &name)
|
TypeAnnotationReader::ParserSate TypeAnnotationReader::readMetaInfoRootElement(const QString &name)
|
||||||
{
|
{
|
||||||
if (name == typeElementName) {
|
if (name == typeElementName) {
|
||||||
auto &annotation = m_typeAnnotations.emplace_back(m_sourceId, m_directorySourceId);
|
auto &annotation = m_typeAnnotations.emplace_back(m_sourceId, m_directoryId);
|
||||||
annotation.traits.canBeContainer = FlagIs::True;
|
annotation.traits.canBeContainer = FlagIs::True;
|
||||||
annotation.traits.canBeDroppedInFormEditor = FlagIs::True;
|
annotation.traits.canBeDroppedInFormEditor = FlagIs::True;
|
||||||
annotation.traits.canBeDroppedInNavigator = FlagIs::True;
|
annotation.traits.canBeDroppedInNavigator = FlagIs::True;
|
||||||
|
@@ -50,7 +50,7 @@ public:
|
|||||||
Synchronization::TypeAnnotations parseTypeAnnotation(const QString &content,
|
Synchronization::TypeAnnotations parseTypeAnnotation(const QString &content,
|
||||||
const QString &directoryPath,
|
const QString &directoryPath,
|
||||||
SourceId sourceId,
|
SourceId sourceId,
|
||||||
SourceId directorySourceId);
|
SourceContextId directoryId);
|
||||||
|
|
||||||
QStringList errors();
|
QStringList errors();
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ private:
|
|||||||
json m_itemLibraryEntries;
|
json m_itemLibraryEntries;
|
||||||
Property m_currentProperty;
|
Property m_currentProperty;
|
||||||
SourceId m_sourceId;
|
SourceId m_sourceId;
|
||||||
SourceId m_directorySourceId;
|
SourceContextId m_directoryId;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner::Storage
|
} // namespace QmlDesigner::Storage
|
||||||
|
@@ -78,7 +78,7 @@ MATCHER_P3(IsItemLibraryProperty,
|
|||||||
|
|
||||||
template<typename IconPathMatcher, typename TypeTraitsMatcher, typename HintsJsonMatcher, typename ItemLibraryJsonMatcher>
|
template<typename IconPathMatcher, typename TypeTraitsMatcher, typename HintsJsonMatcher, typename ItemLibraryJsonMatcher>
|
||||||
auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
|
auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
|
||||||
QmlDesigner::SourceId directorySourceId,
|
QmlDesigner::SourceContextId directoryId,
|
||||||
Utils::SmallStringView typeName,
|
Utils::SmallStringView typeName,
|
||||||
QmlDesigner::ModuleId moduleId,
|
QmlDesigner::ModuleId moduleId,
|
||||||
IconPathMatcher iconPath,
|
IconPathMatcher iconPath,
|
||||||
@@ -88,7 +88,7 @@ auto IsTypeAnnotation(QmlDesigner::SourceId sourceId,
|
|||||||
{
|
{
|
||||||
using QmlDesigner::Storage::Synchronization::TypeAnnotation;
|
using QmlDesigner::Storage::Synchronization::TypeAnnotation;
|
||||||
return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId),
|
return AllOf(Field("sourceId", &TypeAnnotation::sourceId, sourceId),
|
||||||
Field("directory sourceId", &TypeAnnotation::directorySourceId, directorySourceId),
|
Field("directory sourceId", &TypeAnnotation::directoryId, directoryId),
|
||||||
Field("typeName", &TypeAnnotation::typeName, typeName),
|
Field("typeName", &TypeAnnotation::typeName, typeName),
|
||||||
Field("moduleId", &TypeAnnotation::moduleId, moduleId),
|
Field("moduleId", &TypeAnnotation::moduleId, moduleId),
|
||||||
Field("iconPath", &TypeAnnotation::iconPath, iconPath),
|
Field("iconPath", &TypeAnnotation::iconPath, iconPath),
|
||||||
|
@@ -205,9 +205,12 @@ public:
|
|||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SmallSourceIds<4>,
|
MOCK_METHOD(QmlDesigner::SmallSourceIds<4>,
|
||||||
typeAnnotationSourceIds,
|
typeAnnotationSourceIds,
|
||||||
(QmlDesigner::SourceId directoryId),
|
(QmlDesigner::SourceContextId directoryId),
|
||||||
|
(const, override));
|
||||||
|
MOCK_METHOD(QmlDesigner::SmallSourceContextIds<64>,
|
||||||
|
typeAnnotationDirectoryIds,
|
||||||
|
(),
|
||||||
(const, override));
|
(const, override));
|
||||||
MOCK_METHOD(QmlDesigner::SmallSourceIds<64>, typeAnnotationDirectorySourceIds, (), (const, override));
|
|
||||||
MOCK_METHOD(Utils::PathString, typeIconPath, (QmlDesigner::TypeId typeId), (const, override));
|
MOCK_METHOD(Utils::PathString, typeIconPath, (QmlDesigner::TypeId typeId), (const, override));
|
||||||
MOCK_METHOD(QmlDesigner::Storage::Info::TypeHints,
|
MOCK_METHOD(QmlDesigner::Storage::Info::TypeHints,
|
||||||
typeHints,
|
typeHints,
|
||||||
@@ -306,17 +309,18 @@ public:
|
|||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
||||||
fetchDirectoryInfos,
|
fetchDirectoryInfos,
|
||||||
(QmlDesigner::SourceId sourceId),
|
(QmlDesigner::SourceContextId directoryId),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
MOCK_METHOD(QmlDesigner::Storage::Synchronization::DirectoryInfos,
|
||||||
fetchDirectoryInfos,
|
fetchDirectoryInfos,
|
||||||
(QmlDesigner::SourceId sourceId, QmlDesigner::Storage::Synchronization::FileType),
|
(QmlDesigner::SourceContextId directoryId,
|
||||||
|
QmlDesigner::Storage::Synchronization::FileType),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(QmlDesigner::SmallSourceIds<32>,
|
MOCK_METHOD(QmlDesigner::SmallSourceContextIds<32>,
|
||||||
fetchSubdirectorySourceIds,
|
fetchSubdirectoryIds,
|
||||||
(QmlDesigner::SourceId sourceId),
|
(QmlDesigner::SourceContextId directoryId),
|
||||||
(const, override));
|
(const, override));
|
||||||
|
|
||||||
MOCK_METHOD(std::optional<QmlDesigner::Storage::Synchronization::DirectoryInfo>,
|
MOCK_METHOD(std::optional<QmlDesigner::Storage::Synchronization::DirectoryInfo>,
|
||||||
|
@@ -853,11 +853,11 @@ std::ostream &operator<<(std::ostream &out, const SynchronizationPackage &packag
|
|||||||
<< ", updatedSourceIds: " << package.updatedSourceIds
|
<< ", updatedSourceIds: " << package.updatedSourceIds
|
||||||
<< ", fileStatuses: " << package.fileStatuses
|
<< ", fileStatuses: " << package.fileStatuses
|
||||||
<< ", updatedFileStatusSourceIds: " << package.updatedFileStatusSourceIds
|
<< ", updatedFileStatusSourceIds: " << package.updatedFileStatusSourceIds
|
||||||
<< ", updatedDirectoryInfoSourceIds: " << package.updatedDirectoryInfoSourceIds
|
<< ", updatedDirectoryInfoDirectoryIds: " << package.updatedDirectoryInfoDirectoryIds
|
||||||
<< ", directoryInfos: " << package.directoryInfos
|
<< ", directoryInfos: " << package.directoryInfos
|
||||||
<< ", propertyEditorQmlPaths: " << package.propertyEditorQmlPaths
|
<< ", propertyEditorQmlPaths: " << package.propertyEditorQmlPaths
|
||||||
<< ", updatedPropertyEditorQmlPathSourceIds: "
|
<< ", updatedPropertyEditorQmlPathSourceIds: "
|
||||||
<< package.updatedPropertyEditorQmlPathSourceIds
|
<< package.updatedPropertyEditorQmlPathSourceContextIds
|
||||||
<< ", typeAnnotations: " << package.typeAnnotations
|
<< ", typeAnnotations: " << package.typeAnnotations
|
||||||
<< ", updatedTypeAnnotationSourceIds: " << package.updatedTypeAnnotationSourceIds
|
<< ", updatedTypeAnnotationSourceIds: " << package.updatedTypeAnnotationSourceIds
|
||||||
<< ")";
|
<< ")";
|
||||||
@@ -865,8 +865,8 @@ std::ostream &operator<<(std::ostream &out, const SynchronizationPackage &packag
|
|||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, const DirectoryInfo &data)
|
std::ostream &operator<<(std::ostream &out, const DirectoryInfo &data)
|
||||||
{
|
{
|
||||||
return out << "(" << data.directorySourceId << ", " << data.sourceId << ", " << data.moduleId
|
return out << "(" << data.directoryId << ", " << data.sourceId << ", " << data.moduleId << ", "
|
||||||
<< ", " << data.fileType << ")";
|
<< data.fileType << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &out, IsQualified isQualified)
|
std::ostream &operator<<(std::ostream &out, IsQualified isQualified)
|
||||||
|
@@ -24,6 +24,8 @@ using QmlDesigner::FileStatuses;
|
|||||||
using QmlDesigner::FlagIs;
|
using QmlDesigner::FlagIs;
|
||||||
using QmlDesigner::ModuleId;
|
using QmlDesigner::ModuleId;
|
||||||
using QmlDesigner::PropertyDeclarationId;
|
using QmlDesigner::PropertyDeclarationId;
|
||||||
|
using QmlDesigner::SourceContextId;
|
||||||
|
using QmlDesigner::SourceContextIds;
|
||||||
using QmlDesigner::SourceId;
|
using QmlDesigner::SourceId;
|
||||||
using QmlDesigner::SourceIds;
|
using QmlDesigner::SourceIds;
|
||||||
using QmlDesigner::SourceNameId;
|
using QmlDesigner::SourceNameId;
|
||||||
@@ -1039,10 +1041,19 @@ protected:
|
|||||||
|
|
||||||
package.updatedSourceIds = {sourceId1, sourceId2, sourceId3};
|
package.updatedSourceIds = {sourceId1, sourceId2, sourceId3};
|
||||||
|
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "QtObject", sourceId1, sourceIdPath6);
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item", sourceId2, sourceIdPath6);
|
"QtObject",
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item3D", sourceId3, sourceIdPath6);
|
sourceId1,
|
||||||
package.updatedPropertyEditorQmlPathSourceIds.emplace_back(sourceIdPath6);
|
sourceContextIdPath6);
|
||||||
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
|
"Item",
|
||||||
|
sourceId2,
|
||||||
|
sourceContextIdPath6);
|
||||||
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
|
"Item3D",
|
||||||
|
sourceId3,
|
||||||
|
sourceContextIdPath6);
|
||||||
|
package.updatedPropertyEditorQmlPathSourceContextIds.emplace_back(sourceContextIdPath6);
|
||||||
|
|
||||||
return package;
|
return package;
|
||||||
}
|
}
|
||||||
@@ -1056,7 +1067,7 @@ protected:
|
|||||||
traits.visibleInLibrary = FlagIs::True;
|
traits.visibleInLibrary = FlagIs::True;
|
||||||
|
|
||||||
annotations.emplace_back(sourceId4,
|
annotations.emplace_back(sourceId4,
|
||||||
sourceIdPath6,
|
sourceContextIdPath6,
|
||||||
"Object",
|
"Object",
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
"/path/to/icon.png",
|
"/path/to/icon.png",
|
||||||
@@ -1078,7 +1089,7 @@ protected:
|
|||||||
"properties":[["color", "color", "#blue"]]}])xy");
|
"properties":[["color", "color", "#blue"]]}])xy");
|
||||||
|
|
||||||
annotations.emplace_back(sourceId5,
|
annotations.emplace_back(sourceId5,
|
||||||
sourceIdPath6,
|
sourceContextIdPath6,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
"/path/to/quick.png",
|
"/path/to/quick.png",
|
||||||
@@ -1103,7 +1114,7 @@ protected:
|
|||||||
traits.visibleInLibrary = FlagIs::True;
|
traits.visibleInLibrary = FlagIs::True;
|
||||||
|
|
||||||
annotations.emplace_back(sourceId5,
|
annotations.emplace_back(sourceId5,
|
||||||
sourceIdPath1,
|
sourceContextIdPath1,
|
||||||
"Item",
|
"Item",
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
"/path/to/quick.png",
|
"/path/to/quick.png",
|
||||||
@@ -1216,9 +1227,13 @@ protected:
|
|||||||
SourceId sourceId5{sourcePathCache.sourceId(path5)};
|
SourceId sourceId5{sourcePathCache.sourceId(path5)};
|
||||||
SourceId sourceId6{sourcePathCache.sourceId(path6)};
|
SourceId sourceId6{sourcePathCache.sourceId(path6)};
|
||||||
SourceId sourceIdPath1{sourcePathCache.sourceId(pathPath1)};
|
SourceId sourceIdPath1{sourcePathCache.sourceId(pathPath1)};
|
||||||
|
SourceContextId sourceContextIdPath1{sourceIdPath1.contextId()};
|
||||||
SourceId sourceIdPath6{sourcePathCache.sourceId(pathPath6)};
|
SourceId sourceIdPath6{sourcePathCache.sourceId(pathPath6)};
|
||||||
|
SourceContextId sourceContextIdPath6{sourceIdPath6.contextId()};
|
||||||
SourceId qmlProjectSourceId{sourcePathCache.sourceId("/path1/qmldir")};
|
SourceId qmlProjectSourceId{sourcePathCache.sourceId("/path1/qmldir")};
|
||||||
|
SourceContextId qmlProjectSourceContextId = qmlProjectSourceId.contextId();
|
||||||
SourceId qtQuickProjectSourceId{sourcePathCache.sourceId("/path2/qmldir")};
|
SourceId qtQuickProjectSourceId{sourcePathCache.sourceId("/path2/qmldir")};
|
||||||
|
SourceContextId qtQuickProjectSourceContextId = qtQuickProjectSourceId.contextId();
|
||||||
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
ModuleId qmlModuleId{storage.moduleId("Qml", ModuleKind::QmlLibrary)};
|
||||||
ModuleId qmlNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
ModuleId qmlNativeModuleId{storage.moduleId("Qml", ModuleKind::CppLibrary)};
|
||||||
ModuleId qtQuickModuleId{storage.moduleId("QtQuick", ModuleKind::QmlLibrary)};
|
ModuleId qtQuickModuleId{storage.moduleId("QtQuick", ModuleKind::QmlLibrary)};
|
||||||
@@ -5669,259 +5684,285 @@ TEST_F(ProjectStorage, populate_module_cache)
|
|||||||
|
|
||||||
TEST_F(ProjectStorage, add_directory_infoes)
|
TEST_F(ProjectStorage, add_directory_infoes)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
||||||
UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, remove_directory_info)
|
TEST_F(ProjectStorage, remove_directory_info)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId}, {directoryInfo1}});
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
|
{directoryInfo1}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
||||||
UnorderedElementsAre(directoryInfo1));
|
UnorderedElementsAre(directoryInfo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, update_directory_info_file_type)
|
TEST_F(ProjectStorage, update_directory_info_file_type)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1, directoryInfo2b}});
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1, directoryInfo2b}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
||||||
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, update_directory_info_module_id)
|
TEST_F(ProjectStorage, update_directory_info_module_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2b{qmlProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1, directoryInfo2b}});
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1, directoryInfo2b}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
||||||
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
UnorderedElementsAre(directoryInfo1, directoryInfo2b, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, throw_for_invalid_source_id_in_directory_info)
|
TEST_F(ProjectStorage, throw_for_invalid_source_id_in_directory_info)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
SourceId{},
|
SourceId{},
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
|
||||||
ASSERT_THROW(storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}}),
|
ASSERT_THROW(storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}}),
|
||||||
QmlDesigner::DirectoryInfoHasInvalidSourceId);
|
QmlDesigner::DirectoryInfoHasInvalidSourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, insert_directory_info_with_invalid_module_id)
|
TEST_F(ProjectStorage, insert_directory_info_with_invalid_module_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
ModuleId{},
|
ModuleId{},
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}});
|
storage.synchronize(SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
||||||
UnorderedElementsAre(directoryInfo1));
|
UnorderedElementsAre(directoryInfo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, update_directory_info_with_invalid_module_id)
|
TEST_F(ProjectStorage, update_directory_info_with_invalid_module_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}});
|
storage.synchronize(SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}});
|
||||||
directoryInfo1.moduleId = ModuleId{};
|
directoryInfo1.moduleId = ModuleId{};
|
||||||
|
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}});
|
storage.synchronize(SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}});
|
||||||
|
|
||||||
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId}),
|
ASSERT_THAT(storage.fetchDirectoryInfos({qmlProjectSourceContextId, qtQuickProjectSourceContextId}),
|
||||||
UnorderedElementsAre(directoryInfo1));
|
UnorderedElementsAre(directoryInfo1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, throw_for_updating_with_invalid_project_source_id_in_directory_info)
|
TEST_F(ProjectStorage, throw_for_updating_with_invalid_project_source_context_id_in_directory_info)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{SourceId{},
|
Storage::Synchronization::DirectoryInfo directoryInfo1{
|
||||||
sourceId1,
|
SourceContextId{}, sourceId1, qmlModuleId, Storage::Synchronization::FileType::QmlDocument};
|
||||||
qmlModuleId,
|
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
|
||||||
|
|
||||||
ASSERT_THROW(storage.synchronize(SynchronizationPackage{{qmlProjectSourceId}, {directoryInfo1}}),
|
ASSERT_THROW(storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId}, {directoryInfo1}}),
|
||||||
QmlDesigner::DirectoryInfoHasInvalidProjectSourceId);
|
QmlDesigner::DirectoryInfoHasInvalidProjectSourceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_ids)
|
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_context_ids)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
auto directoryInfos = storage.fetchDirectoryInfos({qmlProjectSourceId, qtQuickProjectSourceId});
|
auto directoryInfos = storage.fetchDirectoryInfos(
|
||||||
|
{qmlProjectSourceContextId, qtQuickProjectSourceContextId});
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfos, UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
ASSERT_THAT(directoryInfos, UnorderedElementsAre(directoryInfo1, directoryInfo2, directoryInfo3));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_id)
|
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_context_id)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
sourceId2,
|
sourceId2,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceId);
|
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceContextId);
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo1, directoryInfo2));
|
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo1, directoryInfo2));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_id_and_file_type)
|
TEST_F(ProjectStorage, fetch_directory_infos_by_directory_source_context_id_and_file_type)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
qmlProjectSourceId, sourceId1, qmlModuleId, Storage::Synchronization::FileType::QmlDocument};
|
sourceId1,
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{
|
qmlModuleId,
|
||||||
qmlProjectSourceId, sourceId2, ModuleId{}, Storage::Synchronization::FileType::Directory};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
|
sourceId2,
|
||||||
|
ModuleId{},
|
||||||
|
Storage::Synchronization::FileType::Directory};
|
||||||
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo4{
|
Storage::Synchronization::DirectoryInfo directoryInfo4{qmlProjectSourceContextId,
|
||||||
qmlProjectSourceId, sourceId4, ModuleId{}, Storage::Synchronization::FileType::Directory};
|
sourceId4,
|
||||||
|
ModuleId{},
|
||||||
|
Storage::Synchronization::FileType::Directory};
|
||||||
storage.synchronize(
|
storage.synchronize(
|
||||||
SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceId,
|
auto directoryInfo = storage.fetchDirectoryInfos(qmlProjectSourceContextId,
|
||||||
Storage::Synchronization::FileType::Directory);
|
Storage::Synchronization::FileType::Directory);
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo2, directoryInfo4));
|
ASSERT_THAT(directoryInfo, UnorderedElementsAre(directoryInfo2, directoryInfo4));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_subdirectory_source_ids)
|
TEST_F(ProjectStorage, fetch_subdirectory_source_context_ids)
|
||||||
{
|
{
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
qmlProjectSourceId, sourceId1, qmlModuleId, Storage::Synchronization::FileType::QmlDocument};
|
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{
|
|
||||||
qmlProjectSourceId, sourceId2, ModuleId{}, Storage::Synchronization::FileType::Directory};
|
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
|
||||||
sourceId3,
|
|
||||||
qtQuickModuleId,
|
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo4{
|
|
||||||
qmlProjectSourceId, sourceId4, ModuleId{}, Storage::Synchronization::FileType::Directory};
|
|
||||||
storage.synchronize(
|
|
||||||
SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchSubdirectorySourceIds(qmlProjectSourceId);
|
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo, UnorderedElementsAre(sourceId2, sourceId4));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(ProjectStorage, fetch_directory_info_by_source_ids)
|
|
||||||
{
|
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceId,
|
|
||||||
sourceId1,
|
sourceId1,
|
||||||
qmlModuleId,
|
qmlModuleId,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceId,
|
auto directory1Id = SourceId::create(SourceNameId{}, sourceId2.contextId());
|
||||||
sourceId2,
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
qmlModuleId,
|
directory1Id,
|
||||||
Storage::Synchronization::FileType::QmlDocument};
|
ModuleId{},
|
||||||
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceId,
|
Storage::Synchronization::FileType::Directory};
|
||||||
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
sourceId3,
|
sourceId3,
|
||||||
qtQuickModuleId,
|
qtQuickModuleId,
|
||||||
Storage::Synchronization::FileType::QmlTypes};
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
storage.synchronize(SynchronizationPackage{{qmlProjectSourceId, qtQuickProjectSourceId},
|
auto directory2Id = SourceId::create(SourceNameId{}, sourceId4.contextId());
|
||||||
|
Storage::Synchronization::DirectoryInfo directoryInfo4{qmlProjectSourceContextId,
|
||||||
|
directory2Id,
|
||||||
|
ModuleId{},
|
||||||
|
Storage::Synchronization::FileType::Directory};
|
||||||
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
|
{directoryInfo1, directoryInfo2, directoryInfo3, directoryInfo4}});
|
||||||
|
|
||||||
|
auto directoryInfo = storage.fetchSubdirectoryIds(qmlProjectSourceContextId);
|
||||||
|
|
||||||
|
ASSERT_THAT(directoryInfo,
|
||||||
|
UnorderedElementsAre(directory1Id.contextId(), directory2Id.contextId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(ProjectStorage, fetch_directory_info_by_source_id)
|
||||||
|
{
|
||||||
|
Storage::Synchronization::DirectoryInfo directoryInfo1{qmlProjectSourceContextId,
|
||||||
|
sourceId1,
|
||||||
|
qmlModuleId,
|
||||||
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
Storage::Synchronization::DirectoryInfo directoryInfo2{qmlProjectSourceContextId,
|
||||||
|
sourceId2,
|
||||||
|
qmlModuleId,
|
||||||
|
Storage::Synchronization::FileType::QmlDocument};
|
||||||
|
Storage::Synchronization::DirectoryInfo directoryInfo3{qtQuickProjectSourceContextId,
|
||||||
|
sourceId3,
|
||||||
|
qtQuickModuleId,
|
||||||
|
Storage::Synchronization::FileType::QmlTypes};
|
||||||
|
storage.synchronize(
|
||||||
|
SynchronizationPackage{{qmlProjectSourceContextId, qtQuickProjectSourceContextId},
|
||||||
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
{directoryInfo1, directoryInfo2, directoryInfo3}});
|
||||||
|
|
||||||
auto directoryInfo = storage.fetchDirectoryInfo({sourceId2});
|
auto directoryInfo = storage.fetchDirectoryInfo(sourceId2);
|
||||||
|
|
||||||
ASSERT_THAT(directoryInfo, Eq(directoryInfo2));
|
ASSERT_THAT(directoryInfo, Eq(directoryInfo2));
|
||||||
}
|
}
|
||||||
@@ -8064,7 +8105,10 @@ TEST_F(ProjectStorage, synchronize_property_editor_adds_path)
|
|||||||
auto package{createPropertyEditorPathsSynchronizationPackage()};
|
auto package{createPropertyEditorPathsSynchronizationPackage()};
|
||||||
package.propertyEditorQmlPaths.pop_back();
|
package.propertyEditorQmlPaths.pop_back();
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item3D", sourceId3, sourceIdPath6);
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
|
"Item3D",
|
||||||
|
sourceId3,
|
||||||
|
sourceContextIdPath6);
|
||||||
|
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
@@ -8076,7 +8120,10 @@ TEST_F(ProjectStorage, synchronize_property_editor_adds_path)
|
|||||||
TEST_F(ProjectStorage, synchronize_property_editor_with_non_existing_type_name)
|
TEST_F(ProjectStorage, synchronize_property_editor_with_non_existing_type_name)
|
||||||
{
|
{
|
||||||
auto package{createPropertyEditorPathsSynchronizationPackage()};
|
auto package{createPropertyEditorPathsSynchronizationPackage()};
|
||||||
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId, "Item4D", sourceId4, sourceIdPath6);
|
package.propertyEditorQmlPaths.emplace_back(qtQuickModuleId,
|
||||||
|
"Item4D",
|
||||||
|
sourceId4,
|
||||||
|
sourceContextIdPath6);
|
||||||
|
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
@@ -8441,7 +8488,7 @@ TEST_F(ProjectStorage, synchronize_type_annotation_directory_source_id)
|
|||||||
|
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
ASSERT_THAT(storage.typeAnnotationSourceIds(sourceIdPath6),
|
ASSERT_THAT(storage.typeAnnotationSourceIds(sourceContextIdPath6),
|
||||||
UnorderedElementsAre(sourceId4, sourceId5));
|
UnorderedElementsAre(sourceId4, sourceId5));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8453,7 +8500,7 @@ TEST_F(ProjectStorage, get_type_annotation_source_ids)
|
|||||||
package.typeAnnotations);
|
package.typeAnnotations);
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
auto sourceIds = storage.typeAnnotationSourceIds(sourceIdPath6);
|
auto sourceIds = storage.typeAnnotationSourceIds(sourceContextIdPath6);
|
||||||
|
|
||||||
ASSERT_THAT(sourceIds, UnorderedElementsAre(sourceId4, sourceId5));
|
ASSERT_THAT(sourceIds, UnorderedElementsAre(sourceId4, sourceId5));
|
||||||
}
|
}
|
||||||
@@ -8466,9 +8513,9 @@ TEST_F(ProjectStorage, get_type_annotation_directory_source_ids)
|
|||||||
package.typeAnnotations);
|
package.typeAnnotations);
|
||||||
storage.synchronize(package);
|
storage.synchronize(package);
|
||||||
|
|
||||||
auto sourceIds = storage.typeAnnotationDirectorySourceIds();
|
auto sourceIds = storage.typeAnnotationDirectoryIds();
|
||||||
|
|
||||||
ASSERT_THAT(sourceIds, ElementsAre(sourceIdPath1, sourceIdPath6));
|
ASSERT_THAT(sourceIds, ElementsAre(sourceContextIdPath1, sourceContextIdPath6));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ProjectStorage, get_all_item_library_entries)
|
TEST_F(ProjectStorage, get_all_item_library_entries)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -189,7 +189,7 @@ protected:
|
|||||||
Synchronization::Types types;
|
Synchronization::Types types;
|
||||||
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};
|
SourceId qmltypesFileSourceId{sourcePathCache.sourceId("path/to/types.qmltypes")};
|
||||||
ModuleId qtQmlNativeModuleId = storage.moduleId("QtQml", ModuleKind::CppLibrary);
|
ModuleId qtQmlNativeModuleId = storage.moduleId("QtQml", ModuleKind::CppLibrary);
|
||||||
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId,
|
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId.contextId(),
|
||||||
qmltypesFileSourceId,
|
qmltypesFileSourceId,
|
||||||
qtQmlNativeModuleId,
|
qtQmlNativeModuleId,
|
||||||
Synchronization::FileType::QmlTypes};
|
Synchronization::FileType::QmlTypes};
|
||||||
@@ -886,7 +886,7 @@ TEST_F(QmlTypesParser, default_property)
|
|||||||
TEST_F(QmlTypesParser, skip_template_item)
|
TEST_F(QmlTypesParser, skip_template_item)
|
||||||
{
|
{
|
||||||
ModuleId moduleId = storage.moduleId("QtQuick.Templates", ModuleKind::CppLibrary);
|
ModuleId moduleId = storage.moduleId("QtQuick.Templates", ModuleKind::CppLibrary);
|
||||||
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId,
|
Synchronization::DirectoryInfo directoryInfo{qmltypesFileSourceId.contextId(),
|
||||||
qmltypesFileSourceId,
|
qmltypesFileSourceId,
|
||||||
moduleId,
|
moduleId,
|
||||||
Synchronization::FileType::QmlTypes};
|
Synchronization::FileType::QmlTypes};
|
||||||
|
@@ -53,7 +53,7 @@ protected:
|
|||||||
QmlDesigner::ProjectStorage &storage = staticData->storage;
|
QmlDesigner::ProjectStorage &storage = staticData->storage;
|
||||||
QmlDesigner::Storage::TypeAnnotationReader reader{storage};
|
QmlDesigner::Storage::TypeAnnotationReader reader{storage};
|
||||||
QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33);
|
QmlDesigner::SourceId sourceId = QmlDesigner::SourceId::create(33);
|
||||||
QmlDesigner::SourceId directorySourceId = QmlDesigner::SourceId::create(77);
|
QmlDesigner::SourceContextId directoryId = QmlDesigner::SourceContextId::create(77);
|
||||||
QmlDesigner::Storage::TypeTraits traits;
|
QmlDesigner::Storage::TypeTraits traits;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,11 +71,11 @@ TEST_F(TypeAnnotationReader, parse_type)
|
|||||||
}
|
}
|
||||||
})xy"};
|
})xy"};
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
UnorderedElementsAre(IsTypeAnnotation(sourceId,
|
UnorderedElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -83,7 +83,7 @@ TEST_F(TypeAnnotationReader, parse_type)
|
|||||||
IsEmpty(),
|
IsEmpty(),
|
||||||
IsEmpty()),
|
IsEmpty()),
|
||||||
IsTypeAnnotation(sourceId,
|
IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Item",
|
"Item",
|
||||||
moduleId("QtQuick"),
|
moduleId("QtQuick"),
|
||||||
"/path/images/item-icon16.png",
|
"/path/images/item-icon16.png",
|
||||||
@@ -108,11 +108,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeContainer)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.canBeContainer = FlagIs::True;
|
traits.canBeContainer = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -137,11 +137,11 @@ TEST_F(TypeAnnotationReader, parse_true_forceClip)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.forceClip = FlagIs::True;
|
traits.forceClip = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -166,11 +166,11 @@ TEST_F(TypeAnnotationReader, parse_true_doesLayoutChildren)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.doesLayoutChildren = FlagIs::True;
|
traits.doesLayoutChildren = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -195,11 +195,11 @@ TEST_F(TypeAnnotationReader, parse_false_canBeDroppedInFormEditor)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.canBeDroppedInFormEditor = FlagIs::False;
|
traits.canBeDroppedInFormEditor = FlagIs::False;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -224,11 +224,11 @@ TEST_F(TypeAnnotationReader, parse_false_canBeDroppedInNavigator)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.canBeDroppedInNavigator = FlagIs::False;
|
traits.canBeDroppedInNavigator = FlagIs::False;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -253,11 +253,11 @@ TEST_F(TypeAnnotationReader, parse_true_hideInNavigator)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.hideInNavigator = FlagIs::True;
|
traits.hideInNavigator = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -282,11 +282,11 @@ TEST_F(TypeAnnotationReader, parse_true_canBeDroppedInView3D)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.canBeDroppedInView3D = FlagIs::True;
|
traits.canBeDroppedInView3D = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -311,11 +311,11 @@ TEST_F(TypeAnnotationReader, parse_false_isMovable)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.isMovable = FlagIs::False;
|
traits.isMovable = FlagIs::False;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -340,11 +340,11 @@ TEST_F(TypeAnnotationReader, parse_false_isResizable)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.isResizable = FlagIs::False;
|
traits.isResizable = FlagIs::False;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -369,11 +369,11 @@ TEST_F(TypeAnnotationReader, parse_false_hasFormEditorItem)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.hasFormEditorItem = FlagIs::False;
|
traits.hasFormEditorItem = FlagIs::False;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -398,11 +398,11 @@ TEST_F(TypeAnnotationReader, parse_true_isStackedContainer)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.isStackedContainer = FlagIs::True;
|
traits.isStackedContainer = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -427,11 +427,11 @@ TEST_F(TypeAnnotationReader, parse_true_takesOverRenderingOfChildren)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.takesOverRenderingOfChildren = FlagIs::True;
|
traits.takesOverRenderingOfChildren = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -456,11 +456,11 @@ TEST_F(TypeAnnotationReader, parse_true_visibleInNavigator)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.visibleInNavigator = FlagIs::True;
|
traits.visibleInNavigator = FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -485,11 +485,11 @@ TEST_F(TypeAnnotationReader, parse_false_visibleInLibrary)
|
|||||||
})xy"};
|
})xy"};
|
||||||
traits.visibleInLibrary = FlagIs::False;
|
traits.visibleInLibrary = FlagIs::False;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -513,11 +513,11 @@ TEST_F(TypeAnnotationReader, parse_false)
|
|||||||
}
|
}
|
||||||
})xy"};
|
})xy"};
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -555,11 +555,11 @@ TEST_F(TypeAnnotationReader, parse_complex_expression)
|
|||||||
QmlDesigner::Storage::TypeTraits itemTraits = traits;
|
QmlDesigner::Storage::TypeTraits itemTraits = traits;
|
||||||
itemTraits.canBeContainer = QmlDesigner::FlagIs::True;
|
itemTraits.canBeContainer = QmlDesigner::FlagIs::True;
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
UnorderedElementsAre(IsTypeAnnotation(sourceId,
|
UnorderedElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -568,7 +568,7 @@ TEST_F(TypeAnnotationReader, parse_complex_expression)
|
|||||||
"visibleNonDefaultProperties":"layer.effect"})xy"),
|
"visibleNonDefaultProperties":"layer.effect"})xy"),
|
||||||
IsEmpty()),
|
IsEmpty()),
|
||||||
IsTypeAnnotation(sourceId,
|
IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Item",
|
"Item",
|
||||||
moduleId("QtQuick"),
|
moduleId("QtQuick"),
|
||||||
"/path/images/item-icon16.png",
|
"/path/images/item-icon16.png",
|
||||||
@@ -603,11 +603,11 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry)
|
|||||||
}
|
}
|
||||||
})xy"};
|
})xy"};
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -659,11 +659,11 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_with_properties)
|
|||||||
}
|
}
|
||||||
})xy"};
|
})xy"};
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
"/path/images/frame-icon16.png",
|
"/path/images/frame-icon16.png",
|
||||||
@@ -709,11 +709,11 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_template_path)
|
|||||||
}
|
}
|
||||||
})xy"};
|
})xy"};
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
Utils::SmallStringView{},
|
Utils::SmallStringView{},
|
||||||
@@ -724,7 +724,7 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_template_path)
|
|||||||
"templatePath":"/path/templates/frame.qml"}]
|
"templatePath":"/path/templates/frame.qml"}]
|
||||||
)xy")),
|
)xy")),
|
||||||
IsTypeAnnotation(sourceId,
|
IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Item",
|
"Item",
|
||||||
moduleId("QtQuick"),
|
moduleId("QtQuick"),
|
||||||
Utils::SmallStringView{},
|
Utils::SmallStringView{},
|
||||||
@@ -761,11 +761,11 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_extra_file_paths)
|
|||||||
}
|
}
|
||||||
})xy"};
|
})xy"};
|
||||||
|
|
||||||
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directorySourceId);
|
auto annotations = reader.parseTypeAnnotation(content, "/path", sourceId, directoryId);
|
||||||
|
|
||||||
ASSERT_THAT(annotations,
|
ASSERT_THAT(annotations,
|
||||||
ElementsAre(IsTypeAnnotation(sourceId,
|
ElementsAre(IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Frame",
|
"Frame",
|
||||||
moduleId("QtQuick.Controls"),
|
moduleId("QtQuick.Controls"),
|
||||||
Utils::SmallStringView{},
|
Utils::SmallStringView{},
|
||||||
@@ -776,7 +776,7 @@ TEST_F(TypeAnnotationReader, parse_item_library_entry_extra_file_paths)
|
|||||||
"name":"Frame"}]
|
"name":"Frame"}]
|
||||||
)xy")),
|
)xy")),
|
||||||
IsTypeAnnotation(sourceId,
|
IsTypeAnnotation(sourceId,
|
||||||
directorySourceId,
|
directoryId,
|
||||||
"Item",
|
"Item",
|
||||||
moduleId("QtQuick"),
|
moduleId("QtQuick"),
|
||||||
Utils::SmallStringView{},
|
Utils::SmallStringView{},
|
||||||
|
Reference in New Issue
Block a user