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