diff options
-rw-r--r-- | src/lib/corelib/buildgraph/buildgraph.pri | 1 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/inputartifactscanner.cpp | 6 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/qtmocscanner.cpp | 4 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/rawscanneddependency.h | 79 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/scanresultcache.cpp | 8 | ||||
-rw-r--r-- | src/lib/corelib/buildgraph/scanresultcache.h | 21 | ||||
-rw-r--r-- | src/lib/corelib/corelib.qbs | 3 |
7 files changed, 90 insertions, 32 deletions
diff --git a/src/lib/corelib/buildgraph/buildgraph.pri b/src/lib/corelib/buildgraph/buildgraph.pri index 0b504deb1..5ce4081d7 100644 --- a/src/lib/corelib/buildgraph/buildgraph.pri +++ b/src/lib/corelib/buildgraph/buildgraph.pri @@ -59,6 +59,7 @@ HEADERS += \ $$PWD/productinstaller.h \ $$PWD/projectbuilddata.h \ $$PWD/qtmocscanner.h \ + $$PWD/rawscanneddependency.h \ $$PWD/rescuableartifactdata.h \ $$PWD/rulegraph.h \ $$PWD/rulenode.h \ diff --git a/src/lib/corelib/buildgraph/inputartifactscanner.cpp b/src/lib/corelib/buildgraph/inputartifactscanner.cpp index b39e09010..056c67fc5 100644 --- a/src/lib/corelib/buildgraph/inputartifactscanner.cpp +++ b/src/lib/corelib/buildgraph/inputartifactscanner.cpp @@ -69,7 +69,7 @@ InputArtifactScannerContext::~InputArtifactScannerContext() { } -static void resolveDepencency(const ScanResultCache::Dependency &dependency, +static void resolveDepencency(const RawScannedDependency &dependency, const ResolvedProduct *product, ResolvedDependency *result, const QString &baseDir = QString()) { @@ -254,7 +254,7 @@ void InputArtifactScanner::resolveScanResultDependencies(const Artifact *inputAr const ScanResultCache::Result &scanResult, QList<FileResourceBase *> *artifactsToScan, InputArtifactScannerContext::ScannerResolvedDependenciesCache &cache) { - foreach (const ScanResultCache::Dependency &dependency, scanResult.deps) { + foreach (const RawScannedDependency &dependency, scanResult.deps) { const QString &dependencyFilePath = dependency.filePath(); InputArtifactScannerContext::ResolvedDependencyCacheItem &cachedResolvedDependencyItem = cache.resolvedDependenciesCache[dependency.dirPath()][dependency.fileName()]; @@ -363,7 +363,7 @@ void InputArtifactScanner::scanWithScannerPlugin(DependencyScanner *scanner, const QStringList &dependencies = scanner->collectDependencies(fileToBeScanned, m_fileTagsForScanner.constData()); for (const QString &s : dependencies) - scanResult->deps += ScanResultCache::Dependency(s); + scanResult->deps += RawScannedDependency(s); scanResult->valid = true; } diff --git a/src/lib/corelib/buildgraph/qtmocscanner.cpp b/src/lib/corelib/buildgraph/qtmocscanner.cpp index ba713ca0b..00d570489 100644 --- a/src/lib/corelib/buildgraph/qtmocscanner.cpp +++ b/src/lib/corelib/buildgraph/qtmocscanner.cpp @@ -122,7 +122,7 @@ static ScanResultCache::Result runScanner(ScannerPlugin *scanner, const Artifact if (FileInfo::exists(localFilePath)) includedFilePath = localFilePath; } - scanResult.deps += ScanResultCache::Dependency(includedFilePath); + scanResult.deps += RawScannedDependency(includedFilePath); } scanner->close(opaq); @@ -146,7 +146,7 @@ void QtMocScanner::findIncludedMocCppFiles() const ScanResultCache::Result scanResult = runScanner(scannerPluginForFileTags(artifact->fileTags()), artifact, m_scanResultCache); - foreach (const ScanResultCache::Dependency &dependency, scanResult.deps) { + foreach (const RawScannedDependency &dependency, scanResult.deps) { QString includedFileName = dependency.fileName(); if (includedFileName.startsWith(QLatin1String("moc_")) && includedFileName.endsWith(QLatin1String(".cpp"))) { diff --git a/src/lib/corelib/buildgraph/rawscanneddependency.h b/src/lib/corelib/buildgraph/rawscanneddependency.h new file mode 100644 index 000000000..af236599e --- /dev/null +++ b/src/lib/corelib/buildgraph/rawscanneddependency.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QBS_RAWSCANNEDDEPENDENCY_H +#define QBS_RAWSCANNEDDEPENDENCY_H + +#include <tools/fileinfo.h> + +#include <QString> + +namespace qbs { +namespace Internal { + +class RawScannedDependency +{ +public: + RawScannedDependency() : m_isClean(true) {} + + RawScannedDependency(const QString &filePath) + { + FileInfo::splitIntoDirectoryAndFileName(filePath, &m_dirPath, &m_fileName); + + m_isClean = !m_dirPath.contains(QLatin1Char('.')) + && !m_dirPath.contains(QLatin1String("//")); + } + + QString filePath() const { + return m_dirPath.isEmpty() ? m_fileName : m_dirPath + QLatin1Char('/') + m_fileName; + } + const QString &dirPath() const { return m_dirPath; } + const QString &fileName() const { return m_fileName; } + bool isClean() const { return m_isClean; } + +private: + QString m_dirPath; + QString m_fileName; + bool m_isClean; +}; + +} // namespace Internal +} // namespace qbs + +#endif // Include guard diff --git a/src/lib/corelib/buildgraph/scanresultcache.cpp b/src/lib/corelib/buildgraph/scanresultcache.cpp index 9e1b3ccf8..2c0814aef 100644 --- a/src/lib/corelib/buildgraph/scanresultcache.cpp +++ b/src/lib/corelib/buildgraph/scanresultcache.cpp @@ -43,14 +43,6 @@ namespace qbs { namespace Internal { -ScanResultCache::Dependency::Dependency(const QString &filePath) -{ - FileInfo::splitIntoDirectoryAndFileName(filePath, &m_dirPath, &m_fileName); - - m_isClean = !m_dirPath.contains(QLatin1Char('.')) - && !m_dirPath.contains(QLatin1String("//")); -} - ScanResultCache::Result ScanResultCache::value(const void *scanner, const QString &fileName) const { return m_data[scanner][fileName]; diff --git a/src/lib/corelib/buildgraph/scanresultcache.h b/src/lib/corelib/buildgraph/scanresultcache.h index 82a326933..4a60d2bee 100644 --- a/src/lib/corelib/buildgraph/scanresultcache.h +++ b/src/lib/corelib/buildgraph/scanresultcache.h @@ -40,6 +40,8 @@ #ifndef QBS_SCANRESULTCACHE_H #define QBS_SCANRESULTCACHE_H +#include "rawscanneddependency.h" + #include <language/filetags.h> #include <QtCore/qhash.h> @@ -52,23 +54,6 @@ namespace Internal { class ScanResultCache { public: - class Dependency - { - public: - Dependency() : m_isClean(true) {} - Dependency(const QString &filePath); - - QString filePath() const { return m_dirPath.isEmpty() ? m_fileName : m_dirPath + QLatin1Char('/') + m_fileName; } - const QString &dirPath() const { return m_dirPath; } - const QString &fileName() const { return m_fileName; } - bool isClean() const { return m_isClean; } - - private: - QString m_dirPath; - QString m_fileName; - bool m_isClean; - }; - class Result { public: @@ -76,7 +61,7 @@ public: : valid(false) {} - QVector<Dependency> deps; + QVector<RawScannedDependency> deps; FileTags additionalFileTags; bool valid; }; diff --git a/src/lib/corelib/corelib.qbs b/src/lib/corelib/corelib.qbs index f7914095d..3d3cade35 100644 --- a/src/lib/corelib/corelib.qbs +++ b/src/lib/corelib/corelib.qbs @@ -137,6 +137,7 @@ QbsLibrary { "projectbuilddata.h", "qtmocscanner.cpp", "qtmocscanner.h", + "rawscanneddependency.h", "rescuableartifactdata.cpp", "rescuableartifactdata.h", "rulegraph.cpp", @@ -152,7 +153,7 @@ QbsLibrary { "timestampsupdater.cpp", "timestampsupdater.h", "transformer.cpp", - "transformer.h" + "transformer.h", ] } Group { |