CMake: Remove BuildDirManager

The BuildDirManager was used to switch between different
BuildDirReaders. Now that only the FileApiReader is left, that
infrastructure is no longer needed.

Change-Id: I2d339a3407bb633cff6a8f7502b7b09094f63fef
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Tobias Hunger
2020-04-24 10:29:43 +02:00
parent db4f6a0e94
commit 59473389b9
12 changed files with 475 additions and 816 deletions

View File

@@ -25,10 +25,17 @@
#pragma once
#include "builddirmanager.h"
#include "builddirparameters.h"
#include "cmakebuildtarget.h"
#include "cmakeprojectnodes.h"
#include "fileapireader.h"
#include "utils/macroexpander.h"
#include <projectexplorer/buildsystem.h>
#include <utils/fileutils.h>
#include <utils/temporarydirectory.h>
namespace ProjectExplorer { class ExtraCompiler; }
namespace CppTools {
@@ -81,7 +88,28 @@ public:
CMakeBuildConfiguration *cmakeBuildConfiguration() const;
// Generic CMake helper functions:
static CMakeConfig parseCMakeCacheDotTxt(const Utils::FilePath &cacheFile,
QString *errorMessage);
private:
// Actually ask for parsing:
enum ReparseParameters {
REPARSE_DEFAULT = 0, // Nothing special:-)
REPARSE_FORCE_CMAKE_RUN = (1 << 0), // Force cmake to run
REPARSE_FORCE_CONFIGURATION = (1 << 1), // Force configuration arguments to cmake
REPARSE_CHECK_CONFIGURATION
= (1 << 2), // Check for on-disk config and QtC config diff // FIXME: Remove this!
REPARSE_SCAN = (1 << 3), // Run filesystem scan
REPARSE_URGENT = (1 << 4), // Do not delay the parser run by 1s
};
QString reparseParametersString(int reparseFlags);
void setParametersAndRequestParse(const BuildDirParameters &parameters,
const int reparseParameters);
void writeConfigurationIntoBuildDirectory(const Utils::MacroExpander *expander);
// State handling:
// Parser states:
void handleParsingSuccess();
void handleParsingError();
@@ -106,7 +134,12 @@ private:
void wireUpConnections(const ProjectExplorer::Project *p);
BuildDirManager m_buildDirManager;
Utils::FilePath workDirectory(const BuildDirParameters &parameters);
void stopParsingAndClearState();
void becameDirty();
void updateReparseParameters(const int parameters);
int takeReparseParameters();
ProjectExplorer::TreeScanner m_treeScanner;
QHash<QString, bool> m_mimeBinaryCache;
@@ -121,6 +154,17 @@ private:
CppTools::CppProjectUpdater *m_cppCodeModelUpdater = nullptr;
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
QList<CMakeBuildTarget> m_buildTargets;
bool checkConfiguration();
bool hasConfigChanged();
// Parsing state:
BuildDirParameters m_parameters;
int m_reparseParameters;
mutable std::unordered_map<Utils::FilePath, std::unique_ptr<Utils::TemporaryDirectory>>
m_buildDirToTempDir;
FileApiReader m_reader;
mutable bool m_isHandlingError = false;
};
} // namespace Internal