forked from qt-creator/qt-creator
QmlProjectManager: Fix for absolute import path problem
Task-number: QDS-10145 Change-Id: I11998b474a25351901ca0eb45716e1d3e309c572 Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -236,9 +236,7 @@ QStringList ExternalDependencies::modulePaths() const
|
|||||||
if (auto path = qmlPath(target); !path.isEmpty())
|
if (auto path = qmlPath(target); !path.isEmpty())
|
||||||
modulePaths.push_back(path);
|
modulePaths.push_back(path);
|
||||||
|
|
||||||
for (const QString &modulePath : qmlBuildSystem->customImportPaths())
|
modulePaths.append(qmlBuildSystem->absoluteImportPaths());
|
||||||
modulePaths.append(project->projectDirectory().pathAppended(modulePath).toString());
|
|
||||||
|
|
||||||
return modulePaths;
|
return modulePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,10 +248,7 @@ QStringList ExternalDependencies::projectModulePaths() const
|
|||||||
auto [project, target, qmlBuildSystem] = activeProjectEntries();
|
auto [project, target, qmlBuildSystem] = activeProjectEntries();
|
||||||
|
|
||||||
if (project && target && qmlBuildSystem) {
|
if (project && target && qmlBuildSystem) {
|
||||||
QStringList modulePaths;
|
return qmlBuildSystem->absoluteImportPaths();
|
||||||
|
|
||||||
for (const QString &modulePath : qmlBuildSystem->customImportPaths())
|
|
||||||
modulePaths.append(project->projectDirectory().pathAppended(modulePath).toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
@@ -200,8 +200,8 @@ void QmlBuildSystem::refresh(RefreshOptions options)
|
|||||||
= modelManager->defaultProjectInfoForProject(project(),
|
= modelManager->defaultProjectInfoForProject(project(),
|
||||||
project()->files(Project::HiddenRccFolders));
|
project()->files(Project::HiddenRccFolders));
|
||||||
|
|
||||||
for (const QString &searchPath : customImportPaths()) {
|
for (const QString &importPath : absoluteImportPaths()) {
|
||||||
projectInfo.importPaths.maybeInsert(projectDirectory().pathAppended(searchPath),
|
projectInfo.importPaths.maybeInsert(Utils::FilePath::fromString(importPath),
|
||||||
QmlJS::Dialect::Qml);
|
QmlJS::Dialect::Qml);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,6 +649,16 @@ QStringList QmlBuildSystem::importPaths() const
|
|||||||
return m_projectItem->importPaths();
|
return m_projectItem->importPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList QmlBuildSystem::absoluteImportPaths()
|
||||||
|
{
|
||||||
|
return Utils::transform<QStringList>(m_projectItem->importPaths(), [&](const QString &importPath) {
|
||||||
|
Utils::FilePath filePath = Utils::FilePath::fromString(importPath);
|
||||||
|
if (!filePath.isAbsolutePath())
|
||||||
|
return (projectDirectory() / importPath).toString();
|
||||||
|
return projectDirectory().resolvePath(importPath).toString();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Utils::FilePaths QmlBuildSystem::files() const
|
Utils::FilePaths QmlBuildSystem::files() const
|
||||||
{
|
{
|
||||||
return m_projectItem->files();
|
return m_projectItem->files();
|
||||||
|
@@ -68,18 +68,24 @@ public:
|
|||||||
Utils::FilePath targetFile(const Utils::FilePath &sourceFile) const;
|
Utils::FilePath targetFile(const Utils::FilePath &sourceFile) const;
|
||||||
|
|
||||||
Utils::EnvironmentItems environment() const;
|
Utils::EnvironmentItems environment() const;
|
||||||
|
|
||||||
|
QStringList importPaths() const;
|
||||||
|
QStringList absoluteImportPaths();
|
||||||
QStringList customImportPaths() const;
|
QStringList customImportPaths() const;
|
||||||
QStringList customFileSelectors() const;
|
QStringList customFileSelectors() const;
|
||||||
|
|
||||||
bool multilanguageSupport() const;
|
bool multilanguageSupport() const;
|
||||||
QStringList supportedLanguages() const;
|
QStringList supportedLanguages() const;
|
||||||
void setSupportedLanguages(QStringList languages);
|
void setSupportedLanguages(QStringList languages);
|
||||||
|
|
||||||
QString primaryLanguage() const;
|
QString primaryLanguage() const;
|
||||||
void setPrimaryLanguage(QString language);
|
void setPrimaryLanguage(QString language);
|
||||||
|
|
||||||
bool forceFreeType() const;
|
bool forceFreeType() const;
|
||||||
bool widgetApp() const;
|
bool widgetApp() const;
|
||||||
|
|
||||||
QStringList shaderToolArgs() const;
|
QStringList shaderToolArgs() const;
|
||||||
QStringList shaderToolFiles() const;
|
QStringList shaderToolFiles() const;
|
||||||
QStringList importPaths() const;
|
|
||||||
Utils::FilePaths files() const;
|
Utils::FilePaths files() const;
|
||||||
|
|
||||||
QString versionQt() const;
|
QString versionQt() const;
|
||||||
|
Reference in New Issue
Block a user