forked from qt-creator/qt-creator
Docker: validate clangd version
Do not automatically setup a clangd that is too old and mark them as invalid if they are manually selected. Change-Id: Ie9662a8821df8fc678eabc4b8a08375723b4d1c3 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "dockertr.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/clangutils.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
@@ -108,6 +109,10 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
||||
m_clangdExecutable->setHistoryCompleter("Docker.ClangdExecutable.History");
|
||||
m_clangdExecutable->setAllowPathFromDevice(true);
|
||||
m_clangdExecutable->setFilePath(m_data.clangdExecutable);
|
||||
m_clangdExecutable->setValidationFunction(
|
||||
[chooser = m_clangdExecutable](FancyLineEdit *, QString *error) {
|
||||
return Utils::checkClangdVersion(chooser->filePath(), error);
|
||||
});
|
||||
|
||||
connect(m_clangdExecutable, &PathChooser::rawPathChanged, this, [this, dockerDevice] {
|
||||
m_data.clangdExecutable = m_clangdExecutable->filePath();
|
||||
@@ -177,7 +182,10 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
||||
logView->clear();
|
||||
dockerDevice->updateContainerAccess();
|
||||
|
||||
const FilePath clangdPath = dockerDevice->rootPath().withNewPath("clangd").searchInPath();
|
||||
const FilePath clangdPath = dockerDevice->systemEnvironment()
|
||||
.searchInPath("clangd", {}, [](const FilePath &clangd) {
|
||||
return Utils::checkClangdVersion(clangd);
|
||||
});
|
||||
if (!clangdPath.isEmpty())
|
||||
m_clangdExecutable->setFilePath(clangdPath);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user