aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2020-06-15 12:31:44 +0200
committerTobias Hunger <tobias.hunger@qt.io>2020-06-15 10:34:01 +0000
commit1bc3e2f0bacc2d2c41e02005d566ae2f47899f9e (patch)
tree5ab5842ce367acef80497d20a01c53aadedb6a0c /src/plugins/cmakeprojectmanager
parent82555df811d590cfa0b43090cefb8371a9c6e834 (diff)
CMake: Be more paranoid about running several cmakes at the same time
Try to be more paranoid about having several cmake binaries run for the same project at the same time. Change-Id: I6ceca456e515c0beeff46e6912d15b2dd87283a2 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp70
1 files changed, 32 insertions, 38 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index ce38dfc78e..96bf16cd4e 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -208,6 +208,7 @@ CMakeBuildSystem::~CMakeBuildSystem()
future.cancel();
future.waitForFinished();
}
+
delete m_cppCodeModelUpdater;
qDeleteAll(m_extraCompilers);
qDeleteAll(m_allFiles);
@@ -215,7 +216,14 @@ CMakeBuildSystem::~CMakeBuildSystem()
void CMakeBuildSystem::triggerParsing()
{
- qCDebug(cmakeBuildSystemLog) << "Parsing has been triggered";
+ qCDebug(cmakeBuildSystemLog) << cmakeBuildConfiguration()->displayName() << "Parsing has been triggered";
+
+ if (!cmakeBuildConfiguration()->isActive()) {
+ qCDebug(cmakeBuildSystemLog)
+ << "Parsing has been triggered: SKIPPING since BC is not active -- clearing state.";
+ stopParsingAndClearState();
+ return; // ignore request, this build configuration is not active!
+ }
auto guard = guardParsingRun();
@@ -368,8 +376,16 @@ QString CMakeBuildSystem::reparseParametersString(int reparseFlags)
void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &parameters,
const int reparseParameters)
{
- qCDebug(cmakeBuildSystemLog) << "setting parameters and requesting reparse"
+ qCDebug(cmakeBuildSystemLog) << cmakeBuildConfiguration()->displayName()
+ << "setting parameters and requesting reparse"
<< reparseParametersString(reparseParameters);
+
+ if (!cmakeBuildConfiguration()->isActive()) {
+ qCDebug(cmakeBuildSystemLog) << "setting parameters and requesting reparse: SKIPPING since BC is not active -- clearing state.";
+ stopParsingAndClearState();
+ return; // ignore request, this build configuration is not active!
+ }
+
if (!parameters.cmakeTool()) {
TaskHub::addTask(
BuildSystemTask(Task::Error,
@@ -718,49 +734,27 @@ void CMakeBuildSystem::wireUpConnections(const Project *p)
});
// Became active/inactive:
- connect(project(), &Project::activeTargetChanged, this, [this](Target *t) {
- if (t == target()) {
- // Build configuration has changed along with the target:
- qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active target changed";
- setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
- CMakeBuildSystem::REPARSE_DEFAULT);
- } else {
- qCDebug(cmakeBuildSystemLog) << "Requesting STOP due to active target changed";
- stopParsingAndClearState();
- }
- });
connect(target(), &Target::activeBuildConfigurationChanged, this, [this](BuildConfiguration *bc) {
- if (cmakeBuildConfiguration()->isActive()) {
- if (cmakeBuildConfiguration() == bc) {
- // Build configuration has changed:
- qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active BC changed";
- setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
- CMakeBuildSystem::REPARSE_DEFAULT);
- } else {
- qCDebug(cmakeBuildSystemLog) << "Requesting STOP due to active BC changed";
- stopParsingAndClearState();
- }
- }
+ // Build configuration has changed:
+ qCDebug(cmakeBuildSystemLog) << "Requesting parse due to active BC changed";
+ setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
+ CMakeBuildSystem::REPARSE_DEFAULT);
});
// BuildConfiguration changed:
connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::environmentChanged, this, [this]() {
- if (cmakeBuildConfiguration()->isActive()) {
- // The environment on our BC has changed, force CMake run to catch up with possible changes
- qCDebug(cmakeBuildSystemLog) << "Requesting parse due to environment change";
- setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
- CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
- }
+ // The environment on our BC has changed, force CMake run to catch up with possible changes
+ qCDebug(cmakeBuildSystemLog) << "Requesting parse due to environment change";
+ setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
+ CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
});
connect(cmakeBuildConfiguration(), &CMakeBuildConfiguration::buildDirectoryChanged, this, [this]() {
- if (cmakeBuildConfiguration()->isActive()) {
- // The build directory of our BC has changed:
- // Run with initial arguments!
- qCDebug(cmakeBuildSystemLog) << "Requesting parse due to build directory change";
- setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
- CMakeBuildSystem::REPARSE_FORCE_INITIAL_CONFIGURATION
- | CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
- }
+ // The build directory of our BC has changed:
+ // Run with initial arguments!
+ qCDebug(cmakeBuildSystemLog) << "Requesting parse due to build directory change";
+ setParametersAndRequestParse(BuildDirParameters(cmakeBuildConfiguration()),
+ CMakeBuildSystem::REPARSE_FORCE_INITIAL_CONFIGURATION
+ | CMakeBuildSystem::REPARSE_FORCE_CMAKE_RUN);
});
connect(project(), &Project::projectFileIsDirty, this, [this]() {