Compare commits
11 Commits
c4580b088d
...
a67a06bd7e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a67a06bd7e | ||
|
|
8fa8282047 | ||
|
|
f22812b767 | ||
|
|
6f0ad25a80 | ||
|
|
db50c78662 | ||
|
|
b4dffeefb0 | ||
|
|
e3be8a1b9a | ||
|
|
292cb2f750 | ||
|
|
186e53a7c4 | ||
|
|
5ab6dfbba1 | ||
|
|
259f9a89fb |
@@ -30,6 +30,7 @@ import sys
|
||||
parser = argparse.ArgumentParser(description="SDK snap launcher")
|
||||
parser.add_argument('snap_package',action="store")
|
||||
parser.add_argument('snap_command',action='store')
|
||||
parser.add_argument('--devmode' ,action='store_true')
|
||||
|
||||
options, args = parser.parse_known_args()
|
||||
|
||||
@@ -48,7 +49,11 @@ sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
|
||||
#ok lets install the snap package
|
||||
ret = subprocess.call(["snap", "install", options.snap_package, "--dangerous"], stdout=sys.stdout, stderr=sys.stderr)
|
||||
snaparg = ["snap", "install", options.snap_package, "--dangerous"]
|
||||
if options.devmode:
|
||||
print("Enabling devmode\n")
|
||||
snaparg += ["--devmode"]
|
||||
ret = subprocess.call(snaparg, stdout=sys.stdout, stderr=sys.stderr)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
|
||||
@@ -71,6 +76,7 @@ signal.signal(signal.SIGTERM, signalHandler)
|
||||
signal.signal(signal.SIGHUP, signalHandler)
|
||||
|
||||
#start the actual app
|
||||
print("Command args are: "+str(args)+"\n")
|
||||
if not stopped:
|
||||
proc = subprocess.Popen(["snap", "run", app_info[0]+"."+options.snap_command]+args, stdout=sys.stdout, stderr=sys.stderr)
|
||||
ret = proc.wait()
|
||||
|
||||
@@ -36,9 +36,10 @@ QList<ProjectExplorer::BuildInfo *> SnapcraftBuildConfigurationFactory::availabl
|
||||
if (qobject_cast<SnapcraftProject *>(parent->project()))
|
||||
return {};
|
||||
|
||||
//restrict this to local devices type kits for now
|
||||
/* FIXME: fully supported only with local device type kits for now
|
||||
if (ProjectExplorer::DeviceKitInformation::deviceId(parent->kit()) != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
|
||||
return {};
|
||||
*/
|
||||
|
||||
QList<ProjectExplorer::BuildInfo *> infoList;
|
||||
ProjectExplorer::BuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectFilePath().toString());
|
||||
@@ -62,9 +63,10 @@ QList<ProjectExplorer::BuildInfo *> SnapcraftBuildConfigurationFactory::availabl
|
||||
{
|
||||
Utils::MimeDatabase db;
|
||||
|
||||
//restrict this to local devices type kits for now
|
||||
/* FIXME: fully supported only with local device type kits for now
|
||||
if (ProjectExplorer::DeviceKitInformation::deviceId(k) != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
|
||||
return {};
|
||||
*/
|
||||
|
||||
auto mimeType = db.mimeTypeForFile(projectPath);
|
||||
if (!mimeType.matchesName(Constants::SNAPCRAFT_PROJECT_MIMETYPE))
|
||||
|
||||
@@ -67,7 +67,7 @@ SnapcraftProject::SnapcraftProject(SnapcraftProjectManager *manager, const Utils
|
||||
ProjectExplorer::FileNode *projectFileNode = new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false);
|
||||
m_rootNode->addFileNodes({projectFileNode});
|
||||
|
||||
connect(m_file, &SnapcraftProjectFile::changed, this, &SnapcraftProject::asyncUpdate);
|
||||
connect(m_file.data(), &SnapcraftProjectFile::changed, this, &SnapcraftProject::asyncUpdate);
|
||||
|
||||
//we show magic directories that are not listed in the snapcraft.yaml file, therefore we need to watch the directory
|
||||
//if one of those is changed or removed
|
||||
|
||||
@@ -420,7 +420,9 @@ ProjectExplorer::FolderNode *SnapcraftGenericPartNode::createOrFindFolder(const
|
||||
watches << currentPath.toFileInfo().absoluteFilePath();
|
||||
}
|
||||
|
||||
m_watcher->addPaths(watches);
|
||||
if (!watches.isEmpty())
|
||||
m_watcher->addPaths(watches);
|
||||
|
||||
return currFolder;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,17 +18,20 @@
|
||||
#include <QFileInfo>
|
||||
#include <QFormLayout>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
const QString COMMAND_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapCommand");
|
||||
const QString DEVMODE_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapDevMode");
|
||||
const QString WORKINGDIRECTORYASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.WorkingDirectoryAspect");
|
||||
const QString ARGUMENTASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.ArgumentAspect");
|
||||
const QString TERMINALASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.TerminalAspect");
|
||||
|
||||
SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent)
|
||||
: ProjectExplorer::RunConfiguration(parent, Constants::SNAP_RUNCONFIGURATION_ID)
|
||||
, m_useDevMode(true)
|
||||
, m_workingDirectoryAspect(new ProjectExplorer::WorkingDirectoryAspect(this, WORKINGDIRECTORYASPECT_ID))
|
||||
, m_argumentAspect(new ProjectExplorer::ArgumentsAspect(this, ARGUMENTASPECT_ID))
|
||||
, m_terminalAspect(new ProjectExplorer::TerminalAspect(this, TERMINALASPECT_ID))
|
||||
@@ -87,6 +90,7 @@ bool SnapRunConfiguration::fromMap(const QVariantMap &map)
|
||||
return false;
|
||||
|
||||
m_command = map.value(COMMAND_KEY, QString()).toString();
|
||||
m_useDevMode = map.value(DEVMODE_KEY, true).toBool();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,6 +98,7 @@ QVariantMap SnapRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = ProjectExplorer::RunConfiguration::toMap();
|
||||
map.insert(COMMAND_KEY, m_command);
|
||||
map.insert(DEVMODE_KEY, m_useDevMode);
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -131,6 +136,9 @@ ProjectExplorer::Runnable SnapRunConfiguration::runnable() const
|
||||
m_command
|
||||
};
|
||||
|
||||
if (m_useDevMode)
|
||||
args.prepend(QStringLiteral("--devmode"));
|
||||
|
||||
ProjectExplorer::StandardRunnable r;
|
||||
r.executable = Utils::FileName::fromString(Constants::UBUNTU_SCRIPTPATH).appendPath(QStringLiteral("qtc_desktop_snaprunner.py")).toString();;
|
||||
r.workingDirectory = m_workingDirectoryAspect->workingDirectory().toString();
|
||||
@@ -167,6 +175,16 @@ void SnapRunConfiguration::updateConfiguration()
|
||||
|
||||
}
|
||||
|
||||
bool SnapRunConfiguration::useDevMode() const
|
||||
{
|
||||
return m_useDevMode;
|
||||
}
|
||||
|
||||
void SnapRunConfiguration::setUseDevMode(bool useDevMode)
|
||||
{
|
||||
m_useDevMode = useDevMode;
|
||||
}
|
||||
|
||||
SnapRunConfigurationWidget::SnapRunConfigurationWidget(SnapRunConfiguration *config)
|
||||
: QWidget (nullptr),
|
||||
m_rc(config),
|
||||
@@ -188,10 +206,16 @@ SnapRunConfigurationWidget::SnapRunConfigurationWidget(SnapRunConfiguration *con
|
||||
if (idx >= 0)
|
||||
m_commandsBox->setCurrentIndex(idx);
|
||||
|
||||
m_devmodeCheckBox = new QCheckBox(tr("Use devmode"), this);
|
||||
m_devmodeCheckBox->setChecked(config->useDevMode());
|
||||
connect(m_devmodeCheckBox, &QCheckBox::stateChanged,
|
||||
this, &SnapRunConfigurationWidget::devModeStateChanged);
|
||||
|
||||
layout->addRow(tr("Command:"), m_commandsBox);
|
||||
config->extraAspect<ProjectExplorer::ArgumentsAspect>()->addToMainConfigurationWidget(this, layout);
|
||||
config->extraAspect<ProjectExplorer::WorkingDirectoryAspect>()->addToMainConfigurationWidget(this,layout);
|
||||
config->extraAspect<ProjectExplorer::TerminalAspect>()->addToMainConfigurationWidget(this,layout);
|
||||
layout->addRow(QStringLiteral(""), m_devmodeCheckBox);
|
||||
|
||||
if(config->target()) {
|
||||
connect(qobject_cast<SnapcraftProject*>(config->target()->project()), &SnapcraftProject::commandListChanged,
|
||||
@@ -226,6 +250,14 @@ void SnapRunConfigurationWidget::updateComboBox()
|
||||
m_commandsBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void SnapRunConfigurationWidget::devModeStateChanged(int state)
|
||||
{
|
||||
if (state == Qt::Checked)
|
||||
m_rc->setUseDevMode(true);
|
||||
else
|
||||
m_rc->setUseDevMode(false);
|
||||
}
|
||||
|
||||
void SnapRunConfigurationWidget::commandSelected(const int index)
|
||||
{
|
||||
if(m_updating)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <QStringList>
|
||||
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
|
||||
namespace Utils {
|
||||
class PathChooser;
|
||||
@@ -49,6 +50,9 @@ public:
|
||||
virtual QWidget *createConfigurationWidget() override;
|
||||
virtual ProjectExplorer::Runnable runnable() const override;
|
||||
|
||||
bool useDevMode() const;
|
||||
void setUseDevMode(bool useDevMode);
|
||||
|
||||
private:
|
||||
SnapcraftStep *activeSnapcraftStep() const;
|
||||
void updateCommandList(const QStringList &commands);
|
||||
@@ -56,6 +60,7 @@ private:
|
||||
|
||||
private:
|
||||
QString m_command;
|
||||
bool m_useDevMode;
|
||||
QMetaObject::Connection m_currBuildConfConn;
|
||||
ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect;
|
||||
ProjectExplorer::ArgumentsAspect* m_argumentAspect;
|
||||
@@ -71,6 +76,7 @@ public:
|
||||
|
||||
protected:
|
||||
void updateComboBox ();
|
||||
void devModeStateChanged (int state);
|
||||
|
||||
protected slots:
|
||||
void commandSelected (const int index);
|
||||
@@ -78,6 +84,7 @@ protected slots:
|
||||
private:
|
||||
SnapRunConfiguration *m_rc;
|
||||
QComboBox *m_commandsBox;
|
||||
QCheckBox *m_devmodeCheckBox;
|
||||
bool m_updating;
|
||||
};
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ const char UBUNTUPROJECT_REMOTE_RUNCONTROL_SCOPE_ID[] = "UbuntuProjectManager.Re
|
||||
const char UBUNTUPROJECT_REMOTE_RUNCONTROL_APP_ID[] = "UbuntuProjectManager.RemoteRunConfiguration.App";
|
||||
|
||||
const char UBUNTUHTML_PROJECT_LAUNCHER_EXE[] = "/usr/bin/ubuntu-html5-app-launcher";
|
||||
const char UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE[] = "/usr/bin/webapp-container";
|
||||
const char UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE[] = "webapp-container";
|
||||
const char UBUNTUSCOPES_PROJECT_LAUNCHER_EXE[] = "qtc_desktop_scoperunner.py";
|
||||
|
||||
const char UBUNTUBZR_INITIALIZE[] ="%0/qtc_bzr_info";
|
||||
@@ -280,9 +280,9 @@ const char TASK_DEVICE_SCRIPT[] = "Ubuntu.Task.DeviceScript";
|
||||
const char UBUNTU_SETTINGS_ICON[] = ":/ubuntu/images/ubuntu-32.png";
|
||||
|
||||
//review tools
|
||||
const char CLICK_REVIEWERSTOOLS_BINARY[] = "/usr/bin/click-review";
|
||||
const char CLICK_REVIEWERSTOOLS_BINARY[] = "click-review";
|
||||
const char CLICK_REVIEWERSTOOLS_ARGS[] = "--sdk \"%0\"";
|
||||
const char CLICK_REVIEWERSTOOLS_LOCATION[] = "/usr/bin/click-review --sdk \"%0\"";
|
||||
const char CLICK_REVIEWERSTOOLS_LOCATION[] = "click-review --sdk \"%0\"";
|
||||
|
||||
//build configuration
|
||||
const char UBUNTU_CLICK_OPEN_TERMINAL_ERROR[] = "Error when starting terminal";
|
||||
@@ -294,8 +294,8 @@ const char UBUNTU_CLICK_SERIES_REGEX[] = "^DISTRIB_CODENAME=([A-Za-z]+)$";
|
||||
|
||||
const char UBUNTU_CLICK_CHROOT_SUFFIX_ENV_VAR[] = "CLICK_CHROOT_SUFFIX";
|
||||
const char UBUNTU_CLICK_CHROOT_DEFAULT_NAME[] = "click";
|
||||
const char UBUNTU_CLICK_BINARY[] = "/usr/bin/click";
|
||||
const char UBUNTU_SUDO_BINARY[] = "/usr/bin/pkexec";
|
||||
const char UBUNTU_CLICK_BINARY[] = "click";
|
||||
const char UBUNTU_SUDO_BINARY[] = "pkexec";
|
||||
|
||||
const QString UBUNTU_TARGET_TOOL = QStandardPaths::findExecutable(QStringLiteral("usdk-target"));
|
||||
const char UBUNTU_CREATE_CLICK_TARGET_ARGS[] = "env USDK_TEST_REMOTE=\"%0\" %1 create -n %2 -p %3";
|
||||
|
||||
@@ -91,6 +91,8 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
using namespace Ubuntu;
|
||||
@@ -123,6 +125,11 @@ bool UbuntuPlugin::initialize(const QStringList &arguments, QString *errorString
|
||||
defaultFont.setFamily(QStringLiteral("Ubuntu"));
|
||||
defaultFont.setWeight(QFont::Light);
|
||||
|
||||
|
||||
if (::getuid() == 0) {
|
||||
criticalError(tr("\nThe Ubuntu SDK can not be used as superuser."));
|
||||
return false;
|
||||
}
|
||||
if (QStandardPaths::findExecutable(QStringLiteral("lxc")).isEmpty()) {
|
||||
criticalError(tr("\nLxd is not installed properly.\nIt is required for the Ubuntu-SDK-IDE to work."));
|
||||
return false;
|
||||
@@ -419,7 +426,7 @@ bool UbuntuPlugin::checkContainerSetup()
|
||||
case ERR_NO_ACCESS:
|
||||
//the tool tells us that we have no access to the LXD server
|
||||
criticalError(tr("The current user can not access the LXD server which is required for the Ubuntu SDK.\n"
|
||||
"Make sure the user is part of the lxd group and restart the IDE."));
|
||||
"Make sure the user is part of the lxd group, relogin and restart the IDE."));
|
||||
break;
|
||||
case ERR_NO_BRIDGE:
|
||||
if (Settings::askForContainerSetup()) {
|
||||
|
||||
Reference in New Issue
Block a user