forked from qt-creator/qt-creator
ProjectExplorer: Make target device for executable aspect explicit
Just run and host is not enough, build device is needed, too. This fixes the MakeInstall step for remote linux. Change-Id: I3ec797379b7d0d5842780d505d8b87a91286e460 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -48,7 +48,7 @@ public:
|
||||
explicit BareMetalRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
const auto exeAspect = addAspect<ExecutableAspect>(target);
|
||||
const auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
exeAspect->setDisplayStyle(StringAspect::LabelDisplay);
|
||||
exeAspect->setPlaceHolderText(tr("Unknown"));
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
explicit BareMetalCustomRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
const auto exeAspect = addAspect<ExecutableAspect>(target);
|
||||
const auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
exeAspect->setSettingsKey("BareMetal.CustomRunConfig.Executable");
|
||||
exeAspect->setPlaceHolderText(tr("Unknown"));
|
||||
exeAspect->setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
|
@@ -87,7 +87,7 @@ private:
|
||||
QdbRunConfiguration::QdbRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target);
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
exeAspect->setSettingsKey("QdbRunConfig.RemoteExecutable");
|
||||
exeAspect->setLabelText(tr("Executable on device:"));
|
||||
exeAspect->setPlaceHolderText(tr("Remote path not set"));
|
||||
|
@@ -80,7 +80,7 @@ static IosDeviceType toIosDeviceType(const SimulatorInfo &device)
|
||||
IosRunConfiguration::IosRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto executableAspect = addAspect<ExecutableAspect>(target);
|
||||
auto executableAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
executableAspect->setDisplayStyle(StringAspect::LabelDisplay);
|
||||
|
||||
addAspect<ArgumentsAspect>(macroExpander());
|
||||
|
@@ -36,31 +36,29 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace MesonProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
MesonRunConfiguration::MesonRunConfiguration(ProjectExplorer::Target *target, Utils::Id id)
|
||||
: ProjectExplorer::RunConfiguration{target, id}
|
||||
MesonRunConfiguration::MesonRunConfiguration(Target *target, Utils::Id id)
|
||||
: RunConfiguration{target, id}
|
||||
{
|
||||
auto envAspect = addAspect<ProjectExplorer::LocalEnvironmentAspect>(target);
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
|
||||
addAspect<ProjectExplorer::ExecutableAspect>(target);
|
||||
addAspect<ProjectExplorer::ArgumentsAspect>(macroExpander());
|
||||
addAspect<ProjectExplorer::WorkingDirectoryAspect>(macroExpander(), envAspect);
|
||||
addAspect<ProjectExplorer::TerminalAspect>();
|
||||
addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
addAspect<ArgumentsAspect>(macroExpander());
|
||||
addAspect<WorkingDirectoryAspect>(macroExpander(), envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
auto libAspect = addAspect<ProjectExplorer::UseLibraryPathsAspect>();
|
||||
connect(libAspect,
|
||||
&ProjectExplorer::UseLibraryPathsAspect::changed,
|
||||
envAspect,
|
||||
&ProjectExplorer::EnvironmentAspect::environmentChanged);
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
if (Utils::HostOsInfo::isMacHost()) {
|
||||
auto dyldAspect = addAspect<ProjectExplorer::UseDyldSuffixAspect>();
|
||||
connect(dyldAspect,
|
||||
&ProjectExplorer::UseLibraryPathsAspect::changed,
|
||||
envAspect,
|
||||
&ProjectExplorer::EnvironmentAspect::environmentChanged);
|
||||
auto dyldAspect = addAspect<UseDyldSuffixAspect>();
|
||||
connect(dyldAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
envAspect->addModifier([dyldAspect](Utils::Environment &env) {
|
||||
if (dyldAspect->value())
|
||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
||||
@@ -68,17 +66,14 @@ MesonRunConfiguration::MesonRunConfiguration(ProjectExplorer::Target *target, Ut
|
||||
}
|
||||
|
||||
envAspect->addModifier([this, libAspect](Utils::Environment &env) {
|
||||
ProjectExplorer::BuildTargetInfo bti = buildTargetInfo();
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, libAspect->value());
|
||||
});
|
||||
|
||||
setUpdater([this] { updateTargetInformation(); });
|
||||
|
||||
connect(target,
|
||||
&ProjectExplorer::Target::buildSystemUpdated,
|
||||
this,
|
||||
&ProjectExplorer::RunConfiguration::update);
|
||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||
}
|
||||
|
||||
void MesonRunConfiguration::updateTargetInformation()
|
||||
@@ -86,13 +81,11 @@ void MesonRunConfiguration::updateTargetInformation()
|
||||
if (!activeBuildSystem())
|
||||
return;
|
||||
|
||||
ProjectExplorer::BuildTargetInfo bti = buildTargetInfo();
|
||||
auto terminalAspect = aspect<ProjectExplorer::TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
aspect<ProjectExplorer::ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||
aspect<ProjectExplorer::WorkingDirectoryAspect>()->setDefaultWorkingDirectory(
|
||||
bti.workingDirectory);
|
||||
emit aspect<ProjectExplorer::LocalEnvironmentAspect>()->environmentChanged();
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
aspect<TerminalAspect>()->setUseTerminalHint(bti.usesTerminal);
|
||||
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||
aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
|
||||
emit aspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
}
|
||||
|
||||
MesonRunConfigurationFactory::MesonRunConfigurationFactory()
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
addAspect<ExecutableAspect>(target);
|
||||
addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
addAspect<ArgumentsAspect>(macroExpander());
|
||||
addAspect<WorkingDirectoryAspect>(macroExpander(), envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
@@ -89,7 +89,8 @@ public:
|
||||
NimbleTestConfiguration(ProjectExplorer::Target *target, Utils::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
addAspect<ExecutableAspect>(target)->setExecutable(Nim::nimblePathFromKit(target->kit()));
|
||||
addAspect<ExecutableAspect>(target, ExecutableAspect::BuildDevice)
|
||||
->setExecutable(Nim::nimblePathFromKit(target->kit()));
|
||||
addAspect<ArgumentsAspect>(macroExpander())->setArguments("test");
|
||||
addAspect<WorkingDirectoryAspect>(macroExpander(), nullptr)
|
||||
->setDefaultWorkingDirectory(project()->projectDirectory());
|
||||
|
@@ -50,7 +50,7 @@ public:
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
addAspect<ExecutableAspect>(target);
|
||||
addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
addAspect<ArgumentsAspect>(macroExpander());
|
||||
addAspect<WorkingDirectoryAspect>(macroExpander(), envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
@@ -45,7 +45,7 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Target *targe
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
|
||||
auto exeAspect = addAspect<ExecutableAspect>(nullptr); // nullptr - to enforce host-only operation.
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::HostDevice);
|
||||
exeAspect->setSettingsKey("ProjectExplorer.CustomExecutableRunConfiguration.Executable");
|
||||
exeAspect->setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
exeAspect->setHistoryCompleter("Qt.CustomExecutable.History");
|
||||
|
@@ -68,7 +68,7 @@ DesktopRunConfiguration::DesktopRunConfiguration(Target *target, Id id, Kind kin
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
|
||||
addAspect<ExecutableAspect>(target);
|
||||
addAspect<ExecutableAspect>(target, ExecutableAspect::HostDevice);
|
||||
addAspect<ArgumentsAspect>(macroExpander());
|
||||
addAspect<WorkingDirectoryAspect>(macroExpander(), envAspect);
|
||||
addAspect<TerminalAspect>();
|
||||
|
@@ -25,13 +25,12 @@
|
||||
|
||||
#include "runconfigurationaspects.h"
|
||||
|
||||
#include "devicesupport/devicemanager.h"
|
||||
#include "devicesupport/idevice.h"
|
||||
#include "environmentaspect.h"
|
||||
#include "kitinformation.h"
|
||||
#include "project.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorersettings.h"
|
||||
#include "runconfiguration.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -514,8 +513,8 @@ void ArgumentsAspect::addToLayout(LayoutBuilder &builder)
|
||||
by the build system's parsing results with an optional manual override.
|
||||
*/
|
||||
|
||||
ExecutableAspect::ExecutableAspect(Target *target)
|
||||
: m_target(target)
|
||||
ExecutableAspect::ExecutableAspect(Target *target, ExecutionDeviceSelector selector)
|
||||
: m_target(target), m_selector(selector)
|
||||
{
|
||||
setDisplayName(tr("Executable"));
|
||||
setId("ExecutableAspect");
|
||||
@@ -534,9 +533,16 @@ ExecutableAspect::ExecutableAspect(Target *target)
|
||||
\internal
|
||||
*/
|
||||
|
||||
static IDevice::ConstPtr deviceForTarget(Target *target)
|
||||
static IDevice::ConstPtr executionDevice(Target *target,
|
||||
ExecutableAspect::ExecutionDeviceSelector selector)
|
||||
{
|
||||
return target ? DeviceKitAspect::device(target->kit()) : IDevice::ConstPtr();
|
||||
if (target) {
|
||||
if (selector == ExecutableAspect::RunDevice)
|
||||
return DeviceKitAspect::device(target->kit());
|
||||
if (selector == ExecutableAspect::BuildDevice)
|
||||
return BuildDeviceKitAspect::device(target->kit());
|
||||
}
|
||||
return DeviceManager::defaultDesktopDevice();
|
||||
}
|
||||
|
||||
ExecutableAspect::~ExecutableAspect()
|
||||
@@ -547,7 +553,7 @@ ExecutableAspect::~ExecutableAspect()
|
||||
|
||||
void ExecutableAspect::updateDevice()
|
||||
{
|
||||
const IDevice::ConstPtr dev = deviceForTarget(m_target);
|
||||
const IDevice::ConstPtr dev = executionDevice(m_target, m_selector);
|
||||
const OsType osType = dev ? dev->osType() : HostOsInfo::hostOs();
|
||||
|
||||
m_executable.setDisplayFilter([osType](const QString &pathName) {
|
||||
@@ -638,7 +644,7 @@ FilePath ExecutableAspect::executable() const
|
||||
? m_alternativeExecutable->filePath()
|
||||
: m_executable.filePath();
|
||||
|
||||
if (const IDevice::ConstPtr dev = deviceForTarget(m_target))
|
||||
if (const IDevice::ConstPtr dev = executionDevice(m_target, m_selector))
|
||||
exe = dev->filePath(exe.path());
|
||||
|
||||
return exe;
|
||||
|
@@ -175,7 +175,9 @@ class PROJECTEXPLORER_EXPORT ExecutableAspect : public Utils::BaseAspect
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExecutableAspect(Target *target); // Uses device from target if non-null.
|
||||
enum ExecutionDeviceSelector { HostDevice, BuildDevice, RunDevice };
|
||||
|
||||
explicit ExecutableAspect(Target *target, ExecutionDeviceSelector selector);
|
||||
~ExecutableAspect() override;
|
||||
|
||||
Utils::FilePath executable() const;
|
||||
@@ -207,6 +209,7 @@ private:
|
||||
Utils::StringAspect m_executable;
|
||||
Utils::StringAspect *m_alternativeExecutable = nullptr;
|
||||
Target *m_target = nullptr;
|
||||
ExecutionDeviceSelector m_selector = RunDevice;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT SymbolFileAspect : public Utils::StringAspect
|
||||
|
@@ -47,7 +47,7 @@ namespace Internal {
|
||||
QnxRunConfiguration::QnxRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target);
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
exeAspect->setLabelText(tr("Executable on device:"));
|
||||
exeAspect->setPlaceHolderText(tr("Remote path not set"));
|
||||
exeAspect->makeOverridable("RemoteLinux.RunConfig.AlternateRemoteExecutable",
|
||||
|
@@ -67,7 +67,8 @@ MakeInstallStep::MakeInstallStep(BuildStepList *parent, Id id) : MakeStep(parent
|
||||
jobCountAspect()->setVisible(false);
|
||||
disabledForSubdirsAspect()->setVisible(false);
|
||||
|
||||
const auto makeAspect = addAspect<ExecutableAspect>(parent->target());
|
||||
const auto makeAspect = addAspect<ExecutableAspect>(parent->target(),
|
||||
ExecutableAspect::BuildDevice);
|
||||
makeAspect->setId(MakeAspectId);
|
||||
makeAspect->setSettingsKey(MakeAspectId);
|
||||
makeAspect->setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||
|
@@ -59,7 +59,7 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar
|
||||
{
|
||||
auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target);
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
exeAspect->setSettingsKey("RemoteLinux.CustomRunConfig.RemoteExecutable");
|
||||
exeAspect->setLabelText(tr("Remote executable:"));
|
||||
exeAspect->setDisplayStyle(StringAspect::LineEditDisplay);
|
||||
|
@@ -59,7 +59,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id)
|
||||
{
|
||||
auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>(target);
|
||||
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target);
|
||||
auto exeAspect = addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
||||
exeAspect->setLabelText(tr("Executable on device:"));
|
||||
exeAspect->setPlaceHolderText(tr("Remote path not set"));
|
||||
exeAspect->makeOverridable("RemoteLinux.RunConfig.AlternateRemoteExecutable",
|
||||
|
Reference in New Issue
Block a user