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:
@@ -142,6 +142,7 @@ public:
|
||||
FilePath debugServerPath;
|
||||
FilePath debugDumperPath = Core::ICore::resourcePath("debugger/");
|
||||
FilePath qmlRunCommand;
|
||||
bool qmlRunCommandChecked = false;
|
||||
bool emptyCommandAllowed = false;
|
||||
|
||||
QList<Icon> deviceIcons;
|
||||
@@ -603,12 +604,20 @@ void IDevice::setDebugServerPath(const FilePath &path)
|
||||
|
||||
FilePath IDevice::qmlRunCommand() const
|
||||
{
|
||||
if (!d->qmlRunCommandChecked) {
|
||||
d->qmlRunCommandChecked = true;
|
||||
QString runtime = d->qmlRunCommand.path();
|
||||
if (runtime.isEmpty())
|
||||
runtime = "qml";
|
||||
d->qmlRunCommand = searchExecutableInPath(runtime);
|
||||
}
|
||||
return d->qmlRunCommand;
|
||||
}
|
||||
|
||||
void IDevice::setQmlRunCommand(const FilePath &path)
|
||||
{
|
||||
d->qmlRunCommand = path;
|
||||
d->qmlRunCommandChecked = false;
|
||||
}
|
||||
|
||||
void IDevice::setExtraData(Id kind, const QVariant &data)
|
||||
|
@@ -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) {
|
||||
|
@@ -89,9 +89,6 @@ public:
|
||||
bool addFiles(const QStringList &filePaths);
|
||||
void refreshProjectFile();
|
||||
|
||||
static Utils::FilePath activeMainFilePath();
|
||||
static QStringList makeAbsolute(const Utils::FilePath &path, const QStringList &relativePaths);
|
||||
|
||||
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
|
||||
|
||||
bool blockFilesUpdate() const;
|
||||
|
@@ -91,11 +91,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||
|
||||
// arguments from .qmlproject file
|
||||
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target->buildSystem());
|
||||
const QStringList importPaths = QmlBuildSystem::makeAbsolute(bs->targetDirectory(),
|
||||
bs->customImportPaths());
|
||||
for (const QString &importPath : importPaths) {
|
||||
for (const QString &importPath : bs->customImportPaths()) {
|
||||
cmd.addArg("-I");
|
||||
cmd.addArg(importPath);
|
||||
cmd.addArg(bs->targetDirectory().pathAppended(importPath).path());
|
||||
}
|
||||
|
||||
for (const QString &fileSelector : bs->customFileSelectors()) {
|
||||
@@ -114,8 +112,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||
}
|
||||
|
||||
const FilePath main = bs->targetFile(mainScript());
|
||||
|
||||
if (!main.isEmpty())
|
||||
cmd.addArg(main.nativePath());
|
||||
cmd.addArg(main.path());
|
||||
|
||||
return cmd;
|
||||
});
|
||||
|
@@ -978,7 +978,6 @@ LinuxDevice::LinuxDevice()
|
||||
addDeviceAction({Tr::tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) {
|
||||
device->openTerminal(Environment(), FilePath());
|
||||
}});
|
||||
setQmlRunCommand(filePath("qml"));
|
||||
}
|
||||
|
||||
void LinuxDevice::_setOsType(Utils::OsType osType)
|
||||
|
Reference in New Issue
Block a user