forked from qt-creator/qt-creator
QmakeProject: Show a better error message than just "Incompatible build"
Change-Id: I003e856dd5b222348bacd5acbdf9da4725864b35 Task-number: QTCREATORBUG-14021 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -308,7 +308,7 @@ MakeStep *QmakeBuildConfiguration::makeStep() const
|
||||
}
|
||||
|
||||
// Returns true if both are equal.
|
||||
QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile)
|
||||
QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportFrom(const QString &makefile, QString *errorString)
|
||||
{
|
||||
const QLoggingCategory &logs = MakeFileParse::logging();
|
||||
qCDebug(logs) << "QMakeBuildConfiguration::compareToImport";
|
||||
@@ -322,6 +322,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF
|
||||
}
|
||||
if (parse.makeFileState() == MakeFileParse::CouldNotParse) {
|
||||
qCDebug(logs) << "**Makefile incompatible";
|
||||
if (errorString)
|
||||
*errorString = tr("Could not parse Makefile.");
|
||||
return MakefileIncompatible;
|
||||
}
|
||||
|
||||
@@ -339,6 +341,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF
|
||||
if (parse.srcProFile() != qs->project()->projectFilePath().toString()) {
|
||||
qCDebug(logs) << "**Different profile used to generate the Makefile:"
|
||||
<< parse.srcProFile() << " expected profile:" << qs->project()->projectFilePath();
|
||||
if (errorString)
|
||||
*errorString = tr("The Makefile is for a different project.");
|
||||
return MakefileIncompatible;
|
||||
}
|
||||
|
||||
@@ -353,6 +357,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF
|
||||
if (qmakeBuildConfiguration() != buildConfig) {
|
||||
qCDebug(logs) << "**Different qmake buildconfigurations buildconfiguration:"
|
||||
<< qmakeBuildConfiguration() << " Makefile:" << buildConfig;
|
||||
if (errorString)
|
||||
*errorString = tr("The build type has changed.");
|
||||
return MakefileIncompatible;
|
||||
}
|
||||
|
||||
@@ -396,12 +402,16 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF
|
||||
actualArgs.sort();
|
||||
parsedArgs.sort();
|
||||
if (actualArgs != parsedArgs) {
|
||||
qCDebug(logs) << "**Mismateched args";
|
||||
qCDebug(logs) << "**Mismatched args";
|
||||
if (errorString)
|
||||
*errorString = tr("The qmake arguments have changed.");
|
||||
return MakefileIncompatible;
|
||||
}
|
||||
|
||||
if (parse.config() != qs->deducedArguments()) {
|
||||
qCDebug(logs) << "**Mismatched config";
|
||||
if (errorString)
|
||||
*errorString = tr("The qmake arguments have changed.");
|
||||
return MakefileIncompatible;
|
||||
}
|
||||
|
||||
@@ -419,6 +429,8 @@ QmakeBuildConfiguration::MakefileState QmakeBuildConfiguration::compareToImportF
|
||||
}
|
||||
|
||||
qCDebug(logs) << "**Incompatible specs";
|
||||
if (errorString)
|
||||
*errorString = tr("The mkspec has changed.");
|
||||
return MakefileIncompatible;
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
QString makefile() const;
|
||||
|
||||
enum MakefileState { MakefileMatches, MakefileForWrongProject, MakefileIncompatible, MakefileMissing };
|
||||
MakefileState compareToImportFrom(const QString &makefile);
|
||||
MakefileState compareToImportFrom(const QString &makefile, QString *errorString = 0);
|
||||
static Utils::FileName extractSpecFromArguments(QString *arguments,
|
||||
const QString &directory, const QtSupport::BaseQtVersion *version,
|
||||
QStringList *outArgs = 0);
|
||||
|
||||
@@ -213,6 +213,7 @@ void QmakeProjectConfigWidget::updateProblemLabel()
|
||||
bool incompatibleBuild = false;
|
||||
bool allGood = false;
|
||||
// we only show if we actually have a qmake and makestep
|
||||
QString errorString;
|
||||
if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
|
||||
QString makefile = m_buildConfiguration->buildDirectory().toString() + QLatin1Char('/');
|
||||
if (m_buildConfiguration->makefile().isEmpty())
|
||||
@@ -220,7 +221,7 @@ void QmakeProjectConfigWidget::updateProblemLabel()
|
||||
else
|
||||
makefile.append(m_buildConfiguration->makefile());
|
||||
|
||||
switch (m_buildConfiguration->compareToImportFrom(makefile)) {
|
||||
switch (m_buildConfiguration->compareToImportFrom(makefile, &errorString)) {
|
||||
case QmakeBuildConfiguration::MakefileMatches:
|
||||
allGood = true;
|
||||
break;
|
||||
@@ -274,8 +275,9 @@ void QmakeProjectConfigWidget::updateProblemLabel()
|
||||
.arg(m_buildConfiguration->buildDirectory().toUserOutput()));
|
||||
return;
|
||||
} else if (incompatibleBuild) {
|
||||
setProblemLabel(tr("An incompatible build exists in %1, which will be overwritten.",
|
||||
"%1 build directory")
|
||||
setProblemLabel(tr("%1 The build in %2 will be overwritten.",
|
||||
"%1 error message, %2 build directory")
|
||||
.arg(errorString)
|
||||
.arg(m_buildConfiguration->buildDirectory().toUserOutput()));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user