ProjectExplorer: Allow selection of remote build directories

Change-Id: Ieaf0b01bde6d043782d6d9d4bb745c090c6087c1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Marcus Tillmanns
2022-10-14 09:50:53 +02:00
parent f42282b492
commit 604f542b20
2 changed files with 28 additions and 1 deletions

View File

@@ -540,6 +540,9 @@ bool isValidMountInfo(const DockerDevicePrivate::TemporaryMountInfo &mi)
if (!mi.path.isAbsolutePath() || !mi.containerPath.isAbsolutePath()) if (!mi.path.isAbsolutePath() || !mi.containerPath.isAbsolutePath())
return false; return false;
if (mi.containerPath.isRootPath())
return false;
if (!mi.path.exists()) if (!mi.path.exists())
return false; return false;

View File

@@ -5,7 +5,11 @@
#include "buildconfiguration.h" #include "buildconfiguration.h"
#include "buildpropertiessettings.h" #include "buildpropertiessettings.h"
#include "devicesupport/idevice.h"
#include "kitinformation.h"
#include "projectexplorerconstants.h"
#include "projectexplorer.h" #include "projectexplorer.h"
#include "target.h"
#include <coreplugin/fileutils.h> #include <coreplugin/fileutils.h>
@@ -24,13 +28,17 @@ namespace ProjectExplorer {
class BuildDirectoryAspect::Private class BuildDirectoryAspect::Private
{ {
public: public:
Private(Target *target) : target(target) {}
FilePath sourceDir; FilePath sourceDir;
Target * const target;
FilePath savedShadowBuildDir; FilePath savedShadowBuildDir;
QString problem; QString problem;
QPointer<InfoLabel> problemLabel; QPointer<InfoLabel> problemLabel;
}; };
BuildDirectoryAspect::BuildDirectoryAspect(const BuildConfiguration *bc) : d(new Private) BuildDirectoryAspect::BuildDirectoryAspect(const BuildConfiguration *bc)
: d(new Private(bc->target()))
{ {
setSettingsKey("ProjectExplorer.BuildConfiguration.BuildDirectory"); setSettingsKey("ProjectExplorer.BuildConfiguration.BuildDirectory");
setLabelText(tr("Build directory:")); setLabelText(tr("Build directory:"));
@@ -40,6 +48,16 @@ BuildDirectoryAspect::BuildDirectoryAspect(const BuildConfiguration *bc) : d(new
const FilePath fixedDir = fixupDir(FilePath::fromUserInput(edit->text())); const FilePath fixedDir = fixupDir(FilePath::fromUserInput(edit->text()));
if (!fixedDir.isEmpty()) if (!fixedDir.isEmpty())
edit->setText(fixedDir.toUserOutput()); edit->setText(fixedDir.toUserOutput());
const FilePath newPath = FilePath::fromUserInput(edit->text());
const auto buildDevice = DeviceKitAspect::device(d->target->kit());
if (buildDevice && buildDevice->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
&& !buildDevice->rootPath().ensureReachable(newPath)) {
*error = tr("The build directory is not reachable from the build device.");
return false;
}
return pathChooser() ? pathChooser()->defaultValidationFunction()(edit, error) : true; return pathChooser() ? pathChooser()->defaultValidationFunction()(edit, error) : true;
}); });
setOpenTerminalHandler([this, bc] { setOpenTerminalHandler([this, bc] {
@@ -109,6 +127,12 @@ void BuildDirectoryAspect::addToLayout(LayoutBuilder &builder)
} }
}); });
} }
const auto buildDevice = DeviceKitAspect::device(d->target->kit());
if (buildDevice && buildDevice->type() != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
pathChooser()->setAllowPathFromDevice(true);
else
pathChooser()->setAllowPathFromDevice(false);
} }
FilePath BuildDirectoryAspect::fixupDir(const FilePath &dir) FilePath BuildDirectoryAspect::fixupDir(const FilePath &dir)