Compare commits

...

11 Commits

Author SHA1 Message Date
Christian Dywan
a67a06bd7e Remove hard-coded /usr/bin/ prefix from ubuntuconstants. Fixes: https://bugs.launchpad.net/bugs/1647484.
Approved by ubuntu-sdk-build-bot, Benjamin Zeller.
2016-12-16 11:32:19 +00:00
Christian Dywan
8fa8282047 Allow non-local kits for Snapcraft projects.
Approved by ubuntu-sdk-build-bot, Benjamin Zeller.
2016-12-16 11:22:57 +00:00
Christian Dywan
f22812b767 Allow non-local kits for Snapcraft projects 2016-12-16 12:01:57 +01:00
Christian Dywan
6f0ad25a80 Revert UBUNTUHTML_PROJECT_LAUNCHER_EXE for now 2016-12-16 11:47:09 +01:00
Christian Dywan
db50c78662 Remove hard-coded /usr/bin/ prefix from ubuntuconstants 2016-12-05 22:24:45 +01:00
Benjamin Zeller
b4dffeefb0 Build on trusty.
Approved by ubuntu-sdk-build-bot, Zoltan Balogh.
2016-11-16 10:42:26 +00:00
Benjamin Zeller
e3be8a1b9a Build on trusty 2016-11-16 11:23:37 +01:00
Benjamin Zeller
292cb2f750 - Less warnings when opening a snapcraft project
- Do not allow superuser to open the IDE.

Approved by Zoltan Balogh, ubuntu-sdk-build-bot.
2016-11-14 16:43:10 +00:00
Benjamin Zeller
186e53a7c4 - Less warnings when opening a snapcraft project
- Do not allow superuser to open the IDE
2016-11-14 16:58:25 +01:00
Benjamin Zeller
5ab6dfbba1 add a devmode switch.
Approved by ubuntu-sdk-build-bot, Zoltan Balogh.
2016-11-08 12:43:22 +00:00
Benjamin Zeller
259f9a89fb add a devmode switch 2016-11-08 13:16:30 +01:00
8 changed files with 67 additions and 11 deletions

View File

@@ -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()

View File

@@ -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))

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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;
};

View File

@@ -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";

View File

@@ -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()) {