forked from qt-creator/qt-creator
QmlProjectManager: Use proper method to get qmlproject files for MCU
This patch replaces the blind traversing in the project root to find and parse the additional qmlproject files which are used by MCU projects. Instead it's now using the qmlProjectModules() function to reliably get the valid ones for the MCU projects. Task-number: QDS-13068 Change-Id: I4e5e1791714345b69c0b2ac7929ae39c30521224 Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
This commit is contained in:
@@ -237,28 +237,19 @@ void QmlBuildSystem::initMcuProjectItems()
|
||||
m_mcuProjectItems.clear();
|
||||
m_mcuProjectFilesWatcher.clear();
|
||||
|
||||
Utils::FilePath projectDir = projectFilePath().parentDir();
|
||||
// traverse the project dir and find all other mcu projects (.qmlproject files) in the project tree
|
||||
// and add them to the m_mcuProjectItems vector
|
||||
QDirIterator it(projectDir.toFSPathString(), QDir::Files, QDirIterator::Subdirectories);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (it.fileInfo().suffix() == "qmlproject" && it.filePath() != projectFilePath().toString()) {
|
||||
const QStringList mcuProjectFiles = m_projectItem->qmlProjectModules();
|
||||
for (const QString &mcuProjectFile : mcuProjectFiles) {
|
||||
auto qmlProjectItem = QSharedPointer<QmlProjectItem>(
|
||||
new QmlProjectItem{Utils::FilePath::fromString(it.filePath())});
|
||||
new QmlProjectItem{Utils::FilePath::fromString(mcuProjectFile)});
|
||||
|
||||
m_mcuProjectItems.append(qmlProjectItem);
|
||||
connect(qmlProjectItem.data(),
|
||||
&QmlProjectItem::filesChanged,
|
||||
this,
|
||||
&QmlBuildSystem::refreshFiles);
|
||||
connect(qmlProjectItem.data(), &QmlProjectItem::filesChanged, this, &QmlBuildSystem::refreshFiles);
|
||||
connect(qmlProjectItem.data(),
|
||||
&QmlProjectItem::filesChanged,
|
||||
m_cmakeGen,
|
||||
&GenerateCmake::CMakeGenerator::update);
|
||||
|
||||
m_mcuProjectFilesWatcher.addFile(it.filePath(),
|
||||
Utils::FileSystemWatcher::WatchModifiedDate);
|
||||
m_mcuProjectFilesWatcher.addFile(mcuProjectFile, Utils::FileSystemWatcher::WatchModifiedDate);
|
||||
|
||||
connect(&m_mcuProjectFilesWatcher,
|
||||
&Utils::FileSystemWatcher::fileChanged,
|
||||
@@ -270,7 +261,6 @@ void QmlBuildSystem::initMcuProjectItems()
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QmlBuildSystem::parseProjectFiles()
|
||||
{
|
||||
|
Reference in New Issue
Block a user