forked from qt-creator/qt-creator
CMake: Parse project on initial load
When opening a project for the first time, the project has already been added to the session when the BuildSystem object is created, whereas the code expected a different order. Fixes: QTCREATORBUG-24318 Change-Id: I8ccfeab7da4e566670f61bfe677a293033bdfe44 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -195,10 +195,7 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
|
|||||||
connect(&m_reader, &FileApiReader::errorOccurred, this, &CMakeBuildSystem::handleParsingFailed);
|
connect(&m_reader, &FileApiReader::errorOccurred, this, &CMakeBuildSystem::handleParsingFailed);
|
||||||
connect(&m_reader, &FileApiReader::dirty, this, &CMakeBuildSystem::becameDirty);
|
connect(&m_reader, &FileApiReader::dirty, this, &CMakeBuildSystem::becameDirty);
|
||||||
|
|
||||||
connect(SessionManager::instance(),
|
wireUpConnections();
|
||||||
&SessionManager::projectAdded,
|
|
||||||
this,
|
|
||||||
&CMakeBuildSystem::wireUpConnections);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildSystem::~CMakeBuildSystem()
|
CMakeBuildSystem::~CMakeBuildSystem()
|
||||||
@@ -712,13 +709,8 @@ void CMakeBuildSystem::handleParsingFailed(const QString &msg)
|
|||||||
combineScanAndParse();
|
combineScanAndParse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildSystem::wireUpConnections(const Project *p)
|
void CMakeBuildSystem::wireUpConnections()
|
||||||
{
|
{
|
||||||
if (p != project())
|
|
||||||
return; // That's not us...
|
|
||||||
|
|
||||||
disconnect(SessionManager::instance(), nullptr, this, nullptr);
|
|
||||||
|
|
||||||
// At this point the entire project will be fully configured, so let's connect everything and
|
// At this point the entire project will be fully configured, so let's connect everything and
|
||||||
// trigger an initial parser run
|
// trigger an initial parser run
|
||||||
|
|
||||||
@@ -740,6 +732,12 @@ void CMakeBuildSystem::wireUpConnections(const Project *p)
|
|||||||
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
||||||
CMakeBuildSystem::REPARSE_DEFAULT);
|
CMakeBuildSystem::REPARSE_DEFAULT);
|
||||||
});
|
});
|
||||||
|
connect(project(), &Project::activeTargetChanged, this, [this]() {
|
||||||
|
// Build configuration has changed:
|
||||||
|
qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active target changed";
|
||||||
|
setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
|
||||||
|
CMakeBuildSystem::REPARSE_DEFAULT);
|
||||||
|
});
|
||||||
|
|
||||||
// BuildConfiguration changed:
|
// BuildConfiguration changed:
|
||||||
connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::environmentChanged, this, [this]() {
|
connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::environmentChanged, this, [this]() {
|
||||||
|
@@ -134,7 +134,7 @@ private:
|
|||||||
void handleParsingSucceeded();
|
void handleParsingSucceeded();
|
||||||
void handleParsingFailed(const QString &msg);
|
void handleParsingFailed(const QString &msg);
|
||||||
|
|
||||||
void wireUpConnections(const ProjectExplorer::Project *p);
|
void wireUpConnections();
|
||||||
|
|
||||||
Utils::FilePath workDirectory(const BuildDirParameters ¶meters);
|
Utils::FilePath workDirectory(const BuildDirParameters ¶meters);
|
||||||
void stopParsingAndClearState();
|
void stopParsingAndClearState();
|
||||||
|
Reference in New Issue
Block a user