aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/corelib/language/moduleloader.cpp9
-rw-r--r--src/lib/corelib/language/moduleloader.h6
2 files changed, 10 insertions, 5 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index 4d22e5efd..1e2c66c9a 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -112,6 +112,7 @@ ModuleLoaderResult ModuleLoader::load(const SetupProjectParameters &parameters)
m_logger.qbsTrace() << "[MODLDR] load" << parameters.projectFilePath();
m_parameters = parameters;
m_validItemPropertyNamesPerItem.clear();
+ m_globalModuleItemCache.clear();
m_disabledItems.clear();
ModuleLoaderResult result;
@@ -866,7 +867,7 @@ Item *ModuleLoader::loadModuleFile(ProductContext *productContext, const QString
if (m_logger.traceEnabled())
m_logger.qbsTrace() << "[MODLDR] trying to load " << fullModuleName << " from " << filePath;
- const ContextBase::ModuleItemCache::key_type cacheKey(filePath, productContext->profileName);
+ const ModuleItemCache::key_type cacheKey(filePath, productContext->profileName);
Item *module = productContext->moduleItemCache.value(cacheKey);
if (module) {
m_logger.qbsTrace() << "[LDR] loadModuleFile cache hit for " << filePath;
@@ -883,7 +884,11 @@ Item *ModuleLoader::loadModuleFile(ProductContext *productContext, const QString
m_logger.qbsTrace() << "[LDR] loadModuleFile " << filePath;
*cacheHit = false;
- module = m_reader->readFile(filePath);
+ module = m_globalModuleItemCache.value(cacheKey);
+ if (!module) {
+ module = m_reader->readFile(filePath);
+ m_globalModuleItemCache.insert(cacheKey, module);
+ }
if (!isBaseModule) {
DependsContext dependsContext;
dependsContext.product = productContext;
diff --git a/src/lib/corelib/language/moduleloader.h b/src/lib/corelib/language/moduleloader.h
index 42e82046f..67bfa1e07 100644
--- a/src/lib/corelib/language/moduleloader.h
+++ b/src/lib/corelib/language/moduleloader.h
@@ -106,6 +106,8 @@ public:
static QString fullModuleName(const QStringList &moduleName);
private:
+ typedef QMap<QPair<QString, QString>, Item *> ModuleItemCache;
+
class ContextBase
{
public:
@@ -116,7 +118,6 @@ private:
Item *item;
Item *scope;
QStringList extraSearchPaths;
- typedef QMap<QPair<QString, QString>, Item *> ModuleItemCache;
ModuleItemCache moduleItemCache;
};
@@ -195,8 +196,6 @@ private:
static void overrideItemProperties(Item *item, const QString &buildConfigKey,
const QVariantMap &buildConfig);
-
-
ScriptEngine *m_engine;
ItemPool *m_pool;
Logger m_logger;
@@ -205,6 +204,7 @@ private:
Evaluator *m_evaluator;
QStringList m_moduleSearchPaths;
QMap<QString, QStringList> m_moduleDirListCache;
+ ModuleItemCache m_globalModuleItemCache;
QHash<Item *, QSet<QString> > m_validItemPropertyNamesPerItem;
QSet<Item *> m_disabledItems;
SetupProjectParameters m_parameters;