forked from qt-creator/qt-creator
QmlDesigner: Fix ModuleExportedImports
There are Qml modules and C++ modules. For reexports a Qml import should reference only a Qml reexport but not a C++ reexport. Change-Id: I79f50f2b29334c46f915884b7db2155064a3550a Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -140,6 +140,7 @@ void addDependencies(Storage::Imports &dependencies,
|
||||
|
||||
void addModuleExportedImports(Storage::ModuleExportedImports &imports,
|
||||
ModuleId moduleId,
|
||||
ModuleId cppModuleId,
|
||||
const QList<QmlDirParser::Import> &qmldirImports,
|
||||
ProjectStorageInterface &projectStorage)
|
||||
{
|
||||
@@ -155,7 +156,7 @@ void addModuleExportedImports(Storage::ModuleExportedImports &imports,
|
||||
|
||||
ModuleId exportedCppModuleId = projectStorage.moduleId(
|
||||
Utils::PathString{qmldirImport.module} + "-cppnative");
|
||||
imports.emplace_back(moduleId,
|
||||
imports.emplace_back(cppModuleId,
|
||||
exportedCppModuleId,
|
||||
Storage::Version{},
|
||||
Storage::IsAutoVersion::No);
|
||||
@@ -232,10 +233,15 @@ void ProjectStorageUpdater::updateQmldirs(const QStringList &qmlDirs,
|
||||
|
||||
Utils::PathString moduleName{parser.typeNamespace()};
|
||||
ModuleId moduleId = m_projectStorage.moduleId(moduleName);
|
||||
ModuleId cppModuleId = m_projectStorage.moduleId(moduleName + "-cppnative");
|
||||
|
||||
auto imports = filterMultipleEntries(parser.imports());
|
||||
|
||||
addModuleExportedImports(package.moduleExportedImports, moduleId, imports, m_projectStorage);
|
||||
addModuleExportedImports(package.moduleExportedImports,
|
||||
moduleId,
|
||||
cppModuleId,
|
||||
imports,
|
||||
m_projectStorage);
|
||||
package.updatedModuleIds.push_back(moduleId);
|
||||
|
||||
const auto qmlProjectDatas = m_projectStorage.fetchProjectDatas(qmlDirSourceId);
|
||||
@@ -245,7 +251,6 @@ void ProjectStorageUpdater::updateQmldirs(const QStringList &qmlDirs,
|
||||
auto qmlTypes = filterMultipleEntries(parser.typeInfos());
|
||||
|
||||
if (!qmlTypes.isEmpty()) {
|
||||
ModuleId cppModuleId = m_projectStorage.moduleId(moduleName + "-cppnative");
|
||||
parseTypeInfos(qmlTypes,
|
||||
filterMultipleEntries(parser.dependencies()),
|
||||
imports,
|
||||
|
@@ -1161,7 +1161,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmldirImports)
|
||||
qmlModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::Yes},
|
||||
ModuleExportedImport{exampleModuleId,
|
||||
ModuleExportedImport{exampleCppNativeModuleId,
|
||||
qmlCppNativeModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No},
|
||||
@@ -1169,7 +1169,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmldirImports)
|
||||
builtinModuleId,
|
||||
Storage::Version{2, 1},
|
||||
IsAutoVersion::No},
|
||||
ModuleExportedImport{exampleModuleId,
|
||||
ModuleExportedImport{exampleCppNativeModuleId,
|
||||
builtinCppNativeModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No},
|
||||
@@ -1177,7 +1177,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmldirImports)
|
||||
quickModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No},
|
||||
ModuleExportedImport{exampleModuleId,
|
||||
ModuleExportedImport{exampleCppNativeModuleId,
|
||||
quickCppNativeModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No})),
|
||||
@@ -1218,7 +1218,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmldirImportsWithDoubleEntries)
|
||||
qmlModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::Yes},
|
||||
ModuleExportedImport{exampleModuleId,
|
||||
ModuleExportedImport{exampleCppNativeModuleId,
|
||||
qmlCppNativeModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No},
|
||||
@@ -1226,7 +1226,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmldirImportsWithDoubleEntries)
|
||||
builtinModuleId,
|
||||
Storage::Version{2, 1},
|
||||
IsAutoVersion::No},
|
||||
ModuleExportedImport{exampleModuleId,
|
||||
ModuleExportedImport{exampleCppNativeModuleId,
|
||||
builtinCppNativeModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No},
|
||||
@@ -1234,7 +1234,7 @@ TEST_F(ProjectStorageUpdater, SynchronizeQmldirImportsWithDoubleEntries)
|
||||
quickModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No},
|
||||
ModuleExportedImport{exampleModuleId,
|
||||
ModuleExportedImport{exampleCppNativeModuleId,
|
||||
quickCppNativeModuleId,
|
||||
Storage::Version{},
|
||||
IsAutoVersion::No})),
|
||||
|
Reference in New Issue
Block a user