forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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"));
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user