- Support running snapcraft projects from the IDE
- Patch RunControlFactories to disable unwanted RC modes for snapcraft projects. Approved by ubuntu-sdk-build-bot, Zoltan Balogh.
This commit is contained in:
242
debian/patches/cmake_ubuntuspecificbits.diff
vendored
242
debian/patches/cmake_ubuntuspecificbits.diff
vendored
@@ -1,6 +1,8 @@
|
||||
--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
|
||||
@@ -165,10 +165,10 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
|
||||
@@ -165,10 +165,10 @@ void CMakeManager::createXmlFile(Utils::
|
||||
proc->setWorkingDirectory(buildDirectoryPath);
|
||||
proc->setEnvironment(env);
|
||||
|
||||
@@ -14,9 +16,11 @@
|
||||
Utils::QtcProcess::addArgs(&args, arguments);
|
||||
|
||||
proc->setCommand(executable, args);
|
||||
--- a/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
|
||||
@@ -288,9 +288,10 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
|
||||
@@ -288,9 +288,10 @@ Internal::Manager *QmlProject::projectMa
|
||||
bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const
|
||||
{
|
||||
Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);
|
||||
@@ -29,9 +33,11 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
|
||||
@@ -2024,6 +2024,7 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
|
||||
@@ -2024,6 +2024,7 @@ EvalResult *QmakeProFileNode::evaluate(c
|
||||
result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS"));
|
||||
result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS"));
|
||||
result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME"));
|
||||
@@ -39,9 +45,11 @@
|
||||
|
||||
result->isDeployable = false;
|
||||
if (result->projectType == ApplicationTemplate) {
|
||||
--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
|
||||
+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
|
||||
@@ -107,7 +107,8 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
|
||||
@@ -107,7 +107,8 @@ enum QmakeVariable {
|
||||
AndroidPackageSourceDir,
|
||||
AndroidExtraLibs,
|
||||
IsoIconsVar,
|
||||
@@ -51,8 +59,10 @@
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
|
||||
+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
|
||||
@@ -25,6 +25,8 @@
|
||||
|
||||
#pragma once
|
||||
@@ -62,7 +72,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
|
||||
@@ -34,7 +36,7 @@
|
||||
@@ -34,7 +36,7 @@ namespace ProjectExplorer { class Kit; }
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
|
||||
@@ -71,9 +81,11 @@
|
||||
public:
|
||||
enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC };
|
||||
CMakeConfigItem();
|
||||
--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
|
||||
@@ -568,6 +568,11 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
|
||||
@@ -568,6 +568,11 @@ bool QtVersionManager::isValidId(int id)
|
||||
return m_versions.contains(id);
|
||||
}
|
||||
|
||||
@@ -85,9 +97,11 @@
|
||||
BaseQtVersion *QtVersionManager::version(int id)
|
||||
{
|
||||
QTC_ASSERT(isLoaded(), return 0);
|
||||
--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
|
||||
+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
|
||||
@@ -63,6 +63,7 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
static void removeVersion(BaseQtVersion *version);
|
||||
|
||||
static bool isValidId(int id);
|
||||
@@ -95,9 +109,11 @@
|
||||
|
||||
signals:
|
||||
// content of BaseQtVersion objects with qmake path might have changed
|
||||
--- a/dist/qtcreator/src/plugins/plugins.pro
|
||||
+++ b/dist/qtcreator/src/plugins/plugins.pro
|
||||
@@ -56,7 +56,8 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/plugins.pro
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
|
||||
@@ -56,7 +56,8 @@ SUBDIRS = \
|
||||
winrt \
|
||||
qmlprofiler \
|
||||
updateinfo \
|
||||
@@ -107,9 +123,11 @@
|
||||
|
||||
DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)
|
||||
isEmpty(DO_NOT_BUILD_QMLDESIGNER) {
|
||||
--- a/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
|
||||
+++ b/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
|
||||
@@ -11,10 +11,10 @@
|
||||
Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
|
||||
+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
|
||||
@@ -11,10 +11,10 @@ load(qt_parts)
|
||||
src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher
|
||||
src_uitk_launcher.depends = sub-src
|
||||
|
||||
@@ -123,9 +141,11 @@
|
||||
|
||||
# additional 'make test' target required by continuous integration system
|
||||
test.target = test
|
||||
--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
|
||||
@@ -387,6 +387,18 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
|
||||
@@ -387,6 +387,18 @@ void CMakeProject::runCMake()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,8 +164,10 @@
|
||||
QList<CMakeBuildTarget> CMakeProject::buildTargets() const
|
||||
{
|
||||
BuildDirManager *bdm = nullptr;
|
||||
--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
|
||||
+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "cmake_global.h"
|
||||
@@ -154,7 +176,7 @@
|
||||
|
||||
#include <projectexplorer/extracompiler.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -111,6 +112,8 @@
|
||||
@@ -111,6 +112,8 @@ public:
|
||||
|
||||
void runCMake();
|
||||
|
||||
@@ -163,9 +185,11 @@
|
||||
signals:
|
||||
/// emitted when cmake is running:
|
||||
void parsingStarted();
|
||||
--- a/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
|
||||
+++ b/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
|
||||
@@ -249,11 +249,11 @@
|
||||
Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
|
||||
@@ -249,11 +249,11 @@ PlatformMenuWrapper::PlatformMenuWrapper
|
||||
, m_target(target)
|
||||
, m_inserted(false)
|
||||
{
|
||||
@@ -182,9 +206,11 @@
|
||||
|
||||
syncPlatformMenu();
|
||||
}
|
||||
--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
|
||||
@@ -161,6 +161,12 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
|
||||
@@ -161,6 +161,12 @@ bool GeneratedFile::write(QString *error
|
||||
|
||||
Utils::FileSaver saver(m_d->path, flags);
|
||||
saver.write(m_d->contents);
|
||||
@@ -197,9 +223,11 @@
|
||||
return saver.finalize(errorMessage);
|
||||
}
|
||||
|
||||
--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
|
||||
+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
|
||||
@@ -46,7 +46,9 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
|
||||
@@ -46,7 +46,9 @@ public:
|
||||
/* File exists and the user indicated that he wants to keep it */
|
||||
KeepExistingFileAttribute = 0x8,
|
||||
/* Force overwriting of a file without asking the user to keep it */
|
||||
@@ -210,9 +238,11 @@
|
||||
};
|
||||
Q_DECLARE_FLAGS(Attributes, Attribute)
|
||||
|
||||
--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
|
||||
+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
|
||||
@@ -70,6 +70,7 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
|
||||
@@ -70,6 +70,7 @@ bool JsonWizardFileGenerator::setup(cons
|
||||
f.overwrite = tmp.value(QLatin1String("overwrite"), false);
|
||||
f.openInEditor = tmp.value(QLatin1String("openInEditor"), false);
|
||||
f.openAsProject = tmp.value(QLatin1String("openAsProject"), false);
|
||||
@@ -220,7 +250,7 @@
|
||||
|
||||
f.options = JsonWizard::parseOptions(tmp.value(QLatin1String("options")), errorMessage);
|
||||
if (!errorMessage->isEmpty())
|
||||
@@ -146,6 +147,8 @@
|
||||
@@ -146,6 +147,8 @@ Core::GeneratedFile JsonWizardFileGenera
|
||||
attributes |= Core::GeneratedFile::OpenProjectAttribute;
|
||||
if (JsonWizard::boolFromVariant(file.overwrite, expander))
|
||||
attributes |= Core::GeneratedFile::ForceOverwrite;
|
||||
@@ -229,7 +259,7 @@
|
||||
|
||||
if (file.keepExisting)
|
||||
attributes |= Core::GeneratedFile::KeepExistingFileAttribute;
|
||||
@@ -231,6 +234,7 @@
|
||||
@@ -231,6 +234,7 @@ bool JsonWizardFileGenerator::writeFile(
|
||||
if (!file->write(errorMessage))
|
||||
return false;
|
||||
}
|
||||
@@ -237,9 +267,11 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
|
||||
+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
|
||||
@@ -55,6 +55,7 @@
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
QVariant overwrite = false;
|
||||
QVariant openInEditor = false;
|
||||
QVariant openAsProject = false;
|
||||
@@ -247,3 +279,113 @@
|
||||
|
||||
QList<JsonWizard::OptionDefinition> options;
|
||||
};
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp
|
||||
@@ -987,17 +987,20 @@ public:
|
||||
bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const override
|
||||
{
|
||||
Q_UNUSED(runConfiguration);
|
||||
+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
|
||||
return runMode == CALLGRIND_RUN_MODE;
|
||||
}
|
||||
|
||||
RunControl *create(RunConfiguration *runConfiguration, Core::Id runMode, QString *errorMessage) override
|
||||
{
|
||||
Q_UNUSED(errorMessage);
|
||||
+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
return m_tool->createRunControl(runConfiguration, runMode);
|
||||
}
|
||||
|
||||
IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override
|
||||
{
|
||||
+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
return createValgrindRunConfigurationAspect(rc);
|
||||
}
|
||||
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp
|
||||
@@ -553,6 +553,8 @@ public:
|
||||
QTC_ASSERT(runConfig, return 0);
|
||||
QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
|
||||
|
||||
+ if (runConfig->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
+
|
||||
// We cover only local setup here. Remote setups are handled by the
|
||||
// RunControl factories in the target specific plugins.
|
||||
QStringList errors;
|
||||
@@ -568,6 +570,8 @@ public:
|
||||
if (!(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain))
|
||||
return false;
|
||||
|
||||
+ if (runConfig->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
|
||||
+
|
||||
Runnable runnable = runConfig->runnable();
|
||||
if (runnable.is<StandardRunnable>()) {
|
||||
IDevice::ConstPtr device = runnable.as<StandardRunnable>().device;
|
||||
@@ -582,6 +586,7 @@ public:
|
||||
|
||||
IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
|
||||
{
|
||||
+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
return new DebuggerRunConfigurationAspect(rc);
|
||||
}
|
||||
};
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp
|
||||
@@ -703,17 +703,20 @@ public:
|
||||
bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const override
|
||||
{
|
||||
Q_UNUSED(runConfiguration);
|
||||
+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
|
||||
return mode == MEMCHECK_RUN_MODE || mode == MEMCHECK_WITH_GDB_RUN_MODE;
|
||||
}
|
||||
|
||||
RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) override
|
||||
{
|
||||
Q_UNUSED(errorMessage);
|
||||
+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
return m_tool->createRunControl(runConfiguration, mode);
|
||||
}
|
||||
|
||||
IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override
|
||||
{
|
||||
+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
return createValgrindRunConfigurationAspect(rc);
|
||||
}
|
||||
|
||||
Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
|
||||
===================================================================
|
||||
--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
|
||||
+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
|
||||
@@ -65,6 +65,7 @@ QmlProfilerRunControlFactory::QmlProfile
|
||||
|
||||
bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
|
||||
{
|
||||
+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
|
||||
return mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE && isLocal(runConfiguration);
|
||||
}
|
||||
|
||||
@@ -72,6 +73,9 @@ RunControl *QmlProfilerRunControlFactory
|
||||
{
|
||||
QTC_ASSERT(canRun(runConfiguration, mode), return 0);
|
||||
QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
|
||||
+
|
||||
+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
+
|
||||
auto runnable = runConfiguration->runnable().as<StandardRunnable>();
|
||||
|
||||
if (runnable.executable.isEmpty()) {
|
||||
@@ -114,6 +118,7 @@ RunControl *QmlProfilerRunControlFactory
|
||||
ProjectExplorer::IRunConfigurationAspect *
|
||||
QmlProfilerRunControlFactory::createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc)
|
||||
{
|
||||
+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
|
||||
return new QmlProfilerRunConfigurationAspect(rc);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ SOURCES += \
|
||||
src/ubuntu/ubuntuproject.cpp \
|
||||
src/ubuntu/ubuntuprojectfile.cpp \
|
||||
src/ubuntu/ubuntuprojectnode.cpp \
|
||||
#src/ubuntu/ubuntuversion.cpp \
|
||||
src/ubuntu/ubuntuversion.cpp \
|
||||
#src/ubuntu/ubuntufeatureprovider.cpp \
|
||||
#src/ubuntu/ubuntuversionmanager.cpp \
|
||||
src/ubuntu/ubuntupackagingmode.cpp \
|
||||
@@ -123,7 +123,7 @@ HEADERS += \
|
||||
src/ubuntu/ubuntuproject.h \
|
||||
src/ubuntu/ubuntuprojectfile.h \
|
||||
src/ubuntu/ubuntuprojectnode.h \
|
||||
#src/ubuntu/ubuntuversion.h \
|
||||
src/ubuntu/ubuntuversion.h \
|
||||
#src/ubuntu/ubuntufeatureprovider.h \
|
||||
#src/ubuntu/ubuntuversionmanager.h \
|
||||
src/ubuntu/ubuntupackagingmode.h \
|
||||
|
||||
@@ -15,7 +15,7 @@ parts:
|
||||
source: %{ProjectNameL}/
|
||||
qt-version: qt5
|
||||
options: ["CONFIG+=snapcraft"]
|
||||
project-files: [%{ProjectNameL}]
|
||||
project-files: [%{ProjectNameL}.pro]
|
||||
build-packages:
|
||||
- build-essential
|
||||
- qtbase5-dev
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
"trDisplayName": "QtQuick App with QML Ubuntu UI",
|
||||
"trDisplayCategory": "Snapcraft",
|
||||
"icon": "../share/ubuntu.png",
|
||||
"enabled": "%{JS: [ %{Plugins} ].indexOf('Ubuntu') >= 0}",
|
||||
"enabled": "%{JS: [ %{Plugins} ].indexOf('Ubuntu') >= 0 && Ubuntu.supportsSnappy()}",
|
||||
|
||||
"options":
|
||||
[
|
||||
{ "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
|
||||
{ "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/snapcraft','yaml')}" },
|
||||
{ "key": "ProjectNameL", "value": "%{JS: \"%{ProjectName}\".toLowerCase()}" },
|
||||
{ "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
|
||||
{ "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" }
|
||||
|
||||
84
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py
vendored
Executable file
84
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py
vendored
Executable file
@@ -0,0 +1,84 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
#
|
||||
# QTC device applauncher
|
||||
# Copyright (C) 2014 Canonical
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Benjamin Zeller <benjamin.zeller@canonical.com>
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import argparse
|
||||
import signal
|
||||
import sys
|
||||
|
||||
# register options to the argument parser
|
||||
parser = argparse.ArgumentParser(description="SDK snap launcher")
|
||||
parser.add_argument('snap_package',action="store")
|
||||
parser.add_argument('snap_command',action='store')
|
||||
|
||||
options, args = parser.parse_known_args()
|
||||
|
||||
if not os.path.isfile(options.snap_package):
|
||||
print("Snap file does not exist")
|
||||
sys.exit(1)
|
||||
|
||||
#parse the package name which should be application_version_arch.snap
|
||||
app_info = os.path.basename(options.snap_package)[:-5].split("_")
|
||||
if len(app_info) != 3:
|
||||
print("The snap package name is invalid", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
#flush all descriptors
|
||||
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)
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
|
||||
#flush all descriptors
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
|
||||
#this will contain the actual subprocess object
|
||||
proc = None
|
||||
stopped = False
|
||||
def signalHandler(signum, frame):
|
||||
print('Signal handler called with signal', signum)
|
||||
if proc is not None:
|
||||
proc.kill()
|
||||
else:
|
||||
stopped = True
|
||||
|
||||
signal.signal(signal.SIGINT, signalHandler)
|
||||
signal.signal(signal.SIGTERM, signalHandler)
|
||||
signal.signal(signal.SIGHUP, signalHandler)
|
||||
|
||||
#start the actual app
|
||||
if not stopped:
|
||||
proc = subprocess.Popen(["snap", "run", app_info[0]+"."+options.snap_command]+args, stdout=sys.stdout, stderr=sys.stderr)
|
||||
ret = proc.wait()
|
||||
|
||||
#flush all descriptors
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
|
||||
subprocess.call(["snap", "remove", app_info[0]], stdout=sys.stdout, stderr=sys.stderr)
|
||||
|
||||
sys.exit(ret)
|
||||
@@ -1,4 +1,23 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
|
||||
#
|
||||
# QTC device applauncher
|
||||
# Copyright (C) 2014 Canonical
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author: Benjamin Zeller <benjamin.zeller@canonical.com>
|
||||
|
||||
import os
|
||||
import sys
|
||||
@@ -22,6 +41,9 @@ if not os.path.isfile(options.snapcraft) or not os.access(options.snapcraft, os.
|
||||
|
||||
print("Using snapcraft from :"+options.snapcraft)
|
||||
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
|
||||
ret = subprocess.call([options.snapcraft, "clean"])
|
||||
if ret != 0:
|
||||
sys.exit(ret)
|
||||
|
||||
@@ -62,6 +62,11 @@ static QMap <QString,ProjectExplorer::Abi> init_architectures()
|
||||
ProjectExplorer::Abi::GenericLinuxFlavor,
|
||||
ProjectExplorer::Abi::ElfFormat,
|
||||
64));
|
||||
map.insert(QLatin1String("arm64") , ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture,
|
||||
ProjectExplorer::Abi::LinuxOS,
|
||||
ProjectExplorer::Abi::GenericLinuxFlavor,
|
||||
ProjectExplorer::Abi::ElfFormat,
|
||||
64));
|
||||
return map;
|
||||
}
|
||||
|
||||
@@ -130,6 +135,15 @@ ProjectExplorer::Abi ClickToolChain::architectureNameToAbi(const QString &arch)
|
||||
return clickArchitectures[arch];
|
||||
}
|
||||
|
||||
QString ClickToolChain::abiToArchitectureName(const ProjectExplorer::Abi &abi)
|
||||
{
|
||||
for (auto i = clickArchitectures.constBegin(); i != clickArchitectures.constEnd(); i++){
|
||||
if (i.value() == abi)
|
||||
return i.key();
|
||||
}
|
||||
return QString("unknown");
|
||||
}
|
||||
|
||||
QList<QString> ClickToolChain::supportedArchitectures()
|
||||
{
|
||||
return clickArchitectures.keys();
|
||||
@@ -158,7 +172,13 @@ QString ClickToolChain::gnutriplet(const ProjectExplorer::Abi &abi)
|
||||
{
|
||||
switch(abi.architecture()) {
|
||||
case ProjectExplorer::Abi::ArmArchitecture:
|
||||
return QLatin1String("arm-linux-gnueabihf");
|
||||
switch(abi.wordWidth())
|
||||
{
|
||||
case 32:
|
||||
return QLatin1String("arm-linux-gnueabihf");
|
||||
case 64:
|
||||
return QLatin1String("aarch64-linux-gnu");
|
||||
}
|
||||
break;
|
||||
case ProjectExplorer::Abi::X86Architecture:
|
||||
switch(abi.wordWidth())
|
||||
|
||||
@@ -50,6 +50,7 @@ public:
|
||||
const UbuntuClickTool::Target &clickTarget () const;
|
||||
|
||||
static ProjectExplorer::Abi architectureNameToAbi ( const QString &arch );
|
||||
static QString abiToArchitectureName ( const ProjectExplorer::Abi &abi );
|
||||
static QList<QString> supportedArchitectures ();
|
||||
|
||||
QString remoteCompilerCommand () const;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "snapcraftbuildconfiguration.h"
|
||||
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
@@ -24,7 +25,9 @@ bool SnapcraftBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
QVariantMap SnapcraftBuildConfiguration::toMap() const
|
||||
{
|
||||
return ProjectExplorer::BuildConfiguration::toMap();
|
||||
QVariantMap data = ProjectExplorer::BuildConfiguration::toMap();
|
||||
qDebug()<<"Storing ID: "<<ProjectExplorer::idFromMap(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
ProjectExplorer::NamedWidget *SnapcraftBuildConfiguration::createConfigWidget()
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <projectexplorer/projectmacroexpander.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
@@ -35,6 +36,10 @@ QList<ProjectExplorer::BuildInfo *> SnapcraftBuildConfigurationFactory::availabl
|
||||
if (qobject_cast<SnapcraftProject *>(parent->project()))
|
||||
return {};
|
||||
|
||||
//restrict this to local devices 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());
|
||||
if (info)
|
||||
@@ -57,6 +62,10 @@ QList<ProjectExplorer::BuildInfo *> SnapcraftBuildConfigurationFactory::availabl
|
||||
{
|
||||
Utils::MimeDatabase db;
|
||||
|
||||
//restrict this to local devices 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))
|
||||
return {};
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectmacroexpander.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <qmljs/qmljssimplereader.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
@@ -39,6 +41,10 @@
|
||||
using namespace Ubuntu;
|
||||
using namespace Ubuntu::Internal;
|
||||
|
||||
enum {
|
||||
debug = 0
|
||||
};
|
||||
|
||||
SnapcraftProject::SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName)
|
||||
: m_manager(manager),
|
||||
m_fileName(fileName),
|
||||
@@ -135,17 +141,69 @@ QString SnapcraftProject::shadowBuildDirectory(const QString &proFilePath
|
||||
|
||||
void SnapcraftProject::asyncUpdate()
|
||||
{
|
||||
qDebug()<<"Syncing from yaml";
|
||||
if(debug) qDebug()<<"Syncing from yaml";
|
||||
|
||||
QString oldDisplayName = displayName();
|
||||
|
||||
try {
|
||||
YAML::Node yaml = YAML::LoadFile(m_fileName.toString().toStdString());
|
||||
if (!m_rootNode->syncFromYAMLNode(yaml)) {
|
||||
qDebug()<<"Invalid YAML file";
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: file is invalid"),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath());
|
||||
}
|
||||
|
||||
QStringList commandList;
|
||||
|
||||
try {
|
||||
YAML::Node commands = yaml["apps"];
|
||||
if (!commands.IsMap()) {
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: apps is not a map"),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath());
|
||||
} else {
|
||||
for (auto it = commands.begin(); it != commands.end(); ++it) {
|
||||
if(!it->second.IsMap() || it->second["daemon"])
|
||||
continue;
|
||||
|
||||
commandList << QString::fromStdString(it->first.as<std::string>());
|
||||
}
|
||||
}
|
||||
|
||||
if(yaml["version"]) {
|
||||
QString snapVer = QString::fromStdString(yaml["version"].as<std::string>());
|
||||
if (snapVer != m_snapVersion) {
|
||||
if(debug) qDebug()<<"Snap version is"<<snapVer;
|
||||
m_snapVersion = snapVer;
|
||||
emit snapVersionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (const YAML::Exception &e) {
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing the command list: %1").arg(QString::fromLatin1(e.what())),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath(),
|
||||
e.mark.line);
|
||||
}
|
||||
|
||||
if (m_commands != commandList) {
|
||||
m_commands = commandList;
|
||||
emit commandListChanged(m_commands);
|
||||
}
|
||||
|
||||
} catch (const YAML::Exception &e) {
|
||||
qDebug() << e.what();
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing the project file: %1").arg(QString::fromLatin1(e.what())),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
projectFilePath(),
|
||||
e.mark.line);
|
||||
}
|
||||
|
||||
emit displayNameChanged();
|
||||
if (oldDisplayName != displayName())
|
||||
emit displayNameChanged();
|
||||
}
|
||||
|
||||
void SnapcraftProject::maybeUpdate(const QString &pathChanged)
|
||||
|
||||
@@ -47,6 +47,10 @@ public:
|
||||
SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName);
|
||||
|
||||
QString displayName() const override;
|
||||
QString snapVersion() const{
|
||||
return m_snapVersion;
|
||||
}
|
||||
|
||||
ProjectExplorer::IProjectManager *projectManager() const override;
|
||||
|
||||
ProjectExplorer::ProjectNode *rootProjectNode() const override;
|
||||
@@ -60,6 +64,10 @@ public:
|
||||
return m_fileName.toString();
|
||||
}
|
||||
|
||||
QStringList commands () const {
|
||||
return m_commands;
|
||||
}
|
||||
|
||||
// Project interface
|
||||
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
|
||||
bool needsConfiguration() const override;
|
||||
@@ -73,9 +81,15 @@ protected slots:
|
||||
void asyncUpdate ();
|
||||
void maybeUpdate (const QString &pathChanged);
|
||||
|
||||
signals:
|
||||
void commandListChanged (const QStringList &commands);
|
||||
void snapVersionChanged ();
|
||||
|
||||
private:
|
||||
SnapcraftProjectManager *m_manager;
|
||||
QString m_projectName;
|
||||
QStringList m_commands;
|
||||
QString m_snapVersion;
|
||||
QPointer<SnapcraftProjectFile> m_file;
|
||||
|
||||
Utils::FileName m_fileName;
|
||||
|
||||
@@ -17,8 +17,11 @@
|
||||
*/
|
||||
|
||||
#include "snapcraftprojectnode.h"
|
||||
#include "snapcraftproject.h"
|
||||
|
||||
#include <projectexplorer/nodesvisitor.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
|
||||
@@ -35,6 +38,11 @@
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
enum {
|
||||
debug = 0
|
||||
};
|
||||
|
||||
|
||||
static QIcon generateIcon(const QString &overlay) {
|
||||
const QSize desiredSize = QSize(16, 16);
|
||||
|
||||
@@ -62,27 +70,27 @@ SnapcraftProjectNode::SnapcraftProjectNode(SnapcraftProject *rootProject, const
|
||||
m_rootProject(rootProject),
|
||||
m_watcher(watcher)
|
||||
{
|
||||
setDisplayName(projectFilePath.parentDir().toString());
|
||||
setDisplayName(projectFilePath.parentDir().toFileInfo().fileName());
|
||||
setIcon(generateProjectIcon());
|
||||
}
|
||||
|
||||
SnapcraftProjectNode::~SnapcraftProjectNode()
|
||||
{
|
||||
if (m_watcher) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
|
||||
{
|
||||
qDebug()<<"Sync from YAML node";
|
||||
if(debug) qDebug()<<"Sync from YAML node";
|
||||
try {
|
||||
QString displayName = QString::fromStdString(rootNode["name"].as<std::string>());
|
||||
setDisplayName(displayName);
|
||||
|
||||
YAML::Node parts = rootNode["parts"];
|
||||
if (!parts.IsMap()) {
|
||||
qDebug()<<"Parts is not a map";
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: parts is not a map"),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
m_rootProject->projectFilePath());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -145,9 +153,13 @@ bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
|
||||
}
|
||||
|
||||
QSet<QString> obsoleteParts = existingParts.toSet() - partsFromYaml.toSet();
|
||||
qDebug()<<"Parts in yaml"<<partsFromYaml;
|
||||
qDebug()<<"Currently known parts"<<existingParts;
|
||||
qDebug()<<"Parts now obsolete: "<<obsoleteParts;
|
||||
|
||||
if(debug) {
|
||||
qDebug()<<"Parts in yaml"<<partsFromYaml;
|
||||
qDebug()<<"Currently known parts"<<existingParts;
|
||||
qDebug()<<"Parts now obsolete: "<<obsoleteParts;
|
||||
}
|
||||
|
||||
for (const auto &part : obsoleteParts) {
|
||||
int idx = existingParts.indexOf(part);
|
||||
if (idx >= 0)
|
||||
@@ -158,7 +170,11 @@ bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
|
||||
removeFolderNodes(nodesToRemove);
|
||||
addFolderNodes(nodesToAdd);
|
||||
} catch (const YAML::Exception &e) {
|
||||
qDebug()<<"ERRROR ERROR ERROR "<<e.what();
|
||||
ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
|
||||
QString::fromLatin1("Error while parsing snapcraft.yaml: %1").arg(QString::fromLatin1(e.what())),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
|
||||
m_rootProject->projectFilePath(),
|
||||
e.mark.line);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -191,9 +207,9 @@ SnapcraftGenericPartNode::SnapcraftGenericPartNode(const QString &partName, cons
|
||||
setIcon(generateProjectIcon());
|
||||
|
||||
if (watcher->addPath(folderPath.toString())) {
|
||||
qDebug()<<"Added"<<folderPath.toString()<<"to watcher";
|
||||
if(debug) qDebug()<<"Added"<<folderPath.toString()<<"to watcher";
|
||||
} else {
|
||||
qDebug()<<"Failed to add"<<folderPath.toString()<<"to watcher";
|
||||
if(debug) qDebug()<<"Failed to add"<<folderPath.toString()<<"to watcher";
|
||||
}
|
||||
m_watcherConnection = QObject::connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path){
|
||||
maybeScheduleProjectScan(path);
|
||||
@@ -228,7 +244,7 @@ void SnapcraftGenericPartNode::scheduleProjectScan()
|
||||
if (m_scanning)
|
||||
return;
|
||||
|
||||
qDebug()<<"Scheduling Project scan";
|
||||
if(debug) qDebug()<<"Scheduling Project scan";
|
||||
|
||||
m_scanning = true;
|
||||
|
||||
@@ -236,7 +252,7 @@ void SnapcraftGenericPartNode::scheduleProjectScan()
|
||||
rescanTimer->setSingleShot(true);
|
||||
rescanTimer->start(0);
|
||||
QObject::connect(rescanTimer, &QTimer::timeout, [this, rescanTimer](){
|
||||
qDebug()<<"Starting Project scan";
|
||||
if(debug) qDebug()<<"Starting Project scan";
|
||||
delete rescanTimer;
|
||||
this->scanProjectDirectory();
|
||||
|
||||
@@ -335,10 +351,12 @@ void SnapcraftGenericPartNode::scanProjectDirectory()
|
||||
QList<Utils::FileName> dirsToRemove = (oldDirs - newDirs).toList();
|
||||
QSet<Utils::FileName> dirsToAdd = newDirs - oldDirs;
|
||||
|
||||
qDebug()<<"Removing dirs " <<dirsToRemove;
|
||||
qDebug()<<"Adding dirs " <<dirsToAdd;
|
||||
qDebug()<<"Removing files" <<filesToRemove;
|
||||
qDebug()<<"Adding files " <<filesToAdd;
|
||||
if(debug) {
|
||||
qDebug()<<"Removing dirs " <<dirsToRemove;
|
||||
qDebug()<<"Adding dirs " <<dirsToAdd;
|
||||
qDebug()<<"Removing files" <<filesToRemove;
|
||||
qDebug()<<"Adding files " <<filesToAdd;
|
||||
}
|
||||
|
||||
removeFileNodes(filesToRemove.toList());
|
||||
removeFolderNodes(dirsToRemove);
|
||||
@@ -401,7 +419,8 @@ ProjectExplorer::FolderNode *SnapcraftGenericPartNode::createOrFindFolder(const
|
||||
|
||||
watches << currentPath.toFileInfo().absoluteFilePath();
|
||||
}
|
||||
qDebug()<<"Failed to add watches: "<<m_watcher->addPaths(watches);
|
||||
|
||||
m_watcher->addPaths(watches);
|
||||
return currFolder;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,25 +3,81 @@
|
||||
#include "snapcraftbuildconfiguration.h"
|
||||
|
||||
#include <ubuntu/snap/settings/snapcraftkitinformation.h>
|
||||
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
#include <ubuntu/clicktoolchain.h>
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
static const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
|
||||
|
||||
SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl)
|
||||
: ProjectExplorer::AbstractProcessStep(bsl, Constants::SNAPCRAFT_BUILDSTEP_ID)
|
||||
{
|
||||
setDefaultDisplayName(tr("Snapcraft"));
|
||||
|
||||
connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::snapVersionChanged,
|
||||
this, &SnapcraftStep::packagePathChanged);
|
||||
connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::displayNameChanged,
|
||||
this, &SnapcraftStep::packagePathChanged);
|
||||
}
|
||||
|
||||
SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs)
|
||||
: ProjectExplorer::AbstractProcessStep(bsl, bs)
|
||||
{
|
||||
connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::snapVersionChanged,
|
||||
this, &SnapcraftStep::packagePathChanged);
|
||||
connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::displayNameChanged,
|
||||
this, &SnapcraftStep::packagePathChanged);
|
||||
}
|
||||
|
||||
void SnapcraftStep::stdOutput(const QString &line)
|
||||
{
|
||||
m_lastLine = line;
|
||||
ProjectExplorer::AbstractProcessStep::stdOutput(line);
|
||||
}
|
||||
|
||||
void SnapcraftStep::processStarted()
|
||||
{
|
||||
m_packagePath.clear();
|
||||
emit packagePathChanged();
|
||||
|
||||
ProjectExplorer::AbstractProcessStep::processStarted();
|
||||
}
|
||||
|
||||
void SnapcraftStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||
{
|
||||
Utils::FileName newPackagePath;
|
||||
|
||||
ProjectExplorer::AbstractProcessStep::processFinished(exitCode, status);
|
||||
if (status == QProcess::NormalExit && exitCode == 0) {
|
||||
QRegularExpression exp((QLatin1String(PACKAGE_NAME_REGEX)));
|
||||
QRegularExpressionMatch m = exp.match(m_lastLine);
|
||||
if(m.hasMatch()) {
|
||||
ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
|
||||
if(bc)
|
||||
newPackagePath = bc->buildDirectory().appendPath(m.captured(1));
|
||||
}
|
||||
}
|
||||
|
||||
if (m_packagePath != newPackagePath) {
|
||||
m_packagePath = newPackagePath;
|
||||
emit packagePathChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool SnapcraftStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
|
||||
{
|
||||
if (!ProjectExplorer::AbstractProcessStep::processSucceeded(exitCode, status))
|
||||
return false;
|
||||
|
||||
return m_packagePath.toFileInfo().exists();
|
||||
}
|
||||
|
||||
bool SnapcraftStep::init(QList<const ProjectExplorer::BuildStep *> &)
|
||||
@@ -63,5 +119,21 @@ Utils::FileName SnapcraftStep::snapcraftCommand() const
|
||||
return bin;
|
||||
}
|
||||
|
||||
Utils::FileName SnapcraftStep::packagePath() const
|
||||
{
|
||||
if (!m_packagePath.isEmpty())
|
||||
return m_packagePath;
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
|
||||
SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(target()->project());
|
||||
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
|
||||
if(bc && pro && tc && !pro->displayName().isEmpty() && !pro->snapVersion().isEmpty())
|
||||
return bc->buildDirectory().appendPath(QStringLiteral("%1_%2_%3.snap")
|
||||
.arg(pro->displayName())
|
||||
.arg(pro->snapVersion())
|
||||
.arg(ClickToolChain::abiToArchitectureName(tc->targetAbi())));
|
||||
return Utils::FileName();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ubuntu
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define UBUNTU_INTERNAL_SNAPCRAFTSTEP_H
|
||||
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
@@ -21,10 +22,26 @@ public:
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
|
||||
|
||||
Utils::FileName snapcraftCommand () const;
|
||||
Utils::FileName packagePath () const;
|
||||
|
||||
signals:
|
||||
void packagePathChanged ();
|
||||
|
||||
protected:
|
||||
SnapcraftStep(ProjectExplorer::BuildStepList *bsl);
|
||||
SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs);
|
||||
|
||||
// AbstractProcessStep interface
|
||||
virtual void stdOutput(const QString &line);
|
||||
virtual void processStarted() override;
|
||||
virtual void processFinished(int exitCode, QProcess::ExitStatus status) override;
|
||||
virtual bool processSucceeded(int exitCode, QProcess::ExitStatus status) override;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
QString m_lastLine;
|
||||
Utils::FileName m_packagePath;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
241
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp
vendored
Normal file
241
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
#include "snaprunconfiguration.h"
|
||||
#include "snapcraftstep.h"
|
||||
#include "snapcraftproject.h"
|
||||
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
|
||||
#include <projectexplorer/runnables.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QFormLayout>
|
||||
#include <QComboBox>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
const QString COMMAND_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapCommand");
|
||||
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_workingDirectoryAspect(new ProjectExplorer::WorkingDirectoryAspect(this, WORKINGDIRECTORYASPECT_ID))
|
||||
, m_argumentAspect(new ProjectExplorer::ArgumentsAspect(this, ARGUMENTASPECT_ID))
|
||||
, m_terminalAspect(new ProjectExplorer::TerminalAspect(this, TERMINALASPECT_ID))
|
||||
, m_localEnvironmentAspect(new ProjectExplorer::LocalEnvironmentAspect(this, ProjectExplorer::LocalEnvironmentAspect::BaseEnvironmentModifier()))
|
||||
{
|
||||
m_terminalAspect->setRunMode(ProjectExplorer::ApplicationLauncher::Gui);
|
||||
|
||||
addExtraAspect(m_argumentAspect);
|
||||
addExtraAspect(m_terminalAspect);
|
||||
addExtraAspect(m_localEnvironmentAspect);
|
||||
addExtraAspect(m_workingDirectoryAspect);
|
||||
|
||||
if(parent) {
|
||||
SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(parent->project());
|
||||
if (pro) {
|
||||
setDisplayName(pro->displayName());
|
||||
QStringList comms = pro->commands();
|
||||
if (comms.size())
|
||||
m_command = comms.first();
|
||||
}
|
||||
m_workingDirectoryAspect->setDefaultWorkingDirectory(Utils::FileName::fromString(pro->projectDir().absolutePath()));
|
||||
}
|
||||
|
||||
// Connect target signals
|
||||
connect(this->target(), &ProjectExplorer::Target::activeBuildConfigurationChanged,
|
||||
this, &SnapRunConfiguration::updateConfiguration);
|
||||
updateConfiguration();
|
||||
}
|
||||
|
||||
SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent, SnapRunConfiguration *source)
|
||||
: ProjectExplorer::RunConfiguration(parent, source),
|
||||
m_command(source->m_command)
|
||||
{
|
||||
// Connect target signals
|
||||
connect(this->target(), &ProjectExplorer::Target::activeBuildConfigurationChanged,
|
||||
this, &SnapRunConfiguration::updateConfiguration);
|
||||
updateConfiguration();
|
||||
}
|
||||
|
||||
QString SnapRunConfiguration::command() const
|
||||
{
|
||||
return m_command;
|
||||
}
|
||||
|
||||
void SnapRunConfiguration::setCommand(const QString &command)
|
||||
{
|
||||
if (command != m_command) {
|
||||
m_command = command;
|
||||
emit enabledChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool SnapRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!ProjectExplorer::RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
m_command = map.value(COMMAND_KEY, QString()).toString();
|
||||
return true;
|
||||
}
|
||||
|
||||
QVariantMap SnapRunConfiguration::toMap() const
|
||||
{
|
||||
QVariantMap map = ProjectExplorer::RunConfiguration::toMap();
|
||||
map.insert(COMMAND_KEY, m_command);
|
||||
return map;
|
||||
}
|
||||
|
||||
bool SnapRunConfiguration::isEnabled() const
|
||||
{
|
||||
return !m_command.isEmpty();
|
||||
}
|
||||
|
||||
QString SnapRunConfiguration::disabledReason() const
|
||||
{
|
||||
return tr("Please select a command to run in the runconfiguration.");
|
||||
}
|
||||
|
||||
QWidget *SnapRunConfiguration::createConfigurationWidget()
|
||||
{
|
||||
return new SnapRunConfigurationWidget(this);
|
||||
}
|
||||
|
||||
ProjectExplorer::Runnable SnapRunConfiguration::runnable() const
|
||||
{
|
||||
SnapcraftStep *pckStep = activeSnapcraftStep();
|
||||
if (!pckStep) {
|
||||
return ProjectExplorer::Runnable();
|
||||
}
|
||||
|
||||
Utils::FileName packagePath = pckStep->packagePath();
|
||||
if(packagePath.isEmpty()) {
|
||||
return ProjectExplorer::Runnable();
|
||||
}
|
||||
|
||||
qDebug()<<"Going to run "<<packagePath.toUserOutput();
|
||||
|
||||
QStringList args{
|
||||
packagePath.toUserOutput(),
|
||||
m_command
|
||||
};
|
||||
|
||||
ProjectExplorer::StandardRunnable r;
|
||||
r.executable = Utils::FileName::fromString(Constants::UBUNTU_SCRIPTPATH).appendPath(QStringLiteral("qtc_desktop_snaprunner.py")).toString();;
|
||||
r.workingDirectory = m_workingDirectoryAspect->workingDirectory().toString();
|
||||
r.environment = m_localEnvironmentAspect->environment();
|
||||
r.commandLineArguments = Utils::QtcProcess::joinArgs(args);
|
||||
if (!m_argumentAspect->arguments().isEmpty()) {
|
||||
r.commandLineArguments.append(QStringLiteral(" -- %1").arg(m_argumentAspect->arguments()));
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
SnapcraftStep *SnapRunConfiguration::activeSnapcraftStep() const
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *buildConf = activeBuildConfiguration();
|
||||
if(!buildConf)
|
||||
return nullptr;
|
||||
|
||||
ProjectExplorer::BuildStepList *bsList = buildConf->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
for(ProjectExplorer::BuildStep *currStep : bsList->steps()) {
|
||||
SnapcraftStep *pckStep = qobject_cast<SnapcraftStep*>(currStep);
|
||||
if(pckStep)
|
||||
return pckStep;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SnapRunConfiguration::updateConfiguration()
|
||||
{
|
||||
if(m_currBuildConfConn)
|
||||
disconnect(m_currBuildConfConn);
|
||||
|
||||
m_currBuildConfConn = connect(activeSnapcraftStep(), &SnapcraftStep::packagePathChanged,
|
||||
this, &ProjectExplorer::RunConfiguration::requestRunActionsUpdate);
|
||||
|
||||
}
|
||||
|
||||
SnapRunConfigurationWidget::SnapRunConfigurationWidget(SnapRunConfiguration *config)
|
||||
: QWidget (nullptr),
|
||||
m_rc(config),
|
||||
m_updating(false)
|
||||
{
|
||||
QFormLayout *layout = new QFormLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
m_commandsBox = new QComboBox(this);
|
||||
updateComboBox();
|
||||
|
||||
connect(m_commandsBox, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(commandSelected(int)));
|
||||
|
||||
int idx = m_commandsBox->findText(config->command());
|
||||
if (idx >= 0)
|
||||
m_commandsBox->setCurrentIndex(idx);
|
||||
|
||||
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);
|
||||
|
||||
if(config->target()) {
|
||||
connect(qobject_cast<SnapcraftProject*>(config->target()->project()), &SnapcraftProject::commandListChanged,
|
||||
this, &SnapRunConfigurationWidget::updateComboBox);
|
||||
}
|
||||
}
|
||||
|
||||
void SnapRunConfigurationWidget::updateComboBox()
|
||||
{
|
||||
QString currItem = m_rc->command();
|
||||
|
||||
//TODO check if project is still loading, so we do not override something we need
|
||||
|
||||
m_updating = true;
|
||||
m_commandsBox->clear();
|
||||
m_commandsBox->addItem(QString());
|
||||
if(m_rc && m_rc->target()) {
|
||||
SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(m_rc->target()->project());
|
||||
if (pro) {
|
||||
QStringList comms = pro->commands();
|
||||
m_commandsBox->addItems(comms);
|
||||
}
|
||||
}
|
||||
m_updating = false;
|
||||
|
||||
int idx = m_commandsBox->findText(currItem);
|
||||
if (idx <= 0 && m_commandsBox->count() > 1)
|
||||
m_commandsBox->setCurrentIndex(1);
|
||||
else if (idx > 0)
|
||||
m_commandsBox->setCurrentIndex(idx);
|
||||
else
|
||||
m_commandsBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void SnapRunConfigurationWidget::commandSelected(const int index)
|
||||
{
|
||||
if(m_updating)
|
||||
return;
|
||||
|
||||
if(index == 0)
|
||||
m_rc->setCommand(QString());
|
||||
else
|
||||
m_rc->setCommand(m_commandsBox->itemText(index));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ubuntu
|
||||
87
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h
vendored
Normal file
87
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
#ifndef UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H
|
||||
#define UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H
|
||||
|
||||
#include "snaprunconfigurationfactory.h"
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
class QComboBox;
|
||||
|
||||
namespace Utils {
|
||||
class PathChooser;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class WorkingDirectoryAspect;
|
||||
class ArgumentsAspect;
|
||||
class TerminalAspect;
|
||||
class LocalEnvironmentAspect;
|
||||
}
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
class SnapcraftStep;
|
||||
|
||||
class SnapRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class SnapRunConfigurationFactory;
|
||||
protected:
|
||||
SnapRunConfiguration(ProjectExplorer::Target *parent);
|
||||
SnapRunConfiguration(ProjectExplorer::Target *parent, SnapRunConfiguration *source);
|
||||
|
||||
public:
|
||||
|
||||
QString command () const;
|
||||
void setCommand (const QString &command);
|
||||
|
||||
// ProjectConfiguration interface
|
||||
virtual bool fromMap(const QVariantMap &map) override;
|
||||
virtual QVariantMap toMap() const override;
|
||||
|
||||
// RunConfiguration interface
|
||||
virtual bool isEnabled() const override;
|
||||
virtual QString disabledReason() const override;
|
||||
virtual QWidget *createConfigurationWidget() override;
|
||||
virtual ProjectExplorer::Runnable runnable() const override;
|
||||
|
||||
private:
|
||||
SnapcraftStep *activeSnapcraftStep() const;
|
||||
void updateCommandList(const QStringList &commands);
|
||||
void updateConfiguration();
|
||||
|
||||
private:
|
||||
QString m_command;
|
||||
QMetaObject::Connection m_currBuildConfConn;
|
||||
ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect;
|
||||
ProjectExplorer::ArgumentsAspect* m_argumentAspect;
|
||||
ProjectExplorer::TerminalAspect* m_terminalAspect;
|
||||
ProjectExplorer::LocalEnvironmentAspect* m_localEnvironmentAspect;
|
||||
};
|
||||
|
||||
class SnapRunConfigurationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SnapRunConfigurationWidget(SnapRunConfiguration *config);
|
||||
|
||||
protected:
|
||||
void updateComboBox ();
|
||||
|
||||
protected slots:
|
||||
void commandSelected (const int index);
|
||||
|
||||
private:
|
||||
SnapRunConfiguration *m_rc;
|
||||
QComboBox *m_commandsBox;
|
||||
bool m_updating;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ubuntu
|
||||
|
||||
#endif // UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H
|
||||
85
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp
vendored
Normal file
85
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
#include "snaprunconfigurationfactory.h"
|
||||
#include "snaprunconfiguration.h"
|
||||
#include "snapcraftproject.h"
|
||||
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
SnapRunConfigurationFactory::SnapRunConfigurationFactory()
|
||||
{
|
||||
setObjectName(QStringLiteral("SnapRunConfigurationFactory"));
|
||||
}
|
||||
|
||||
QList<Core::Id> SnapRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent,
|
||||
ProjectExplorer::IRunConfigurationFactory::CreationMode mode) const
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
|
||||
if (!parent)
|
||||
return {};
|
||||
if (!qobject_cast<SnapcraftProject *>(parent->project()))
|
||||
return {};
|
||||
|
||||
return {
|
||||
Constants::SNAP_RUNCONFIGURATION_ID
|
||||
};
|
||||
}
|
||||
|
||||
QString SnapRunConfigurationFactory::displayNameForId(Core::Id id) const
|
||||
{
|
||||
if (id == Constants::SNAP_RUNCONFIGURATION_ID)
|
||||
return tr("Snapcraft Runconfiguration");
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool SnapRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, Core::Id id) const
|
||||
{
|
||||
return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(id);
|
||||
}
|
||||
|
||||
bool SnapRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
|
||||
{
|
||||
return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(ProjectExplorer::idFromMap(map));
|
||||
}
|
||||
|
||||
bool SnapRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const
|
||||
{
|
||||
return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(product->id());
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product)
|
||||
{
|
||||
QTC_ASSERT(canClone(parent, product), return nullptr);
|
||||
return new SnapRunConfiguration(parent, static_cast<SnapRunConfiguration *>(product));
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id)
|
||||
{
|
||||
QTC_ASSERT(canCreate(parent, id), return nullptr);
|
||||
if (id == Constants::SNAP_RUNCONFIGURATION_ID)
|
||||
return new SnapRunConfiguration(parent);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, const QVariantMap &map)
|
||||
{
|
||||
QTC_ASSERT(canRestore(parent, map), return nullptr);
|
||||
|
||||
SnapRunConfiguration *conf = new SnapRunConfiguration(parent);
|
||||
if (conf->fromMap(map))
|
||||
return conf;
|
||||
|
||||
//something went wrong
|
||||
delete conf;
|
||||
return nullptr;
|
||||
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ubuntu
|
||||
31
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h
vendored
Normal file
31
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H
|
||||
#define UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
class SnapRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
|
||||
SnapRunConfigurationFactory();
|
||||
|
||||
// IRunConfigurationFactory interface
|
||||
virtual QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const override;
|
||||
virtual QString displayNameForId(Core::Id id) const override;
|
||||
virtual bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
|
||||
virtual bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
|
||||
virtual bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const override;
|
||||
virtual ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) override;
|
||||
|
||||
private:
|
||||
virtual ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id) override;
|
||||
virtual ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Ubuntu
|
||||
|
||||
#endif // UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H
|
||||
@@ -11,7 +11,9 @@ SOURCES += \
|
||||
$$PWD/project/snapcraftrsyncstep.cpp \
|
||||
$$PWD/project/snapcraftstep.cpp \
|
||||
$$PWD/project/snapcraftbuildstepfactory.cpp \
|
||||
$$PWD/settings/snapcraftkitinformation.cpp
|
||||
$$PWD/settings/snapcraftkitinformation.cpp \
|
||||
$$PWD/project/snaprunconfiguration.cpp \
|
||||
$$PWD/project/snaprunconfigurationfactory.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/project/snapcraftproject.h \
|
||||
@@ -23,5 +25,7 @@ HEADERS += \
|
||||
$$PWD/project/snapcraftrsyncstep.h \
|
||||
$$PWD/project/snapcraftstep.h \
|
||||
$$PWD/project/snapcraftbuildstepfactory.h \
|
||||
$$PWD/settings/snapcraftkitinformation.h
|
||||
$$PWD/settings/snapcraftkitinformation.h \
|
||||
$$PWD/project/snaprunconfiguration.h \
|
||||
$$PWD/project/snaprunconfigurationfactory.h
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
|
||||
static const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
|
||||
|
||||
SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl)
|
||||
: ProjectExplorer::BuildStep (bsl, Constants::UBUNTU_SNAP_PACKAGESTEP_ID)
|
||||
|
||||
@@ -260,23 +260,21 @@ const char FEATURE_UBUNTU_SAUCY[] = "Ubuntu.Wizards.FeatureUbuntuSaucy";
|
||||
const char FEATURE_UBUNTU_TRUSTY[] = "Ubuntu.Wizards.FeatureUbuntuTrusty";
|
||||
const char FEATURE_UBUNTU_UTOPIC[] = "Ubuntu.Wizards.FeatureUbuntuUtopic";
|
||||
|
||||
const char DISTRIB_ID[] = "DISTRIB_ID=";
|
||||
const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME=";
|
||||
const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE=";
|
||||
const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION=";
|
||||
const char LSB_RELEASE[] = "/etc/lsb-release";
|
||||
|
||||
const char PRECISE[] = "precise";
|
||||
const char QUANTAL[] = "quantal";
|
||||
const char RARING[] = "raring";
|
||||
const char SAUCY[] = "saucy";
|
||||
const char TRUSTY[] = "trusty";
|
||||
const char UTOPIC[] = "utopic";
|
||||
|
||||
const char PLATFORM_DESKTOP[] = "Desktop";
|
||||
const char PLATFORM_DESKTOP_DISPLAYNAME[] = "Ubuntu %0";
|
||||
|
||||
const QString PRECISE (QStringLiteral("precise"));
|
||||
const QString QUANTAL (QStringLiteral("quantal"));
|
||||
const QString RARING (QStringLiteral("raring"));
|
||||
const QString SAUCY (QStringLiteral("saucy"));
|
||||
const QString TRUSTY (QStringLiteral("trusty"));
|
||||
const QString UTOPIC (QStringLiteral("utopic"));
|
||||
const QString VIVID (QStringLiteral("vivid"));
|
||||
const QString WILY (QStringLiteral("wily"));
|
||||
*/
|
||||
|
||||
const QString XENIAL (QStringLiteral("xenial"));
|
||||
|
||||
const char TASK_DEVICE_SCRIPT[] = "Ubuntu.Task.DeviceScript";
|
||||
|
||||
const char UBUNTU_SETTINGS_ICON[] = ":/ubuntu/images/ubuntu-32.png";
|
||||
@@ -400,6 +398,7 @@ const char SNAPCRAFT_PROJECT_PROJECTCONTEXT[] = "SnapcraftProject.ProjectContext
|
||||
const char SNAPCRAFT_BUILDCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapcraftBuildconfiguration.Id";
|
||||
const char SNAPCRAFT_RSYNCBUILSSTEP_ID[] = "SnapcraftProjectManager.SnapcraftRsyncStep.Id";
|
||||
const char SNAPCRAFT_BUILDSTEP_ID[] = "SnapcraftProjectManager.SnapcraftStep.Id";
|
||||
const char SNAP_RUNCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapRunConfiguration.Id";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
*
|
||||
* Author: Benjamin Zeller <benjamin.zeller@canonical.com>
|
||||
*/
|
||||
|
||||
#include "ubuntujsextension.h"
|
||||
#include <ubuntu/ubuntubzr.h>
|
||||
#include <ubuntu/ubuntuversion.h>
|
||||
#include <ubuntu/ubuntuconstants.h>
|
||||
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
@@ -43,4 +46,12 @@ QString UbuntuJsExtension::developerId() const
|
||||
return maintainer;
|
||||
}
|
||||
|
||||
bool UbuntuJsExtension::supportsSnappy() const
|
||||
{
|
||||
UbuntuVersion *v = UbuntuVersion::instance();
|
||||
if (v->isValid())
|
||||
return v->supportsSnappy();
|
||||
return false;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
explicit UbuntuJsExtension(QObject *parent = 0);
|
||||
|
||||
Q_INVOKABLE QString developerId() const;
|
||||
Q_INVOKABLE bool supportsSnappy() const;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -52,11 +52,13 @@
|
||||
#include <ubuntu/wizards/ubuntuprojectapplicationwizard.h>
|
||||
#include <ubuntu/wizards/ubuntufirstrunwizard.h>
|
||||
#include <ubuntu/wizards/ubuntuprojectmigrationwizard.h>
|
||||
#include <ubuntu/ubuntuversion.h>
|
||||
|
||||
#include <ubuntu/snap/project/snapcraftprojectmanager.h>
|
||||
#include <ubuntu/snap/project/snapcraftbuildconfigurationfactory.h>
|
||||
#include <ubuntu/snap/project/snapcraftbuildstepfactory.h>
|
||||
#include <ubuntu/snap/settings/snapcraftkitinformation.h>
|
||||
#include <ubuntu/snap/project/snaprunconfiguration.h>
|
||||
|
||||
#include "ubuntujsextension.h"
|
||||
|
||||
@@ -181,11 +183,14 @@ bool UbuntuPlugin::initialize(const QStringList &arguments, QString *errorString
|
||||
addAutoReleasedObject(new UbuntuLocalRunControlFactory);
|
||||
|
||||
|
||||
addAutoReleasedObject(new SnapcraftProjectManager);
|
||||
addAutoReleasedObject(new SnapcraftBuildConfigurationFactory);
|
||||
addAutoReleasedObject(new SnapcraftBuildStepFactory);
|
||||
if (UbuntuVersion::instance()->supportsSnappy()) {
|
||||
addAutoReleasedObject(new SnapcraftProjectManager);
|
||||
addAutoReleasedObject(new SnapcraftBuildConfigurationFactory);
|
||||
addAutoReleasedObject(new SnapcraftBuildStepFactory);
|
||||
addAutoReleasedObject(new SnapRunConfigurationFactory);
|
||||
|
||||
ProjectExplorer::KitManager::registerKitInformation(new SnapcraftKitInformation);
|
||||
ProjectExplorer::KitManager::registerKitInformation(new SnapcraftKitInformation);
|
||||
}
|
||||
|
||||
// Build support
|
||||
addAutoReleasedObject(new ClickToolChainFactory);
|
||||
|
||||
@@ -21,61 +21,59 @@
|
||||
#include <QFile>
|
||||
#include <QStringList>
|
||||
|
||||
using namespace Ubuntu::Internal;
|
||||
namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
Q_GLOBAL_STATIC(UbuntuVersion, g_instance);
|
||||
|
||||
const char DISTRIB_ID[] = "DISTRIB_ID=";
|
||||
const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME=";
|
||||
const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE=";
|
||||
const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION=";
|
||||
const char LSB_RELEASE[] = "/etc/lsb-release";
|
||||
|
||||
UbuntuVersion::UbuntuVersion()
|
||||
{
|
||||
|
||||
initFromLsbFile();
|
||||
}
|
||||
|
||||
Core::FeatureSet UbuntuVersion::features() {
|
||||
Core::FeatureSet retval;
|
||||
|
||||
QString cName = codename();
|
||||
if (cName==QLatin1String(Constants::PRECISE)) {
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_PRECISE);
|
||||
} else if (cName==QLatin1String(Constants::QUANTAL)) {
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_QUANTAL);
|
||||
} else if (cName==QLatin1String(Constants::RARING)) {
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_RARING);
|
||||
} else if (cName==QLatin1String(Constants::SAUCY)) {
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_SAUCY);
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE);
|
||||
} else if (cName==QLatin1String(Constants::TRUSTY)) {
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_TRUSTY);
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE);
|
||||
} else if (cName==QLatin1String(Constants::UTOPIC)) {
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_UTOPIC);
|
||||
retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
UbuntuVersion *UbuntuVersion::fromLsbFile(const QString &fileName)
|
||||
bool UbuntuVersion::supportsSnappy() const
|
||||
{
|
||||
QFile lsbRelease(fileName);
|
||||
if (m_valid)
|
||||
return codename() == Constants::XENIAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
UbuntuVersion *UbuntuVersion::instance()
|
||||
{
|
||||
return g_instance();
|
||||
}
|
||||
|
||||
void UbuntuVersion::initFromLsbFile()
|
||||
{
|
||||
QFile lsbRelease(QString::fromLatin1(LSB_RELEASE));
|
||||
if (lsbRelease.open(QIODevice::ReadOnly)) {
|
||||
QByteArray data = lsbRelease.readAll();
|
||||
lsbRelease.close();
|
||||
|
||||
UbuntuVersion *ver = new UbuntuVersion;
|
||||
|
||||
foreach(QString line, QString::fromLatin1(data).split(QLatin1String("\n"))) {
|
||||
if (line.startsWith(QLatin1String(Constants::DISTRIB_ID))) {
|
||||
ver->m_id = line.replace(QLatin1String(Constants::DISTRIB_ID),QLatin1String(""));
|
||||
if (line.startsWith(QLatin1String(DISTRIB_ID))) {
|
||||
m_id = line.replace(QLatin1String(DISTRIB_ID),QLatin1String(""));
|
||||
|
||||
} else if (line.startsWith(QLatin1String(Constants::DISTRIB_RELEASE))) {
|
||||
ver->m_release = line.replace(QLatin1String(Constants::DISTRIB_RELEASE),QLatin1String(""));
|
||||
} else if (line.startsWith(QLatin1String(DISTRIB_RELEASE))) {
|
||||
m_release = line.replace(QLatin1String(DISTRIB_RELEASE),QLatin1String(""));
|
||||
|
||||
} else if (line.startsWith(QLatin1String(Constants::DISTRIB_CODENAME))) {
|
||||
ver->m_codename = line.replace(QLatin1String(Constants::DISTRIB_CODENAME),QLatin1String(""));
|
||||
} else if (line.startsWith(QLatin1String(DISTRIB_CODENAME))) {
|
||||
m_codename = line.replace(QLatin1String(DISTRIB_CODENAME),QLatin1String(""));
|
||||
|
||||
} else if (line.startsWith(QLatin1String(Constants::DISTRIB_DESCRIPTION))) {
|
||||
ver->m_description = line.replace(QLatin1String(Constants::DISTRIB_DESCRIPTION),QLatin1String(""));
|
||||
} else if (line.startsWith(QLatin1String(DISTRIB_DESCRIPTION))) {
|
||||
m_description = line.replace(QLatin1String(DISTRIB_DESCRIPTION),QLatin1String(""));
|
||||
}
|
||||
}
|
||||
|
||||
return ver;
|
||||
m_valid = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -27,28 +27,30 @@ namespace Ubuntu {
|
||||
namespace Internal {
|
||||
|
||||
|
||||
class UbuntuVersion : public QObject
|
||||
class UbuntuVersion
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UbuntuVersion();
|
||||
|
||||
public slots:
|
||||
QString id() { return m_id; }
|
||||
QString release() { return m_release; }
|
||||
QString codename() { return m_codename; }
|
||||
QString description() { return m_description; }
|
||||
bool isValid () const { return m_valid; }
|
||||
QString id() const { return m_id; }
|
||||
QString release() const { return m_release; }
|
||||
QString codename() const { return m_codename; }
|
||||
QString description() const { return m_description; }
|
||||
bool supportsSnappy () const;
|
||||
|
||||
Core::FeatureSet features();
|
||||
static UbuntuVersion *instance( );
|
||||
|
||||
static UbuntuVersion *fromLsbFile( const QString &fileName );
|
||||
protected:
|
||||
void initFromLsbFile( );
|
||||
|
||||
protected:
|
||||
QString m_id;
|
||||
QString m_release;
|
||||
QString m_codename;
|
||||
QString m_description;
|
||||
bool m_valid = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user