QmlDesigner: Remove qmltypes code path

With Qt 6.8 there we don't need the builtin.qmltypes anymore because
there is now the QML module. We used that code path for fake components,
too.

But that is problematic because we get errors if that components get
fixed in Qt.

Because we introduced already other ways, like unresolved type ids, to
handle that broken components, we should remove that code before we add
new features.

Task-number: QDS-14618
Change-Id: I82f3cdb77c44a0f1f8cf680763ddd1d4d7b9781c
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Marco Bubke
2025-02-05 17:59:07 +01:00
parent 51e61e83fd
commit 733eb1515c
4 changed files with 2 additions and 144 deletions

View File

@@ -265,21 +265,16 @@ std::vector<IdPaths> createIdPaths(ProjectStorageUpdater::WatchedSourceIdsIds wa
void ProjectStorageUpdater::update(Update update)
{
QStringList directories = std::move(update.directories);
QStringList qmlTypesPaths = std::move(update.qmlTypesPaths);
const QString &propertyEditorResourcesPath = update.propertyEditorResourcesPath;
const QStringList &typeAnnotationPaths = update.typeAnnotationPaths;
NanotraceHR::Tracer tracer{"update",
category(),
keyValue("directories", directories),
keyValue("qml types paths", qmlTypesPaths)};
NanotraceHR::Tracer tracer{"update", category(), keyValue("directories", directories)};
Storage::Synchronization::SynchronizationPackage package;
WatchedSourceIdsIds watchedSourceIds{Utils::usize(directories)};
NotUpdatedSourceIds notUpdatedSourceIds{Utils::usize(directories)};
updateDirectories(directories, package, notUpdatedSourceIds, watchedSourceIds);
updateQmlTypes(qmlTypesPaths, package, notUpdatedSourceIds, watchedSourceIds);
updatePropertyEditorPaths(propertyEditorResourcesPath, package, notUpdatedSourceIds);
updateTypeAnnotations(typeAnnotationPaths, package, notUpdatedSourceIds);
@@ -294,42 +289,6 @@ void ProjectStorageUpdater::update(Update update)
m_pathWatcher.updateIdPaths(createIdPaths(watchedSourceIds, m_projectPartId));
}
void ProjectStorageUpdater::updateQmlTypes(const QStringList &qmlTypesPaths,
Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIdsIds &watchedSourceIdsIds)
{
if (qmlTypesPaths.empty())
return;
NanotraceHR::Tracer tracer{"update qmltypes file", category()};
ModuleId moduleId = m_projectStorage.moduleId("QML", Storage::ModuleKind::CppLibrary);
for (const QString &qmlTypesPath : qmlTypesPaths) {
SourceId sourceId = m_pathCache.sourceId(SourcePath{qmlTypesPath});
watchedSourceIdsIds.qmltypesSourceIds.push_back(sourceId);
tracer.tick("append watched qml types source id",
keyValue("source id", sourceId),
keyValue("qml types path", qmlTypesPath));
Storage::Synchronization::DirectoryInfo directoryInfo{
sourceId, sourceId, moduleId, Storage::Synchronization::FileType::QmlTypes};
FileState state = parseTypeInfo(directoryInfo,
Utils::PathString{qmlTypesPath},
package,
notUpdatedSourceIds);
if (state == FileState::Changed) {
tracer.tick("append project data", keyValue("project data", directoryInfo));
package.directoryInfos.push_back(std::move(directoryInfo));
tracer.tick("append updated project source ids", keyValue("source id", sourceId));
package.updatedDirectoryInfoSourceIds.push_back(sourceId);
}
}
}
namespace {
template<typename... FileStates>
ProjectStorageUpdater::FileState combineState(FileStates... fileStates)

View File

@@ -65,7 +65,6 @@ public:
struct Update
{
QStringList directories = {};
QStringList qmlTypesPaths = {};
const QString propertyEditorResourcesPath = {};
const QStringList typeAnnotationPaths = {};
};
@@ -140,11 +139,6 @@ public:
};
private:
void updateQmlTypes(const QStringList &qmlTypesPaths,
Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds,
WatchedSourceIdsIds &watchedSourceIdsIds);
void updateDirectories(const QStringList &directories,
Storage::Synchronization::SynchronizationPackage &package,
NotUpdatedSourceIds &notUpdatedSourceIds,

View File

@@ -439,31 +439,6 @@ namespace {
return qmldirPaths;
}
[[maybe_unused]] QStringList qmlTypes(::ProjectExplorer::Target *target)
{
if (!target)
return {};
QStringList qmldirPaths;
qmldirPaths.reserve(2);
qmldirPaths.append(
Core::ICore::resourcePath("qmldesigner/projectstorage/fake.qmltypes").toString());
return qmldirPaths;
}
[[maybe_unused]] QStringList qmlTypesForLiteDesigner()
{
QStringList qmldirPaths;
qmldirPaths.reserve(2);
qmldirPaths.append(
Core::ICore::resourcePath("qmldesigner/projectstorage/fake.qmltypes").toString());
return qmldirPaths;
}
QString propertyEditorResourcesPath()
{
#ifdef SHARE_QML_PATH
@@ -614,12 +589,10 @@ void QmlDesignerProjectManager::update()
try {
if constexpr (isUsingQmlDesignerLite()) {
m_projectData->projectStorageData->updater.update({directoriesForLiteDesigner(),
qmlTypesForLiteDesigner(),
propertyEditorResourcesPath(),
{qtCreatorItemLibraryPath()}});
} else {
m_projectData->projectStorageData->updater.update({directories(m_projectData->activeTarget),
qmlTypes(m_projectData->activeTarget),
propertyEditorResourcesPath(),
{qtCreatorItemLibraryPath()}});
}

View File

@@ -1447,59 +1447,6 @@ TEST_F(ProjectStorageUpdater, update_qml_types_files_is_empty)
updater.update({});
}
TEST_F(ProjectStorageUpdater, update_qml_types_files)
{
EXPECT_CALL(projectStorageMock,
synchronize(AllOf(
Field(&SynchronizationPackage::imports, UnorderedElementsAre(import4, import5)),
Field(&SynchronizationPackage::types, UnorderedElementsAre(objectType, itemType)),
Field(&SynchronizationPackage::updatedSourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)),
Field(&SynchronizationPackage::fileStatuses,
UnorderedElementsAre(IsFileStatus(qmltypesPathSourceId, 1, 21),
IsFileStatus(qmltypes2PathSourceId, 1, 21))),
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)),
Field(&SynchronizationPackage::directoryInfos,
UnorderedElementsAre(IsDirectoryInfo(qmltypesPathSourceId,
qmltypesPathSourceId,
builtinCppNativeModuleId,
FileType::QmlTypes),
IsDirectoryInfo(qmltypes2PathSourceId,
qmltypes2PathSourceId,
builtinCppNativeModuleId,
FileType::QmlTypes))),
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds,
UnorderedElementsAre(qmltypesPathSourceId, qmltypes2PathSourceId)))));
updater.update({.qmlTypesPaths = {"/path/example.qmltypes", "/path/example2.qmltypes"}});
}
TEST_F(ProjectStorageUpdater, dont_update_qml_types_files_if_unchanged)
{
setFilesDontChanged({qmltypes2PathSourceId});
EXPECT_CALL(projectStorageMock,
synchronize(
AllOf(Field(&SynchronizationPackage::imports, UnorderedElementsAre(import4)),
Field(&SynchronizationPackage::types, UnorderedElementsAre(objectType)),
Field(&SynchronizationPackage::updatedSourceIds,
UnorderedElementsAre(qmltypesPathSourceId)),
Field(&SynchronizationPackage::fileStatuses,
UnorderedElementsAre(IsFileStatus(qmltypesPathSourceId, 1, 21))),
Field(&SynchronizationPackage::updatedFileStatusSourceIds,
UnorderedElementsAre(qmltypesPathSourceId)),
Field(&SynchronizationPackage::directoryInfos,
UnorderedElementsAre(IsDirectoryInfo(qmltypesPathSourceId,
qmltypesPathSourceId,
builtinCppNativeModuleId,
FileType::QmlTypes))),
Field(&SynchronizationPackage::updatedDirectoryInfoSourceIds,
UnorderedElementsAre(qmltypesPathSourceId)))));
updater.update({.qmlTypesPaths = {"/path/example.qmltypes", "/path/example2.qmltypes"}});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_with_different_version_but_same_type_name_and_file_name)
{
QString qmldir{R"(module Example
@@ -2112,21 +2059,6 @@ TEST_F(ProjectStorageUpdater, update_path_watcher_qmltypes_files_and_directories
updater.update({.directories = directories2});
}
TEST_F(ProjectStorageUpdater, update_path_watcher_builtin_qmltypes_files)
{
QString builtinQmltyplesPath1{"/path/one/example.qmltypes"};
QString builtinQmltyplesPath2{"/path/two/example2.qmltypes"};
setContent(builtinQmltyplesPath1, qmltypes1);
setContent(builtinQmltyplesPath2, qmltypes2);
EXPECT_CALL(patchWatcherMock,
updateIdPaths(Contains(IdPaths{projectPartId,
QmlDesigner::SourceType::QmlTypes,
{qmltypes1SourceId, qmltypes2SourceId}})));
updater.update({{}, {builtinQmltyplesPath1, builtinQmltyplesPath2}, {}, {}});
}
TEST_F(ProjectStorageUpdater, synchronize_qml_documents_without_qmldir)
{
setFilesDontExists({qmlDirPathSourceId});
@@ -3956,7 +3888,7 @@ TEST_F(ProjectStorageUpdater, update_property_editor_specifics)
TEST_F(ProjectStorageUpdater, update_property_editor_panes_is_empty_if_directory_has_not_changed)
{
updater.update({{}, {}, propertyEditorQmlPath, {}});
updater.update({.propertyEditorResourcesPath = propertyEditorQmlPath});
ON_CALL(fileSystemMock, fileStatus(_)).WillByDefault([](SourceId sourceId) {
return FileStatus{sourceId, 1, 21};
});