factor out QMakeEvaluator::prepareProject()

Change-Id: I99a5b0b9ef3080ebc5d0546c3bf17c8806a52c72
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Oswald Buddenhagen
2012-06-08 18:01:37 +02:00
parent 9e60457d59
commit 05798f87cb
2 changed files with 39 additions and 33 deletions

View File

@@ -820,6 +820,43 @@ void QMakeEvaluator::visitProVariable(
}
}
void QMakeEvaluator::prepareProject()
{
// ### init QMAKE_QMAKE, QMAKE_SH
// ### init QMAKE_EXT_{C,H,CPP,OBJ}
// ### init TEMPLATE_PREFIX
if (m_option->do_cache) {
QString qmake_cache = m_option->cachefile;
if (qmake_cache.isEmpty() && !m_outputDir.isEmpty()) { //find it as it has not been specified
QDir dir(m_outputDir);
forever {
qmake_cache = dir.path() + QLatin1String("/.qmake.cache");
if (IoUtils::exists(qmake_cache))
break;
if (!dir.cdUp() || dir.isRoot()) {
qmake_cache.clear();
break;
}
}
}
if (!qmake_cache.isEmpty()) {
ProValueMap cache_valuemap;
if (evaluateFileInto(qmake_cache, QMakeHandler::EvalConfigFile,
&cache_valuemap, EvalProOnly)) {
if (m_option->qmakespec.isEmpty()) {
const ProStringList &vals = cache_valuemap.value(ProString("QMAKESPEC"));
if (!vals.isEmpty())
m_option->qmakespec = vals.first().toQString();
}
} else {
qmake_cache.clear();
}
}
m_option->cachefile = qmake_cache;
}
}
void QMakeEvaluator::loadSpec()
{
QString qmakespec = m_option->expandEnvVars(m_option->qmakespec);
@@ -910,39 +947,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
m_cumulative = false;
#endif
// ### init QMAKE_QMAKE, QMAKE_SH
// ### init QMAKE_EXT_{C,H,CPP,OBJ}
// ### init TEMPLATE_PREFIX
if (m_option->do_cache) {
QString qmake_cache = m_option->cachefile;
if (qmake_cache.isEmpty() && !m_outputDir.isEmpty()) { //find it as it has not been specified
QDir dir(m_outputDir);
forever {
qmake_cache = dir.path() + QLatin1String("/.qmake.cache");
if (IoUtils::exists(qmake_cache))
break;
if (!dir.cdUp() || dir.isRoot()) {
qmake_cache.clear();
break;
}
}
}
if (!qmake_cache.isEmpty()) {
ProValueMap cache_valuemap;
if (evaluateFileInto(qmake_cache, QMakeHandler::EvalConfigFile,
&cache_valuemap, EvalProOnly)) {
if (m_option->qmakespec.isEmpty()) {
const ProStringList &vals = cache_valuemap.value(ProString("QMAKESPEC"));
if (!vals.isEmpty())
m_option->qmakespec = vals.first().toQString();
}
} else {
qmake_cache.clear();
}
}
m_option->cachefile = qmake_cache;
}
prepareProject();
loadSpec();