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 debugServerPath;
|
||||||
FilePath debugDumperPath = Core::ICore::resourcePath("debugger/");
|
FilePath debugDumperPath = Core::ICore::resourcePath("debugger/");
|
||||||
FilePath qmlRunCommand;
|
FilePath qmlRunCommand;
|
||||||
|
bool qmlRunCommandChecked = false;
|
||||||
bool emptyCommandAllowed = false;
|
bool emptyCommandAllowed = false;
|
||||||
|
|
||||||
QList<Icon> deviceIcons;
|
QList<Icon> deviceIcons;
|
||||||
@@ -603,12 +604,20 @@ void IDevice::setDebugServerPath(const FilePath &path)
|
|||||||
|
|
||||||
FilePath IDevice::qmlRunCommand() const
|
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;
|
return d->qmlRunCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setQmlRunCommand(const FilePath &path)
|
void IDevice::setQmlRunCommand(const FilePath &path)
|
||||||
{
|
{
|
||||||
d->qmlRunCommand = path;
|
d->qmlRunCommand = path;
|
||||||
|
d->qmlRunCommandChecked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IDevice::setExtraData(Id kind, const QVariant &data)
|
void IDevice::setExtraData(Id kind, const QVariant &data)
|
||||||
|
@@ -107,9 +107,8 @@ void QmlBuildSystem::updateDeploymentData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::DeploymentData deploymentData;
|
ProjectExplorer::DeploymentData deploymentData;
|
||||||
for (const auto &file : m_projectItem->files()) {
|
for (const auto &file : m_projectItem->files())
|
||||||
deploymentData.addFile(file, targetFile(file).parentDir().toString());
|
deploymentData.addFile(file, m_projectItem->targetDirectory());
|
||||||
}
|
|
||||||
|
|
||||||
setDeploymentData(deploymentData);
|
setDeploymentData(deploymentData);
|
||||||
}
|
}
|
||||||
@@ -160,9 +159,7 @@ void QmlBuildSystem::triggerParsing()
|
|||||||
|
|
||||||
Utils::FilePath QmlBuildSystem::canonicalProjectDir() const
|
Utils::FilePath QmlBuildSystem::canonicalProjectDir() const
|
||||||
{
|
{
|
||||||
return BuildSystem::target()
|
return projectFilePath()
|
||||||
->project()
|
|
||||||
->projectFilePath()
|
|
||||||
.canonicalPath()
|
.canonicalPath()
|
||||||
.normalizedPathName()
|
.normalizedPathName()
|
||||||
.parentDir();
|
.parentDir();
|
||||||
@@ -188,10 +185,11 @@ void QmlBuildSystem::refresh(RefreshOptions options)
|
|||||||
QmlJS::ModelManagerInterface::ProjectInfo projectInfo
|
QmlJS::ModelManagerInterface::ProjectInfo projectInfo
|
||||||
= modelManager->defaultProjectInfoForProject(project(),
|
= modelManager->defaultProjectInfoForProject(project(),
|
||||||
project()->files(Project::HiddenRccFolders));
|
project()->files(Project::HiddenRccFolders));
|
||||||
const QStringList searchPaths = makeAbsolute(canonicalProjectDir(), customImportPaths());
|
|
||||||
for (const QString &searchPath : searchPaths)
|
for (const QString &searchPath : customImportPaths()) {
|
||||||
projectInfo.importPaths.maybeInsert(Utils::FilePath::fromString(searchPath),
|
projectInfo.importPaths.maybeInsert(projectFilePath().pathAppended(searchPath),
|
||||||
QmlJS::Dialect::Qml);
|
QmlJS::Dialect::Qml);
|
||||||
|
}
|
||||||
|
|
||||||
modelManager->updateProjectInfo(projectInfo, project());
|
modelManager->updateProjectInfo(projectInfo, project());
|
||||||
|
|
||||||
@@ -370,22 +368,23 @@ bool QmlBuildSystem::setMainUiFileInMainFile(const Utils::FilePath &newMainUiFil
|
|||||||
|
|
||||||
Utils::FilePath QmlBuildSystem::targetDirectory() const
|
Utils::FilePath QmlBuildSystem::targetDirectory() const
|
||||||
{
|
{
|
||||||
if (DeviceTypeKitAspect::deviceTypeId(kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
|
Utils::FilePath result;
|
||||||
return canonicalProjectDir();
|
if (DeviceTypeKitAspect::deviceTypeId(kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
|
||||||
|
result = canonicalProjectDir();
|
||||||
return m_projectItem ? Utils::FilePath::fromString(m_projectItem->targetDirectory())
|
} else if (IDevice::ConstPtr device = DeviceKitAspect::device(kit())) {
|
||||||
: Utils::FilePath();
|
if (m_projectItem)
|
||||||
|
result = device->filePath(m_projectItem->targetDirectory());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::FilePath QmlBuildSystem::targetFile(const Utils::FilePath &sourceFile) const
|
Utils::FilePath QmlBuildSystem::targetFile(const Utils::FilePath &sourceFile) const
|
||||||
{
|
{
|
||||||
const QDir sourceDir(m_projectItem ? m_projectItem->sourceDirectory().path()
|
const Utils::FilePath sourceDir = m_projectItem ? m_projectItem->sourceDirectory()
|
||||||
: canonicalProjectDir().toString());
|
: canonicalProjectDir();
|
||||||
const QDir targetDir(targetDirectory().toString());
|
const Utils::FilePath relative = sourceFile.relativePathFrom(sourceDir);
|
||||||
const QString relative = sourceDir.relativeFilePath(sourceFile.toString());
|
return targetDirectory().resolvePath(relative);
|
||||||
return Utils::FilePath::fromString(QDir::cleanPath(targetDir.absoluteFilePath(relative)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlBuildSystem::setSupportedLanguages(QStringList languages)
|
void QmlBuildSystem::setSupportedLanguages(QStringList languages)
|
||||||
{
|
{
|
||||||
m_projectItem->setSupportedLanguages(languages);
|
m_projectItem->setSupportedLanguages(languages);
|
||||||
@@ -396,18 +395,6 @@ void QmlBuildSystem::setPrimaryLanguage(QString language)
|
|||||||
m_projectItem->setPrimaryLanguage(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)
|
void QmlBuildSystem::refreshFiles(const QSet<QString> & /*added*/, const QSet<QString> &removed)
|
||||||
{
|
{
|
||||||
if (m_blockFilesUpdate) {
|
if (m_blockFilesUpdate) {
|
||||||
|
@@ -89,9 +89,6 @@ public:
|
|||||||
bool addFiles(const QStringList &filePaths);
|
bool addFiles(const QStringList &filePaths);
|
||||||
void refreshProjectFile();
|
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);
|
void refreshFiles(const QSet<QString> &added, const QSet<QString> &removed);
|
||||||
|
|
||||||
bool blockFilesUpdate() const;
|
bool blockFilesUpdate() const;
|
||||||
|
@@ -91,11 +91,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
|||||||
|
|
||||||
// arguments from .qmlproject file
|
// arguments from .qmlproject file
|
||||||
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target->buildSystem());
|
const QmlBuildSystem *bs = qobject_cast<QmlBuildSystem *>(target->buildSystem());
|
||||||
const QStringList importPaths = QmlBuildSystem::makeAbsolute(bs->targetDirectory(),
|
for (const QString &importPath : bs->customImportPaths()) {
|
||||||
bs->customImportPaths());
|
|
||||||
for (const QString &importPath : importPaths) {
|
|
||||||
cmd.addArg("-I");
|
cmd.addArg("-I");
|
||||||
cmd.addArg(importPath);
|
cmd.addArg(bs->targetDirectory().pathAppended(importPath).path());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &fileSelector : bs->customFileSelectors()) {
|
for (const QString &fileSelector : bs->customFileSelectors()) {
|
||||||
@@ -114,8 +112,9 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FilePath main = bs->targetFile(mainScript());
|
const FilePath main = bs->targetFile(mainScript());
|
||||||
|
|
||||||
if (!main.isEmpty())
|
if (!main.isEmpty())
|
||||||
cmd.addArg(main.nativePath());
|
cmd.addArg(main.path());
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
});
|
});
|
||||||
|
@@ -978,7 +978,6 @@ LinuxDevice::LinuxDevice()
|
|||||||
addDeviceAction({Tr::tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) {
|
addDeviceAction({Tr::tr("Open Remote Shell"), [](const IDevice::Ptr &device, QWidget *) {
|
||||||
device->openTerminal(Environment(), FilePath());
|
device->openTerminal(Environment(), FilePath());
|
||||||
}});
|
}});
|
||||||
setQmlRunCommand(filePath("qml"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinuxDevice::_setOsType(Utils::OsType osType)
|
void LinuxDevice::_setOsType(Utils::OsType osType)
|
||||||
|
Reference in New Issue
Block a user