diff --git a/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.cpp b/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.cpp index c1481c01846..029dac30869 100644 --- a/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.cpp +++ b/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.cpp @@ -265,21 +265,16 @@ std::vector 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 ¬UpdatedSourceIds, - 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 ProjectStorageUpdater::FileState combineState(FileStates... fileStates) diff --git a/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.h b/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.h index 1a21e7d0322..38d21428ca7 100644 --- a/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.h +++ b/src/plugins/qmldesigner/libs/designercore/projectstorage/projectstorageupdater.h @@ -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 ¬UpdatedSourceIds, - WatchedSourceIdsIds &watchedSourceIdsIds); - void updateDirectories(const QStringList &directories, Storage::Synchronization::SynchronizationPackage &package, NotUpdatedSourceIds ¬UpdatedSourceIds, diff --git a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp index 6980c81a9c9..5718ac7ae21 100644 --- a/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp +++ b/src/plugins/qmldesigner/qmldesignerprojectmanager.cpp @@ -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()}}); } diff --git a/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp b/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp index 478f811378c..a185bec52f4 100644 --- a/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp +++ b/tests/unit/tests/unittests/projectstorage/projectstorageupdater-test.cpp @@ -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}; });