forked from qt-creator/qt-creator
Make Qt4ProjectManager::QMakeStep mulithreading safe
Change-Id: I41abb5e7138351e61c6c9dfc87121837edb21fbe Reviewed-on: http://codereview.qt-project.org/5452 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -80,6 +80,7 @@ const char * const QMAKE_QMLDEBUGLIB_KEY("QtProjectManager.QMakeBuildStep.LinkQm
|
|||||||
QMakeStep::QMakeStep(BuildStepList *bsl) :
|
QMakeStep::QMakeStep(BuildStepList *bsl) :
|
||||||
AbstractProcessStep(bsl, QLatin1String(QMAKE_BS_ID)),
|
AbstractProcessStep(bsl, QLatin1String(QMAKE_BS_ID)),
|
||||||
m_forced(false),
|
m_forced(false),
|
||||||
|
m_needToRunQMake(false),
|
||||||
m_linkQmlDebuggingLibrary(DebugLink)
|
m_linkQmlDebuggingLibrary(DebugLink)
|
||||||
{
|
{
|
||||||
ctor();
|
ctor();
|
||||||
@@ -227,8 +228,6 @@ bool QMakeStep::init()
|
|||||||
|
|
||||||
QString program = qtVersion->qmakeCommand();
|
QString program = qtVersion->qmakeCommand();
|
||||||
|
|
||||||
// Check whether we need to run qmake
|
|
||||||
m_needToRunQMake = true;
|
|
||||||
QString makefile = workingDirectory;
|
QString makefile = workingDirectory;
|
||||||
|
|
||||||
if (qt4bc->subNodeBuild()) {
|
if (qt4bc->subNodeBuild()) {
|
||||||
@@ -244,17 +243,18 @@ bool QMakeStep::init()
|
|||||||
makefile.append("/Makefile");
|
makefile.append("/Makefile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check whether we need to run qmake
|
||||||
|
bool makefileOutDated = true;
|
||||||
if (QFileInfo(makefile).exists()) {
|
if (QFileInfo(makefile).exists()) {
|
||||||
QString qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
QString qmakePath = QtSupport::QtVersionManager::findQMakeBinaryFromMakefile(makefile);
|
||||||
if (qtVersion->qmakeCommand() == qmakePath) {
|
if (qtVersion->qmakeCommand() == qmakePath) {
|
||||||
m_needToRunQMake = !qt4bc->compareToImportFrom(makefile);
|
makefileOutDated = !qt4bc->compareToImportFrom(makefile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_forced) {
|
if (m_forced || makefileOutDated)
|
||||||
m_forced = false;
|
|
||||||
m_needToRunQMake = true;
|
m_needToRunQMake = true;
|
||||||
}
|
m_forced = false;
|
||||||
|
|
||||||
setEnabled(m_needToRunQMake);
|
setEnabled(m_needToRunQMake);
|
||||||
ProcessParameters *pp = processParameters();
|
ProcessParameters *pp = processParameters();
|
||||||
@@ -309,6 +309,7 @@ void QMakeStep::run(QFutureInterface<bool> &fi)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_needToRunQMake = false;
|
||||||
AbstractProcessStep::run(fi);
|
AbstractProcessStep::run(fi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -334,7 +335,7 @@ bool QMakeStep::immutable() const
|
|||||||
|
|
||||||
void QMakeStep::processStartupFailed()
|
void QMakeStep::processStartupFailed()
|
||||||
{
|
{
|
||||||
m_forced = true;
|
m_needToRunQMake = true;
|
||||||
AbstractProcessStep::processStartupFailed();
|
AbstractProcessStep::processStartupFailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +343,7 @@ bool QMakeStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
|
|||||||
{
|
{
|
||||||
bool result = AbstractProcessStep::processSucceeded(exitCode, status);
|
bool result = AbstractProcessStep::processSucceeded(exitCode, status);
|
||||||
if (!result)
|
if (!result)
|
||||||
m_forced = true;
|
m_needToRunQMake = true;
|
||||||
qt4BuildConfiguration()->emitBuildDirectoryInitialized();
|
qt4BuildConfiguration()->emitBuildDirectoryInitialized();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user