Commit 0f9827e4 authored by Christian Kandeler's avatar Christian Kandeler

Device support: Provide SSH connection parameters in internal variables.

Example use case: User is developing for embedded Linux system without
an SFTP server. Now deployment can be done via a custom process step
using scp without the need to duplicate all the connection data.

Change-Id: Ib1f71080d106864e5f5345fd36f7cc226a515916
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent fe13d339
......@@ -76,20 +76,28 @@
\li In the \gui {The device's host name or IP address} field,
enter the host name or IP address of the device.
This value will be available in the variable \c %{CurrentDevice:HostAddress}.
\li In the \gui {The user name to log into the device} field,
enter the user name to log into the device and run the
application as.
This value will be available in the variable \c %{CurrentDevice:UserName}.
\li In the \gui {The authentication type} field, select whether
to use \gui Password or \gui Key authentication, and enter
the user's password or the file that contains the user's
private key.
The latter will be available in the variable \c %{CurrentDevice:PrivateKeyFile}.
\li Click \gui {Next} to create the connection.
\endlist
All of these parameters can be edited later, as well as additional ones that the
wizard does not show because there are sensible default values. One of these is
the SSH port number, which is available in the variable \c %{CurrentDevice:SshPort}.
\li Select \gui Tools > \gui Options > \gui {Build & Run} > \gui Kits
> \gui Add to add a kit for building for the device. Select the
Qt version, compiler, and device that you added above, and choose
......
......@@ -1011,6 +1011,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_FILESYSTEMNAME,
tr("The currently active kit's name in a filesystem friendly version."));
VariableManager::registerVariable(Constants::VAR_CURRENTKIT_ID, tr("The currently active kit's id."));
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_HOSTADDRESS,
tr("The host address of the device in the currently active kit."));
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_SSHPORT,
tr("The SSH port of the device in the currently active kit."));
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_USERNAME,
tr("The user name with which to log into the device in the currently active kit."));
VariableManager::registerVariable(Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE,
tr("The private key file with which to authenticate when logging into the device "
"in the currently active kit."));
VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_NAME, tr("The currently active build configuration's name."));
VariableManager::registerVariable(Constants::VAR_CURRENTBUILD_TYPE, tr("The currently active build configuration's type."));
VariableManager::registerFileVariables(Constants::VAR_CURRENTSESSION_PREFIX, tr("File where current session is saved."));
......
......@@ -245,6 +245,10 @@ const char VAR_CURRENTBUILD_NAME[] = "CurrentBuild:Name";
const char VAR_CURRENTBUILD_TYPE[] = "CurrentBuild:Type";
const char VAR_CURRENTSESSION_PREFIX[] = "CurrentSession";
const char VAR_CURRENTSESSION_NAME[] = "CurrentSession:Name";
const char VAR_CURRENTDEVICE_HOSTADDRESS[] = "CurrentDevice:HostAddress";
const char VAR_CURRENTDEVICE_SSHPORT[] = "CurrentDevice:SshPort";
const char VAR_CURRENTDEVICE_USERNAME[] = "CurrentDevice:UserName";
const char VAR_CURRENTDEVICE_PRIVATEKEYFILE[] = "CurrentDevice:PrivateKeyFile";
const char HIDE_FILE_FILTER_SETTING[] = "GenericProject/FileFilter";
const char HIDE_FILE_FILTER_DEFAULT[] = "Makefile*; *.o; *.obj; *~; *.files; *.config; *.creator; *.user; *.includes; *.autosave";
......
......@@ -29,9 +29,11 @@
#include "projectmacroexpander.h"
#include "kit.h"
#include "kitinformation.h"
#include "projectexplorerconstants.h"
#include <coreplugin/variablemanager.h>
#include <ssh/sshconnection.h>
using namespace ProjectExplorer;
......@@ -69,6 +71,30 @@ bool ProjectMacroExpander::resolveProjectMacro(const QString &name, QString *ret
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTBUILD_NAME)) {
result = m_bcName;
found = true;
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_HOSTADDRESS)) {
const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit);
if (device) {
result = device->sshParameters().host;
found = true;
}
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_SSHPORT)) {
const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit);
if (device) {
result = QString::number(device->sshParameters().port);
found = true;
}
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_USERNAME)) {
const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit);
if (device) {
result = device->sshParameters().userName;
found = true;
}
} else if (name == QLatin1String(ProjectExplorer::Constants::VAR_CURRENTDEVICE_PRIVATEKEYFILE)) {
const IDevice::ConstPtr device = DeviceKitInformation::device(m_kit);
if (device) {
result = device->sshParameters().privateKeyFile;
found = true;
}
}
if (ret)
*ret = result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment