Docker: Add clangd executable option

Change-Id: I93fbd9a7a6b0189ca31cc05b35df9d1636da29a3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2022-12-02 13:30:29 +01:00
parent 79c2984222
commit 46eccf229c
4 changed files with 27 additions and 2 deletions

View File

@@ -682,6 +682,7 @@ const char DockerDeviceUseOutsideUser[] = "DockerDeviceUseUidGid";
const char DockerDeviceMappedPaths[] = "DockerDeviceMappedPaths"; const char DockerDeviceMappedPaths[] = "DockerDeviceMappedPaths";
const char DockerDeviceKeepEntryPoint[] = "DockerDeviceKeepEntryPoint"; const char DockerDeviceKeepEntryPoint[] = "DockerDeviceKeepEntryPoint";
const char DockerDeviceEnableLldbFlags[] = "DockerDeviceEnableLldbFlags"; const char DockerDeviceEnableLldbFlags[] = "DockerDeviceEnableLldbFlags";
const char DockerDeviceClangDExecutable[] = "DockerDeviceClangDExecutable";
void DockerDevice::fromMap(const QVariantMap &map) void DockerDevice::fromMap(const QVariantMap &map)
{ {
@@ -696,6 +697,7 @@ void DockerDevice::fromMap(const QVariantMap &map)
data.mounts = map.value(DockerDeviceMappedPaths).toStringList(); data.mounts = map.value(DockerDeviceMappedPaths).toStringList();
data.keepEntryPoint = map.value(DockerDeviceKeepEntryPoint).toBool(); data.keepEntryPoint = map.value(DockerDeviceKeepEntryPoint).toBool();
data.enableLldbFlags = map.value(DockerDeviceEnableLldbFlags).toBool(); data.enableLldbFlags = map.value(DockerDeviceEnableLldbFlags).toBool();
data.clangdExecutable = FilePath::fromUrl(map.value(DockerDeviceClangDExecutable).toUrl());
d->setData(data); d->setData(data);
} }
@@ -712,6 +714,7 @@ QVariantMap DockerDevice::toMap() const
map.insert(DockerDeviceMappedPaths, data.mounts); map.insert(DockerDeviceMappedPaths, data.mounts);
map.insert(DockerDeviceKeepEntryPoint, data.keepEntryPoint); map.insert(DockerDeviceKeepEntryPoint, data.keepEntryPoint);
map.insert(DockerDeviceEnableLldbFlags, data.enableLldbFlags); map.insert(DockerDeviceEnableLldbFlags, data.enableLldbFlags);
map.insert(DockerDeviceClangDExecutable, data.clangdExecutable.toUrl());
return map; return map;
} }

View File

@@ -21,8 +21,8 @@ public:
{ {
return imageId == other.imageId && repo == other.repo && tag == other.tag return imageId == other.imageId && repo == other.repo && tag == other.tag
&& useLocalUidGid == other.useLocalUidGid && mounts == other.mounts && useLocalUidGid == other.useLocalUidGid && mounts == other.mounts
&& keepEntryPoint == other.keepEntryPoint && keepEntryPoint == other.keepEntryPoint && enableLldbFlags == other.enableLldbFlags
&& enableLldbFlags == other.enableLldbFlags; && clangdExecutable == other.clangdExecutable;
} }
bool operator!=(const DockerDeviceData &other) const { return !(*this == other); } bool operator!=(const DockerDeviceData &other) const { return !(*this == other); }
@@ -49,6 +49,7 @@ public:
QStringList mounts = {Core::DocumentManager::projectsDirectory().toString()}; QStringList mounts = {Core::DocumentManager::projectsDirectory().toString()};
bool keepEntryPoint = false; bool keepEntryPoint = false;
bool enableLldbFlags = false; bool enableLldbFlags = false;
Utils::FilePath clangdExecutable;
}; };
class DockerDevice : public ProjectExplorer::IDevice class DockerDevice : public ProjectExplorer::IDevice

View File

@@ -11,6 +11,7 @@
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h> #include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
@@ -100,6 +101,19 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
dockerDevice->setData(m_data); dockerDevice->setData(m_data);
}); });
auto clangDLabel = new QLabel(Tr::tr("Clangd Executable:"));
m_clangdExecutable = new PathChooser();
m_clangdExecutable->setExpectedKind(PathChooser::ExistingCommand);
m_clangdExecutable->setHistoryCompleter("Docker.ClangdExecutable.History");
m_clangdExecutable->setAllowPathFromDevice(true);
m_clangdExecutable->setFilePath(m_data.clangdExecutable);
connect(m_clangdExecutable, &PathChooser::rawPathChanged, this, [this, dockerDevice]() {
m_data.clangdExecutable = m_clangdExecutable->filePath();
dockerDevice->setData(m_data);
});
auto pathListLabel = new InfoLabel(Tr::tr("Paths to mount:")); auto pathListLabel = new InfoLabel(Tr::tr("Paths to mount:"));
pathListLabel->setAdditionalToolTip(Tr::tr("Source directory list should not be empty.")); pathListLabel->setAdditionalToolTip(Tr::tr("Source directory list should not be empty."));
@@ -163,6 +177,10 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
logView->clear(); logView->clear();
dockerDevice->updateContainerAccess(); dockerDevice->updateContainerAccess();
const FilePath clangdPath = dockerDevice->rootPath().withNewPath("clangd").searchInPath();
if (!clangdPath.isEmpty())
m_clangdExecutable->setFilePath(clangdPath);
m_kitItemDetector.autoDetect(dockerDevice->id().toString(), searchPaths()); m_kitItemDetector.autoDetect(dockerDevice->id().toString(), searchPaths());
if (DockerApi::instance()->dockerDaemonAvailable().value_or(false) == false) if (DockerApi::instance()->dockerDaemonAvailable().value_or(false) == false)
@@ -193,6 +211,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
m_runAsOutsideUser, br, m_runAsOutsideUser, br,
m_keepEntryPoint, br, m_keepEntryPoint, br,
m_enableLldbFlags, br, m_enableLldbFlags, br,
clangDLabel, m_clangdExecutable, br,
Column { Column {
pathListLabel, pathListLabel,
m_pathsListEdit, m_pathsListEdit,

View File

@@ -10,6 +10,7 @@
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/idevicewidget.h> #include <projectexplorer/devicesupport/idevicewidget.h>
#include <utils/pathchooser.h>
#include <utils/pathlisteditor.h> #include <utils/pathlisteditor.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@@ -38,6 +39,7 @@ private:
QCheckBox *m_runAsOutsideUser; QCheckBox *m_runAsOutsideUser;
QCheckBox *m_keepEntryPoint; QCheckBox *m_keepEntryPoint;
QCheckBox *m_enableLldbFlags; QCheckBox *m_enableLldbFlags;
Utils::PathChooser *m_clangdExecutable;
Utils::PathListEditor *m_pathsListEdit; Utils::PathListEditor *m_pathsListEdit;
KitDetector m_kitItemDetector; KitDetector m_kitItemDetector;