diff options
author | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2024-03-12 14:24:06 +0100 |
---|---|---|
committer | Marcus Tillmanns <marcus.tillmanns@qt.io> | 2024-03-12 14:24:05 +0000 |
commit | 4e8bdd610b5899c83b75cebeeafcf82b6bec79f8 (patch) | |
tree | 97fbec65ca420ad284e3496ef57748972a182d99 /src/plugins/cmakeprojectmanager | |
parent | 07399dfb0c4c294e51323b94cdfea85d6e1b029d (diff) |
Utils: Remove PresistentStoreCache
It turns out caching the information is unreliable due to a variety of reasons.
We remove the cache for now as its less dangerous than trying to fix each
use case.
Change-Id: I8238166486a2fb29c101f700af1c8d7e4ad7a172
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/cmakeprojectmanager')
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmakesettingspage.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmaketool.cpp | 30 | ||||
-rw-r--r-- | src/plugins/cmakeprojectmanager/cmaketool.h | 8 |
3 files changed, 12 insertions, 28 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp index 697af9c75f..7847777c6b 100644 --- a/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp +++ b/src/plugins/cmakeprojectmanager/cmakesettingspage.cpp @@ -115,7 +115,7 @@ public: CMakeTool cmake(m_autodetected ? CMakeTool::AutoDetection : CMakeTool::ManualDetection, m_id); cmake.setFilePath(m_executable); - m_isSupported = cmake.hasFileApi(true); + m_isSupported = cmake.hasFileApi(); m_tooltip = Tr::tr("Version: %1").arg(cmake.versionDisplay()); m_tooltip += "<br>" + Tr::tr("Supports fileApi: %1").arg(m_isSupported ? Tr::tr("yes") : Tr::tr("no")); diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index e90bc963a6..af6637ee9b 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -11,7 +11,6 @@ #include <utils/algorithm.h> #include <utils/environment.h> -#include <utils/persistentcachestore.h> #include <utils/process.h> #include <utils/qtcassert.h> #include <utils/temporarydirectory.h> @@ -155,13 +154,13 @@ FilePath CMakeTool::filePath() const return m_executable; } -bool CMakeTool::isValid(bool ignoreCache) const +bool CMakeTool::isValid() const { if (!m_id.isValid() || !m_introspection) return false; if (!m_introspection->m_didAttemptToRun) - readInformation(ignoreCache); + readInformation(); return m_introspection->m_haveCapabilitites && !m_introspection->m_fileApis.isEmpty(); } @@ -324,9 +323,9 @@ CMakeKeywords CMakeTool::keywords() return m_introspection->m_keywords; } -bool CMakeTool::hasFileApi(bool ignoreCache) const +bool CMakeTool::hasFileApi() const { - return isValid(ignoreCache) ? !m_introspection->m_fileApis.isEmpty() : false; + return isValid() ? !m_introspection->m_fileApis.isEmpty() : false; } CMakeTool::Version CMakeTool::version() const @@ -438,7 +437,7 @@ void CMakeTool::openCMakeHelpUrl(const CMakeTool *tool, const QString &linkUrl) Core::HelpManager::showHelpUrl(linkUrl.arg(documentationUrl(version, online))); } -void CMakeTool::readInformation(bool ignoreCache) const +void CMakeTool::readInformation() const { QTC_ASSERT(m_introspection, return ); if (!m_introspection->m_haveCapabilitites && m_introspection->m_didAttemptToRun) @@ -446,7 +445,7 @@ void CMakeTool::readInformation(bool ignoreCache) const m_introspection->m_didAttemptToRun = true; - fetchFromCapabilities(ignoreCache); + fetchFromCapabilities(); } @@ -625,17 +624,8 @@ QStringList CMakeTool::parseSyntaxHighlightingXml() return moduleFunctions; } -void CMakeTool::fetchFromCapabilities(bool ignoreCache) const +void CMakeTool::fetchFromCapabilities() const { - expected_str<Utils::Store> cache = PersistentCacheStore::byKey( - keyFromString("CMake_" + cmakeExecutable().toUserOutput())); - - if (cache && !ignoreCache) { - m_introspection->m_haveCapabilitites = true; - parseFromCapabilities(cache->value("CleanedStdOut").toString()); - return; - } - Process cmake; runCMake(cmake, {"-E", "capabilities"}); @@ -646,12 +636,6 @@ void CMakeTool::fetchFromCapabilities(bool ignoreCache) const qCCritical(cmakeToolLog) << "Fetching capabilities failed: " << cmake.allOutput() << cmake.error(); m_introspection->m_haveCapabilitites = false; } - - Store newData{{"CleanedStdOut", cmake.cleanedStdOut()}}; - const auto result - = PersistentCacheStore::write(keyFromString("CMake_" + cmakeExecutable().toUserOutput()), - newData); - QTC_ASSERT_EXPECTED(result, return); } static int getVersion(const QVariantMap &obj, const QString &value) diff --git a/src/plugins/cmakeprojectmanager/cmaketool.h b/src/plugins/cmakeprojectmanager/cmaketool.h index 0fa06e5ca1..cf13ad49c5 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.h +++ b/src/plugins/cmakeprojectmanager/cmaketool.h @@ -74,7 +74,7 @@ public: static Utils::Id createId(); - bool isValid(bool ignoreCache = false) const; + bool isValid() const; Utils::Id id() const { return m_id; } Utils::Store toMap () const; @@ -91,7 +91,7 @@ public: bool autoCreateBuildDirectory() const; QList<Generator> supportedGenerators() const; CMakeKeywords keywords(); - bool hasFileApi(bool ignoreCache = false) const; + bool hasFileApi() const; Version version() const; QString versionDisplay() const; @@ -113,14 +113,14 @@ public: static void openCMakeHelpUrl(const CMakeTool *tool, const QString &linkUrl); private: - void readInformation(bool ignoreCache = false) const; + void readInformation() const; void runCMake(Utils::Process &proc, const QStringList &args, int timeoutS = 1) const; void parseFunctionDetailsOutput(const QString &output); QStringList parseVariableOutput(const QString &output); QStringList parseSyntaxHighlightingXml(); - void fetchFromCapabilities(bool ignoreCache = false) const; + void fetchFromCapabilities() const; void parseFromCapabilities(const QString &input) const; // Note: New items here need also be handled in CMakeToolItemModel::apply() |