forked from qt-creator/qt-creator
CMake: Move error and warning handling
... from CMakeBuildConfiguration to CMakeBuildSystem. Less back-and-forth this way. Also, prefer plain buildConfiguration() over cmakeBuildConfiguration() back-pointers. Change-Id: Ie1341302ecc10e53d71ca68b7b6eb5f46cfdad5f Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -188,8 +188,8 @@ CMakeBuildSystem::CMakeBuildSystem(CMakeBuildConfiguration *bc)
|
||||
return type;
|
||||
});
|
||||
|
||||
connect(&m_reader, &FileApiReader::configurationStarted, this, [this]() {
|
||||
cmakeBuildConfiguration()->clearError(CMakeBuildConfiguration::ForceEnabledChanged::True);
|
||||
connect(&m_reader, &FileApiReader::configurationStarted, this, [this] {
|
||||
clearError(ForceEnabledChanged::True);
|
||||
});
|
||||
|
||||
connect(&m_reader,
|
||||
@@ -217,9 +217,9 @@ CMakeBuildSystem::~CMakeBuildSystem()
|
||||
|
||||
void CMakeBuildSystem::triggerParsing()
|
||||
{
|
||||
qCDebug(cmakeBuildSystemLog) << cmakeBuildConfiguration()->displayName() << "Parsing has been triggered";
|
||||
qCDebug(cmakeBuildSystemLog) << buildConfiguration()->displayName() << "Parsing has been triggered";
|
||||
|
||||
if (!cmakeBuildConfiguration()->isActive()) {
|
||||
if (!buildConfiguration()->isActive()) {
|
||||
qCDebug(cmakeBuildSystemLog)
|
||||
<< "Parsing has been triggered: SKIPPING since BC is not active -- clearing state.";
|
||||
stopParsingAndClearState();
|
||||
@@ -317,8 +317,7 @@ FilePaths CMakeBuildSystem::filesGeneratedFrom(const FilePath &sourceFile) const
|
||||
}
|
||||
|
||||
const FilePath relativePath = baseDirectory.relativePath(project);
|
||||
FilePath generatedFilePath = cmakeBuildConfiguration()->buildDirectory().resolvePath(
|
||||
relativePath);
|
||||
FilePath generatedFilePath = buildConfiguration()->buildDirectory().resolvePath(relativePath);
|
||||
|
||||
if (sourceFile.suffix() == "ui") {
|
||||
generatedFilePath = generatedFilePath
|
||||
@@ -356,11 +355,11 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa
|
||||
{
|
||||
project()->clearIssues();
|
||||
|
||||
qCDebug(cmakeBuildSystemLog) << cmakeBuildConfiguration()->displayName()
|
||||
qCDebug(cmakeBuildSystemLog) << buildConfiguration()->displayName()
|
||||
<< "setting parameters and requesting reparse"
|
||||
<< reparseParametersString(reparseParameters);
|
||||
|
||||
if (!cmakeBuildConfiguration()->isActive()) {
|
||||
if (!buildConfiguration()->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!
|
||||
@@ -504,7 +503,7 @@ void CMakeBuildSystem::clearCMakeCache()
|
||||
|
||||
void CMakeBuildSystem::combineScanAndParse(bool restoredFromBackup)
|
||||
{
|
||||
if (cmakeBuildConfiguration()->isActive()) {
|
||||
if (buildConfiguration()->isActive()) {
|
||||
if (m_waitingForParse)
|
||||
return;
|
||||
|
||||
@@ -543,7 +542,7 @@ void CMakeBuildSystem::combineScanAndParse(bool restoredFromBackup)
|
||||
void CMakeBuildSystem::checkAndReportError(QString &errorMessage)
|
||||
{
|
||||
if (!errorMessage.isEmpty()) {
|
||||
cmakeBuildConfiguration()->setError(errorMessage);
|
||||
setError(errorMessage);
|
||||
errorMessage.clear();
|
||||
}
|
||||
}
|
||||
@@ -554,7 +553,7 @@ void CMakeBuildSystem::updateProjectData()
|
||||
|
||||
QTC_ASSERT(m_treeScanner.isFinished() && !m_reader.isParsing(), return );
|
||||
|
||||
cmakeBuildConfiguration()->project()->setExtraProjectFiles(m_reader.projectFilesToWatch());
|
||||
buildConfiguration()->project()->setExtraProjectFiles(m_reader.projectFilesToWatch());
|
||||
|
||||
CMakeConfig patchedConfig = cmakeBuildConfiguration()->configurationFromCMake();
|
||||
{
|
||||
@@ -621,7 +620,7 @@ void CMakeBuildSystem::updateProjectData()
|
||||
QString errorMessage;
|
||||
RawProjectParts rpps = m_reader.createRawProjectParts(errorMessage);
|
||||
if (!errorMessage.isEmpty())
|
||||
cmakeBuildConfiguration()->setError(errorMessage);
|
||||
setError(errorMessage);
|
||||
qCDebug(cmakeBuildSystemLog) << "Raw project parts created." << errorMessage;
|
||||
|
||||
{
|
||||
@@ -639,7 +638,7 @@ void CMakeBuildSystem::updateProjectData()
|
||||
}
|
||||
}
|
||||
|
||||
m_cppCodeModelUpdater->update({p, kitInfo, cmakeBuildConfiguration()->environment(), rpps},
|
||||
m_cppCodeModelUpdater->update({p, kitInfo, buildConfiguration()->environment(), rpps},
|
||||
m_extraCompilers);
|
||||
}
|
||||
{
|
||||
@@ -648,7 +647,7 @@ void CMakeBuildSystem::updateProjectData()
|
||||
QStringList extraHeaderPaths;
|
||||
QList<QByteArray> moduleMappings;
|
||||
for (const RawProjectPart &rpp : qAsConst(rpps)) {
|
||||
FilePath moduleMapFile = cmakeBuildConfiguration()->buildDirectory()
|
||||
FilePath moduleMapFile = buildConfiguration()->buildDirectory()
|
||||
.pathAppended("qml_module_mappings/" + rpp.buildSystemTarget);
|
||||
if (moduleMapFile.exists()) {
|
||||
QFile mmf(moduleMapFile.toString());
|
||||
@@ -673,7 +672,7 @@ void CMakeBuildSystem::updateProjectData()
|
||||
}
|
||||
updateInitialCMakeExpandableVars();
|
||||
|
||||
emit cmakeBuildConfiguration()->buildTypeChanged();
|
||||
emit buildConfiguration()->buildTypeChanged();
|
||||
|
||||
qCDebug(cmakeBuildSystemLog) << "All CMake project data up to date.";
|
||||
}
|
||||
@@ -747,12 +746,12 @@ void CMakeBuildSystem::updateCMakeConfiguration(QString &errorMessage)
|
||||
|
||||
void CMakeBuildSystem::handleParsingSucceeded(bool restoredFromBackup)
|
||||
{
|
||||
if (!cmakeBuildConfiguration()->isActive()) {
|
||||
if (!buildConfiguration()->isActive()) {
|
||||
stopParsingAndClearState();
|
||||
return;
|
||||
}
|
||||
|
||||
cmakeBuildConfiguration()->clearError();
|
||||
clearError();
|
||||
|
||||
QString errorMessage;
|
||||
{
|
||||
@@ -785,7 +784,7 @@ void CMakeBuildSystem::handleParsingSucceeded(bool restoredFromBackup)
|
||||
|
||||
void CMakeBuildSystem::handleParsingFailed(const QString &msg)
|
||||
{
|
||||
cmakeBuildConfiguration()->setError(msg);
|
||||
setError(msg);
|
||||
|
||||
QString errorMessage;
|
||||
updateCMakeConfiguration(errorMessage);
|
||||
@@ -875,7 +874,7 @@ FilePath CMakeBuildSystem::buildDirectory(const BuildDirParameters ¶meters)
|
||||
{
|
||||
const FilePath bdir = parameters.buildDirectory;
|
||||
|
||||
if (!cmakeBuildConfiguration()->createBuildDirectory())
|
||||
if (!buildConfiguration()->createBuildDirectory())
|
||||
handleParsingFailed(
|
||||
tr("Failed to create build directory \"%1\".").arg(bdir.toUserOutput()));
|
||||
|
||||
@@ -884,7 +883,7 @@ FilePath CMakeBuildSystem::buildDirectory(const BuildDirParameters ¶meters)
|
||||
|
||||
void CMakeBuildSystem::stopParsingAndClearState()
|
||||
{
|
||||
qCDebug(cmakeBuildSystemLog) << cmakeBuildConfiguration()->displayName()
|
||||
qCDebug(cmakeBuildSystemLog) << buildConfiguration()->displayName()
|
||||
<< "stopping parsing run!";
|
||||
m_reader.stop();
|
||||
m_reader.resetData();
|
||||
@@ -913,7 +912,7 @@ int CMakeBuildSystem::takeReparseParameters()
|
||||
|
||||
void CMakeBuildSystem::runCTest()
|
||||
{
|
||||
if (!cmakeBuildConfiguration()->error().isEmpty() || m_ctestPath.isEmpty()) {
|
||||
if (!m_error.isEmpty() || m_ctestPath.isEmpty()) {
|
||||
qCDebug(cmakeBuildSystemLog) << "Cancel ctest run after failed cmake run";
|
||||
emit testInformationUpdated();
|
||||
return;
|
||||
@@ -1110,7 +1109,7 @@ DeploymentData CMakeBuildSystem::deploymentData() const
|
||||
DeploymentData result;
|
||||
|
||||
QDir sourceDir = project()->projectDirectory().toString();
|
||||
QDir buildDir = cmakeBuildConfiguration()->buildDirectory().toString();
|
||||
QDir buildDir = buildConfiguration()->buildDirectory().toString();
|
||||
|
||||
QString deploymentPrefix;
|
||||
QString deploymentFilePath = sourceDir.filePath("QtCreatorDeployment.txt");
|
||||
|
||||
Reference in New Issue
Block a user