forked from qt-creator/qt-creator
Qt4ProjectManager: Be more careful in detecing incompatible builds
Task-Nr: QTCREATORBUG-4555 Reviewed-By: hunger
This commit is contained in:
@@ -328,6 +328,7 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
bool visible = false;
|
||||
bool targetMatches = false;
|
||||
bool incompatibleBuild = false;
|
||||
bool couldnotparse = false;
|
||||
|
||||
QtVersionManager *vm = QtVersionManager::instance();
|
||||
// we only show if we actually have a qmake and makestep
|
||||
@@ -343,9 +344,12 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
// check that there's a makefile
|
||||
if (!qmakePath.isEmpty()) {
|
||||
// Is it from the same build?
|
||||
if (!QtVersionManager::makefileIsFor(makefile, m_buildConfiguration->target()->project()->file()->fileName())) {
|
||||
QtVersionManager::MakefileCompatible mc =
|
||||
QtVersionManager::makefileIsFor(makefile, m_buildConfiguration->target()->project()->file()->fileName());
|
||||
if (mc == QtVersionManager::DifferentProject) {
|
||||
incompatibleBuild = true;
|
||||
} else if (qmakePath != (version ? version->qmakeCommand() : QString())) {
|
||||
} else if (mc == QtVersionManager::SameProject) {
|
||||
if (qmakePath != (version ? version->qmakeCommand() : QString())) {
|
||||
// and that the qmake path is different from the current version
|
||||
// import enable
|
||||
visible = true;
|
||||
@@ -363,6 +367,9 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
visible = !m_buildConfiguration->compareToImportFrom(makefile);
|
||||
targetMatches = true;
|
||||
}
|
||||
} else if (mc == QtVersionManager::CouldNotParse) {
|
||||
couldnotparse = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,7 +416,11 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
||||
m_ui->problemLabel->setVisible(false);
|
||||
m_ui->warningLabel->setVisible(false);
|
||||
m_ui->importLabel->setVisible(visible);
|
||||
} else {
|
||||
} else if (couldnotparse) {
|
||||
m_ui->problemLabel->setVisible(false);
|
||||
m_ui->warningLabel->setVisible(false);
|
||||
m_ui->importLabel->setVisible(false);
|
||||
} else { // target did not match
|
||||
m_ui->warningLabel->setVisible(visible);
|
||||
m_ui->problemLabel->setVisible(visible);
|
||||
m_ui->problemLabel->setText(tr("An incompatible build exists in %1, which will be overwritten.",
|
||||
|
||||
@@ -1081,7 +1081,7 @@ BuildConfigurationInfo BuildConfigurationInfo::checkForBuild(const QString &dire
|
||||
QString qmakeBinary = QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
||||
if (qmakeBinary.isEmpty())
|
||||
return BuildConfigurationInfo();
|
||||
if (!QtVersionManager::makefileIsFor(makefile, proFilePath))
|
||||
if (QtVersionManager::makefileIsFor(makefile, proFilePath) != QtVersionManager::SameProject)
|
||||
return BuildConfigurationInfo();
|
||||
|
||||
bool temporaryQtVersion = false;
|
||||
|
||||
@@ -1011,21 +1011,21 @@ void dumpQMakeAssignments(const QList<QMakeAssignment> &list)
|
||||
}
|
||||
}
|
||||
|
||||
bool QtVersionManager::makefileIsFor(const QString &makefile, const QString &proFile)
|
||||
QtVersionManager::MakefileCompatible QtVersionManager::makefileIsFor(const QString &makefile, const QString &proFile)
|
||||
{
|
||||
if (proFile.isEmpty())
|
||||
return true;
|
||||
return CouldNotParse;
|
||||
|
||||
QString line = findQMakeLine(makefile, QLatin1String("# Project:")).trimmed();
|
||||
if (line.isEmpty())
|
||||
return false;
|
||||
return CouldNotParse;
|
||||
|
||||
line = line.mid(line.indexOf(QChar(':')) + 1);
|
||||
line = line.trimmed();
|
||||
|
||||
QFileInfo srcFileInfo(QFileInfo(makefile).absoluteDir(), line);
|
||||
QFileInfo proFileInfo(proFile);
|
||||
return srcFileInfo == proFileInfo;
|
||||
return (srcFileInfo == proFileInfo) ? SameProject : DifferentProject;
|
||||
}
|
||||
|
||||
QPair<QtVersion::QmakeBuildConfigs, QString> QtVersionManager::scanMakeFile(const QString &makefile, QtVersion::QmakeBuildConfigs defaultBuildConfig)
|
||||
|
||||
@@ -287,7 +287,9 @@ public:
|
||||
QSet<QString> supportedTargetIds() const;
|
||||
|
||||
// Static Methods
|
||||
static bool makefileIsFor(const QString &makefile, const QString &proFile);
|
||||
|
||||
enum MakefileCompatible { CouldNotParse, DifferentProject, SameProject };
|
||||
static MakefileCompatible makefileIsFor(const QString &makefile, const QString &proFile);
|
||||
static QPair<QtVersion::QmakeBuildConfigs, QString> scanMakeFile(const QString &makefile,
|
||||
QtVersion::QmakeBuildConfigs defaultBuildConfig);
|
||||
static QString findQMakeBinaryFromMakefile(const QString &directory);
|
||||
|
||||
Reference in New Issue
Block a user