forked from qt-creator/qt-creator
Qml: fix Boot2Qt deployment from Windows host
- fix QmlBuildSystem::target*() to resolve maybe device files - Cache lookup of qml path on device Task-number: QDS-9994 Change-Id: I5675368368f2d1cc513feb98fdcdd75fda1a764a Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -107,9 +107,8 @@ void QmlBuildSystem::updateDeploymentData()
|
||||
}
|
||||
|
||||
ProjectExplorer::DeploymentData deploymentData;
|
||||
for (const auto &file : m_projectItem->files()) {
|
||||
deploymentData.addFile(file, targetFile(file).parentDir().toString());
|
||||
}
|
||||
for (const auto &file : m_projectItem->files())
|
||||
deploymentData.addFile(file, m_projectItem->targetDirectory());
|
||||
|
||||
setDeploymentData(deploymentData);
|
||||
}
|
||||
@@ -160,9 +159,7 @@ void QmlBuildSystem::triggerParsing()
|
||||
|
||||
Utils::FilePath QmlBuildSystem::canonicalProjectDir() const
|
||||
{
|
||||
return BuildSystem::target()
|
||||
->project()
|
||||
->projectFilePath()
|
||||
return projectFilePath()
|
||||
.canonicalPath()
|
||||
.normalizedPathName()
|
||||
.parentDir();
|
||||
@@ -188,10 +185,11 @@ void QmlBuildSystem::refresh(RefreshOptions options)
|
||||
QmlJS::ModelManagerInterface::ProjectInfo projectInfo
|
||||
= modelManager->defaultProjectInfoForProject(project(),
|
||||
project()->files(Project::HiddenRccFolders));
|
||||
const QStringList searchPaths = makeAbsolute(canonicalProjectDir(), customImportPaths());
|
||||
for (const QString &searchPath : searchPaths)
|
||||
projectInfo.importPaths.maybeInsert(Utils::FilePath::fromString(searchPath),
|
||||
|
||||
for (const QString &searchPath : customImportPaths()) {
|
||||
projectInfo.importPaths.maybeInsert(projectFilePath().pathAppended(searchPath),
|
||||
QmlJS::Dialect::Qml);
|
||||
}
|
||||
|
||||
modelManager->updateProjectInfo(projectInfo, project());
|
||||
|
||||
@@ -370,22 +368,23 @@ bool QmlBuildSystem::setMainUiFileInMainFile(const Utils::FilePath &newMainUiFil
|
||||
|
||||
Utils::FilePath QmlBuildSystem::targetDirectory() const
|
||||
{
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
||||
return canonicalProjectDir();
|
||||
|
||||
return m_projectItem ? Utils::FilePath::fromString(m_projectItem->targetDirectory())
|
||||
: Utils::FilePath();
|
||||
Utils::FilePath result;
|
||||
if (DeviceTypeKitAspect::deviceTypeId(kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||
result = canonicalProjectDir();
|
||||
} else if (IDevice::ConstPtr device = DeviceKitAspect::device(kit())) {
|
||||
if (m_projectItem)
|
||||
result = device->filePath(m_projectItem->targetDirectory());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Utils::FilePath QmlBuildSystem::targetFile(const Utils::FilePath &sourceFile) const
|
||||
{
|
||||
const QDir sourceDir(m_projectItem ? m_projectItem->sourceDirectory().path()
|
||||
: canonicalProjectDir().toString());
|
||||
const QDir targetDir(targetDirectory().toString());
|
||||
const QString relative = sourceDir.relativeFilePath(sourceFile.toString());
|
||||
return Utils::FilePath::fromString(QDir::cleanPath(targetDir.absoluteFilePath(relative)));
|
||||
const Utils::FilePath sourceDir = m_projectItem ? m_projectItem->sourceDirectory()
|
||||
: canonicalProjectDir();
|
||||
const Utils::FilePath relative = sourceFile.relativePathFrom(sourceDir);
|
||||
return targetDirectory().resolvePath(relative);
|
||||
}
|
||||
|
||||
void QmlBuildSystem::setSupportedLanguages(QStringList languages)
|
||||
{
|
||||
m_projectItem->setSupportedLanguages(languages);
|
||||
@@ -396,18 +395,6 @@ void QmlBuildSystem::setPrimaryLanguage(QString language)
|
||||
m_projectItem->setPrimaryLanguage(language);
|
||||
}
|
||||
|
||||
QStringList QmlBuildSystem::makeAbsolute(const Utils::FilePath &path,
|
||||
const QStringList &relativePaths)
|
||||
{
|
||||
if (path.isEmpty())
|
||||
return relativePaths;
|
||||
|
||||
const QDir baseDir(path.toString());
|
||||
return Utils::transform(relativePaths, [&baseDir](const QString &path) {
|
||||
return QDir::cleanPath(baseDir.absoluteFilePath(path));
|
||||
});
|
||||
}
|
||||
|
||||
void QmlBuildSystem::refreshFiles(const QSet<QString> & /*added*/, const QSet<QString> &removed)
|
||||
{
|
||||
if (m_blockFilesUpdate) {
|
||||
|
||||
Reference in New Issue
Block a user