diff options
-rw-r--r-- | src/lib/buildgraph/inputartifactscanner.cpp | 44 | ||||
-rw-r--r-- | src/lib/buildgraph/inputartifactscanner.h | 2 |
2 files changed, 28 insertions, 18 deletions
diff --git a/src/lib/buildgraph/inputartifactscanner.cpp b/src/lib/buildgraph/inputartifactscanner.cpp index 670dbd74f..bbe3f778a 100644 --- a/src/lib/buildgraph/inputartifactscanner.cpp +++ b/src/lib/buildgraph/inputartifactscanner.cpp @@ -165,27 +165,37 @@ void InputArtifactScanner::scan() for (; it != m_artifact->transformer->inputs.end(); ++it) { Artifact *inputArtifact = *it; QStringList includePaths; - bool includePathsCollected = false; - - InputArtifactScannerContext::CacheItem &cacheItem = m_context->cache[inputArtifact->properties]; + bool mustCollectIncludePaths = false; + QSet<ScannerPlugin *> scanners; foreach (const QString &fileTag, inputArtifact->fileTags) { - QList<ScannerPlugin *> scanners = ScannerPluginManager::scannersForFileTag(fileTag); - foreach (ScannerPlugin *scanner, scanners) { - if (scanner->usesCppIncludePaths && !includePathsCollected) { - if (cacheItem.valid) { - //qDebug() << "CACHE HIT"; - includePaths = cacheItem.includePaths; - } else { - //qDebug() << "CACHE MISS"; - includePaths = collectIncludePaths(inputArtifact->properties->value().value("modules").toMap()); - cacheItem.includePaths = includePaths; - cacheItem.valid = true; - } - } - scanForFileDependencies(scanner, includePaths, inputArtifact, cacheItem.resolvedDependenciesCache); + foreach (ScannerPlugin *scanner, ScannerPluginManager::scannersForFileTag(fileTag)) { + scanners += scanner; + if (scanner->usesCppIncludePaths) + mustCollectIncludePaths = true; + } + } + + InputArtifactScannerContext::CacheItem &cacheItem = m_context->cache[inputArtifact->properties]; + if (mustCollectIncludePaths) { + if (cacheItem.valid) { + //qDebug() << "CACHE HIT"; + includePaths = cacheItem.includePaths; + } else { + //qDebug() << "CACHE MISS"; + includePaths = collectIncludePaths(inputArtifact->properties->value().value("modules").toMap()); + cacheItem.includePaths = includePaths; + cacheItem.valid = true; } } + + const QStringList emptyIncludePaths; + foreach (ScannerPlugin *scanner, scanners) { + scanForFileDependencies(scanner, + scanner->usesCppIncludePaths ? includePaths : emptyIncludePaths, + inputArtifact, + cacheItem.resolvedDependenciesCache[scanner]); + } } } diff --git a/src/lib/buildgraph/inputartifactscanner.h b/src/lib/buildgraph/inputartifactscanner.h index f6d0faefa..ddc132c41 100644 --- a/src/lib/buildgraph/inputartifactscanner.h +++ b/src/lib/buildgraph/inputartifactscanner.h @@ -85,7 +85,7 @@ private: bool valid; QStringList includePaths; - ResolvedDependenciesCache resolvedDependenciesCache; + QHash<ScannerPlugin *, ResolvedDependenciesCache> resolvedDependenciesCache; }; QHash<PropertyMapConstPtr, CacheItem> cache; |