Merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-run into lp:ubuntu-sdk-ide

Proposed by Benjamin Zeller on 2016-11-07
Status: Merged
Approved by: Zoltan Balogh on 2016-11-07
Approved revision: 167
Merged at revision: 165
Proposed branch: lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-run
Merge into: lp:ubuntu-sdk-ide
Diff against target: 1902 lines (+1084/-159)
27 files modified
debian/patches/cmake_ubuntuspecificbits.diff (+192/-50)
dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro (+2/-2)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml (+1/-1)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json (+2/-2)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py (+84/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py (+22/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp (+21/-1)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h (+1/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp (+4/-1)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp (+9/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp (+63/-5)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h (+14/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp (+38/-19)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp (+74/-2)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h (+17/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp (+241/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h (+87/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp (+85/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h (+31/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri (+6/-2)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp (+1/-1)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h (+12/-13)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp (+11/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h (+1/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp (+9/-4)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp (+43/-45)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h (+13/-11)
To merge this branch: bzr merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-run
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-11-07
Zoltan Balogh (community) 2016-11-07 Approve on 2016-11-07
Review via email: mp+310172@code.launchpad.net

Commit message

- Support running snapcraft projects from the IDE
- Patch RunControlFactories to disable unwanted RC modes for snapcraft projects

Description of the change

- Support running snapcraft projects from the IDE
- Patch RunControlFactories to disable unwanted RC modes for snapcraft projects

To post a comment you must log in.
review: Approve (continuous-integration)
Zoltan Balogh (bzoltan) wrote :

let's see it

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/patches/cmake_ubuntuspecificbits.diff'
--- debian/patches/cmake_ubuntuspecificbits.diff 2016-09-22 16:11:03 +0000
+++ debian/patches/cmake_ubuntuspecificbits.diff 2016-11-07 11:20:39 +0000
@@ -1,6 +1,8 @@
1--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp1Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
2+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp2===================================================================
3@@ -165,10 +165,10 @@3--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
4+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
5@@ -165,10 +165,10 @@ void CMakeManager::createXmlFile(Utils::
4 proc->setWorkingDirectory(buildDirectoryPath);6 proc->setWorkingDirectory(buildDirectoryPath);
5 proc->setEnvironment(env);7 proc->setEnvironment(env);
6 8
@@ -14,9 +16,11 @@
14 Utils::QtcProcess::addArgs(&args, arguments);16 Utils::QtcProcess::addArgs(&args, arguments);
15 17
16 proc->setCommand(executable, args);18 proc->setCommand(executable, args);
17--- a/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp19Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
18+++ b/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp20===================================================================
19@@ -288,9 +288,10 @@21--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
22+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
23@@ -288,9 +288,10 @@ Internal::Manager *QmlProject::projectMa
20 bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const24 bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const
21 {25 {
22 Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);26 Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);
@@ -29,9 +33,11 @@
29 return false;33 return false;
30 }34 }
31 35
32--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp36Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
33+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp37===================================================================
34@@ -2024,6 +2024,7 @@38--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
39+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
40@@ -2024,6 +2024,7 @@ EvalResult *QmakeProFileNode::evaluate(c
35 result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS"));41 result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS"));
36 result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS"));42 result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS"));
37 result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME"));43 result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME"));
@@ -39,9 +45,11 @@
39 45
40 result->isDeployable = false;46 result->isDeployable = false;
41 if (result->projectType == ApplicationTemplate) {47 if (result->projectType == ApplicationTemplate) {
42--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h48Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
43+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h49===================================================================
44@@ -107,7 +107,8 @@50--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
51+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
52@@ -107,7 +107,8 @@ enum QmakeVariable {
45 AndroidPackageSourceDir,53 AndroidPackageSourceDir,
46 AndroidExtraLibs,54 AndroidExtraLibs,
47 IsoIconsVar,55 IsoIconsVar,
@@ -51,8 +59,10 @@
51 };59 };
52 60
53 namespace Internal {61 namespace Internal {
54--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h62Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
55+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h63===================================================================
64--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
65+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
56@@ -25,6 +25,8 @@66@@ -25,6 +25,8 @@
57 67
58 #pragma once68 #pragma once
@@ -62,7 +72,7 @@
62 #include <QByteArray>72 #include <QByteArray>
63 #include <QList>73 #include <QList>
64 74
65@@ -34,7 +36,7 @@75@@ -34,7 +36,7 @@ namespace ProjectExplorer { class Kit; }
66 76
67 namespace CMakeProjectManager {77 namespace CMakeProjectManager {
68 78
@@ -71,9 +81,11 @@
71 public:81 public:
72 enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC };82 enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC };
73 CMakeConfigItem();83 CMakeConfigItem();
74--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp84Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
75+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp85===================================================================
76@@ -568,6 +568,11 @@86--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
87+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
88@@ -568,6 +568,11 @@ bool QtVersionManager::isValidId(int id)
77 return m_versions.contains(id);89 return m_versions.contains(id);
78 }90 }
79 91
@@ -85,9 +97,11 @@
85 BaseQtVersion *QtVersionManager::version(int id)97 BaseQtVersion *QtVersionManager::version(int id)
86 {98 {
87 QTC_ASSERT(isLoaded(), return 0);99 QTC_ASSERT(isLoaded(), return 0);
88--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h100Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
89+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h101===================================================================
90@@ -63,6 +63,7 @@102--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
103+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
104@@ -63,6 +63,7 @@ public:
91 static void removeVersion(BaseQtVersion *version);105 static void removeVersion(BaseQtVersion *version);
92 106
93 static bool isValidId(int id);107 static bool isValidId(int id);
@@ -95,9 +109,11 @@
95 109
96 signals:110 signals:
97 // content of BaseQtVersion objects with qmake path might have changed111 // content of BaseQtVersion objects with qmake path might have changed
98--- a/dist/qtcreator/src/plugins/plugins.pro112Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
99+++ b/dist/qtcreator/src/plugins/plugins.pro113===================================================================
100@@ -56,7 +56,8 @@114--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/plugins.pro
115+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
116@@ -56,7 +56,8 @@ SUBDIRS = \
101 winrt \117 winrt \
102 qmlprofiler \118 qmlprofiler \
103 updateinfo \119 updateinfo \
@@ -107,9 +123,11 @@
107 123
108 DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)124 DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)
109 isEmpty(DO_NOT_BUILD_QMLDESIGNER) {125 isEmpty(DO_NOT_BUILD_QMLDESIGNER) {
110--- a/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro126Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
111+++ b/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro127===================================================================
112@@ -11,10 +11,10 @@128--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
129+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
130@@ -11,10 +11,10 @@ load(qt_parts)
113 src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher131 src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher
114 src_uitk_launcher.depends = sub-src132 src_uitk_launcher.depends = sub-src
115 133
@@ -123,9 +141,11 @@
123 141
124 # additional 'make test' target required by continuous integration system142 # additional 'make test' target required by continuous integration system
125 test.target = test143 test.target = test
126--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp144Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
127+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp145===================================================================
128@@ -387,6 +387,18 @@146--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
147+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
148@@ -387,6 +387,18 @@ void CMakeProject::runCMake()
129 }149 }
130 }150 }
131 151
@@ -144,8 +164,10 @@
144 QList<CMakeBuildTarget> CMakeProject::buildTargets() const164 QList<CMakeBuildTarget> CMakeProject::buildTargets() const
145 {165 {
146 BuildDirManager *bdm = nullptr;166 BuildDirManager *bdm = nullptr;
147--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h167Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
148+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h168===================================================================
169--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
170+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
149@@ -27,6 +27,7 @@171@@ -27,6 +27,7 @@
150 172
151 #include "cmake_global.h"173 #include "cmake_global.h"
@@ -154,7 +176,7 @@
154 176
155 #include <projectexplorer/extracompiler.h>177 #include <projectexplorer/extracompiler.h>
156 #include <projectexplorer/project.h>178 #include <projectexplorer/project.h>
157@@ -111,6 +112,8 @@179@@ -111,6 +112,8 @@ public:
158 180
159 void runCMake();181 void runCMake();
160 182
@@ -163,9 +185,11 @@
163 signals:185 signals:
164 /// emitted when cmake is running:186 /// emitted when cmake is running:
165 void parsingStarted();187 void parsingStarted();
166--- a/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp188Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
167+++ b/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp189===================================================================
168@@ -249,11 +249,11 @@190--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
191+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
192@@ -249,11 +249,11 @@ PlatformMenuWrapper::PlatformMenuWrapper
169 , m_target(target)193 , m_target(target)
170 , m_inserted(false)194 , m_inserted(false)
171 {195 {
@@ -182,9 +206,11 @@
182 206
183 syncPlatformMenu();207 syncPlatformMenu();
184 }208 }
185--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp209Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
186+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp210===================================================================
187@@ -161,6 +161,12 @@211--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
212+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
213@@ -161,6 +161,12 @@ bool GeneratedFile::write(QString *error
188 214
189 Utils::FileSaver saver(m_d->path, flags);215 Utils::FileSaver saver(m_d->path, flags);
190 saver.write(m_d->contents);216 saver.write(m_d->contents);
@@ -197,9 +223,11 @@
197 return saver.finalize(errorMessage);223 return saver.finalize(errorMessage);
198 }224 }
199 225
200--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.h226Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
201+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.h227===================================================================
202@@ -46,7 +46,9 @@228--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
229+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
230@@ -46,7 +46,9 @@ public:
203 /* File exists and the user indicated that he wants to keep it */231 /* File exists and the user indicated that he wants to keep it */
204 KeepExistingFileAttribute = 0x8,232 KeepExistingFileAttribute = 0x8,
205 /* Force overwriting of a file without asking the user to keep it */233 /* Force overwriting of a file without asking the user to keep it */
@@ -210,9 +238,11 @@
210 };238 };
211 Q_DECLARE_FLAGS(Attributes, Attribute)239 Q_DECLARE_FLAGS(Attributes, Attribute)
212 240
213--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp241Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
214+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp242===================================================================
215@@ -70,6 +70,7 @@243--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
244+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
245@@ -70,6 +70,7 @@ bool JsonWizardFileGenerator::setup(cons
216 f.overwrite = tmp.value(QLatin1String("overwrite"), false);246 f.overwrite = tmp.value(QLatin1String("overwrite"), false);
217 f.openInEditor = tmp.value(QLatin1String("openInEditor"), false);247 f.openInEditor = tmp.value(QLatin1String("openInEditor"), false);
218 f.openAsProject = tmp.value(QLatin1String("openAsProject"), false);248 f.openAsProject = tmp.value(QLatin1String("openAsProject"), false);
@@ -220,7 +250,7 @@
220 250
221 f.options = JsonWizard::parseOptions(tmp.value(QLatin1String("options")), errorMessage);251 f.options = JsonWizard::parseOptions(tmp.value(QLatin1String("options")), errorMessage);
222 if (!errorMessage->isEmpty())252 if (!errorMessage->isEmpty())
223@@ -146,6 +147,8 @@253@@ -146,6 +147,8 @@ Core::GeneratedFile JsonWizardFileGenera
224 attributes |= Core::GeneratedFile::OpenProjectAttribute;254 attributes |= Core::GeneratedFile::OpenProjectAttribute;
225 if (JsonWizard::boolFromVariant(file.overwrite, expander))255 if (JsonWizard::boolFromVariant(file.overwrite, expander))
226 attributes |= Core::GeneratedFile::ForceOverwrite;256 attributes |= Core::GeneratedFile::ForceOverwrite;
@@ -229,7 +259,7 @@
229 259
230 if (file.keepExisting)260 if (file.keepExisting)
231 attributes |= Core::GeneratedFile::KeepExistingFileAttribute;261 attributes |= Core::GeneratedFile::KeepExistingFileAttribute;
232@@ -231,6 +234,7 @@262@@ -231,6 +234,7 @@ bool JsonWizardFileGenerator::writeFile(
233 if (!file->write(errorMessage))263 if (!file->write(errorMessage))
234 return false;264 return false;
235 }265 }
@@ -237,9 +267,11 @@
237 return true;267 return true;
238 }268 }
239 269
240--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h270Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
241+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h271===================================================================
242@@ -55,6 +55,7 @@272--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
273+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
274@@ -55,6 +55,7 @@ private:
243 QVariant overwrite = false;275 QVariant overwrite = false;
244 QVariant openInEditor = false;276 QVariant openInEditor = false;
245 QVariant openAsProject = false;277 QVariant openAsProject = false;
@@ -247,3 +279,113 @@
247 279
248 QList<JsonWizard::OptionDefinition> options;280 QList<JsonWizard::OptionDefinition> options;
249 };281 };
282Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp
283===================================================================
284--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp
285+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp
286@@ -987,17 +987,20 @@ public:
287 bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const override
288 {
289 Q_UNUSED(runConfiguration);
290+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
291 return runMode == CALLGRIND_RUN_MODE;
292 }
293
294 RunControl *create(RunConfiguration *runConfiguration, Core::Id runMode, QString *errorMessage) override
295 {
296 Q_UNUSED(errorMessage);
297+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
298 return m_tool->createRunControl(runConfiguration, runMode);
299 }
300
301 IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override
302 {
303+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
304 return createValgrindRunConfigurationAspect(rc);
305 }
306
307Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp
308===================================================================
309--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp
310+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp
311@@ -553,6 +553,8 @@ public:
312 QTC_ASSERT(runConfig, return 0);
313 QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0);
314
315+ if (runConfig->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
316+
317 // We cover only local setup here. Remote setups are handled by the
318 // RunControl factories in the target specific plugins.
319 QStringList errors;
320@@ -568,6 +570,8 @@ public:
321 if (!(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain))
322 return false;
323
324+ if (runConfig->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
325+
326 Runnable runnable = runConfig->runnable();
327 if (runnable.is<StandardRunnable>()) {
328 IDevice::ConstPtr device = runnable.as<StandardRunnable>().device;
329@@ -582,6 +586,7 @@ public:
330
331 IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override
332 {
333+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
334 return new DebuggerRunConfigurationAspect(rc);
335 }
336 };
337Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp
338===================================================================
339--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp
340+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp
341@@ -703,17 +703,20 @@ public:
342 bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const override
343 {
344 Q_UNUSED(runConfiguration);
345+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
346 return mode == MEMCHECK_RUN_MODE || mode == MEMCHECK_WITH_GDB_RUN_MODE;
347 }
348
349 RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) override
350 {
351 Q_UNUSED(errorMessage);
352+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
353 return m_tool->createRunControl(runConfiguration, mode);
354 }
355
356 IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override
357 {
358+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
359 return createValgrindRunConfigurationAspect(rc);
360 }
361
362Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
363===================================================================
364--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
365+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp
366@@ -65,6 +65,7 @@ QmlProfilerRunControlFactory::QmlProfile
367
368 bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const
369 {
370+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false;
371 return mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE && isLocal(runConfiguration);
372 }
373
374@@ -72,6 +73,9 @@ RunControl *QmlProfilerRunControlFactory
375 {
376 QTC_ASSERT(canRun(runConfiguration, mode), return 0);
377 QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
378+
379+ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
380+
381 auto runnable = runConfiguration->runnable().as<StandardRunnable>();
382
383 if (runnable.executable.isEmpty()) {
384@@ -114,6 +118,7 @@ RunControl *QmlProfilerRunControlFactory
385 ProjectExplorer::IRunConfigurationAspect *
386 QmlProfilerRunControlFactory::createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc)
387 {
388+ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr;
389 return new QmlProfilerRunConfigurationAspect(rc);
390 }
391
250392
=== modified file 'dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro'
--- dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-11-07 11:20:39 +0000
@@ -52,7 +52,7 @@
52 src/ubuntu/ubuntuproject.cpp \52 src/ubuntu/ubuntuproject.cpp \
53 src/ubuntu/ubuntuprojectfile.cpp \53 src/ubuntu/ubuntuprojectfile.cpp \
54 src/ubuntu/ubuntuprojectnode.cpp \54 src/ubuntu/ubuntuprojectnode.cpp \
55 #src/ubuntu/ubuntuversion.cpp \55 src/ubuntu/ubuntuversion.cpp \
56 #src/ubuntu/ubuntufeatureprovider.cpp \56 #src/ubuntu/ubuntufeatureprovider.cpp \
57 #src/ubuntu/ubuntuversionmanager.cpp \57 #src/ubuntu/ubuntuversionmanager.cpp \
58 src/ubuntu/ubuntupackagingmode.cpp \58 src/ubuntu/ubuntupackagingmode.cpp \
@@ -123,7 +123,7 @@
123 src/ubuntu/ubuntuproject.h \123 src/ubuntu/ubuntuproject.h \
124 src/ubuntu/ubuntuprojectfile.h \124 src/ubuntu/ubuntuprojectfile.h \
125 src/ubuntu/ubuntuprojectnode.h \125 src/ubuntu/ubuntuprojectnode.h \
126 #src/ubuntu/ubuntuversion.h \126 src/ubuntu/ubuntuversion.h \
127 #src/ubuntu/ubuntufeatureprovider.h \127 #src/ubuntu/ubuntufeatureprovider.h \
128 #src/ubuntu/ubuntuversionmanager.h \128 #src/ubuntu/ubuntuversionmanager.h \
129 src/ubuntu/ubuntupackagingmode.h \129 src/ubuntu/ubuntupackagingmode.h \
130130
=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 2016-11-07 11:20:39 +0000
@@ -15,7 +15,7 @@
15 source: %{ProjectNameL}/15 source: %{ProjectNameL}/
16 qt-version: qt516 qt-version: qt5
17 options: ["CONFIG+=snapcraft"]17 options: ["CONFIG+=snapcraft"]
18 project-files: [%{ProjectNameL}]18 project-files: [%{ProjectNameL}.pro]
19 build-packages:19 build-packages:
20 - build-essential20 - build-essential
21 - qtbase5-dev21 - qtbase5-dev
2222
=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 2016-11-07 11:20:39 +0000
@@ -7,11 +7,11 @@
7 "trDisplayName": "QtQuick App with QML Ubuntu UI",7 "trDisplayName": "QtQuick App with QML Ubuntu UI",
8 "trDisplayCategory": "Snapcraft",8 "trDisplayCategory": "Snapcraft",
9 "icon": "../share/ubuntu.png",9 "icon": "../share/ubuntu.png",
10 "enabled": "%{JS: [ %{Plugins} ].indexOf('Ubuntu') >= 0}",10 "enabled": "%{JS: [ %{Plugins} ].indexOf('Ubuntu') >= 0 && Ubuntu.supportsSnappy()}",
1111
12 "options":12 "options":
13 [13 [
14 { "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },14 { "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/snapcraft','yaml')}" },
15 { "key": "ProjectNameL", "value": "%{JS: \"%{ProjectName}\".toLowerCase()}" },15 { "key": "ProjectNameL", "value": "%{JS: \"%{ProjectName}\".toLowerCase()}" },
16 { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },16 { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
17 { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" }17 { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" }
1818
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py 2016-11-07 11:20:39 +0000
@@ -0,0 +1,84 @@
1#!/usr/bin/python3
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3#
4# QTC device applauncher
5# Copyright (C) 2014 Canonical
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20# Author: Benjamin Zeller <benjamin.zeller@canonical.com>
21
22import os
23import os.path
24import subprocess
25import argparse
26import signal
27import sys
28
29# register options to the argument parser
30parser = argparse.ArgumentParser(description="SDK snap launcher")
31parser.add_argument('snap_package',action="store")
32parser.add_argument('snap_command',action='store')
33
34options, args = parser.parse_known_args()
35
36if not os.path.isfile(options.snap_package):
37 print("Snap file does not exist")
38 sys.exit(1)
39
40#parse the package name which should be application_version_arch.snap
41app_info = os.path.basename(options.snap_package)[:-5].split("_")
42if len(app_info) != 3:
43 print("The snap package name is invalid", file=sys.stderr)
44 sys.exit(1)
45
46#flush all descriptors
47sys.stdout.flush()
48sys.stderr.flush()
49
50#ok lets install the snap package
51ret = subprocess.call(["snap", "install", options.snap_package, "--dangerous"], stdout=sys.stdout, stderr=sys.stderr)
52if ret != 0:
53 sys.exit(ret)
54
55#flush all descriptors
56sys.stdout.flush()
57sys.stderr.flush()
58
59#this will contain the actual subprocess object
60proc = None
61stopped = False
62def signalHandler(signum, frame):
63 print('Signal handler called with signal', signum)
64 if proc is not None:
65 proc.kill()
66 else:
67 stopped = True
68
69signal.signal(signal.SIGINT, signalHandler)
70signal.signal(signal.SIGTERM, signalHandler)
71signal.signal(signal.SIGHUP, signalHandler)
72
73#start the actual app
74if not stopped:
75 proc = subprocess.Popen(["snap", "run", app_info[0]+"."+options.snap_command]+args, stdout=sys.stdout, stderr=sys.stderr)
76 ret = proc.wait()
77
78#flush all descriptors
79sys.stdout.flush()
80sys.stderr.flush()
81
82subprocess.call(["snap", "remove", app_info[0]], stdout=sys.stdout, stderr=sys.stderr)
83
84sys.exit(ret)
085
=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py 2016-11-07 11:20:39 +0000
@@ -1,4 +1,23 @@
1#!/usr/bin/python31#!/usr/bin/python3
2# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3#
4# QTC device applauncher
5# Copyright (C) 2014 Canonical
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation, either version 3 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20# Author: Benjamin Zeller <benjamin.zeller@canonical.com>
221
3import os22import os
4import sys23import sys
@@ -22,6 +41,9 @@
2241
23print("Using snapcraft from :"+options.snapcraft)42print("Using snapcraft from :"+options.snapcraft)
2443
44sys.stdout.flush()
45sys.stderr.flush()
46
25ret = subprocess.call([options.snapcraft, "clean"])47ret = subprocess.call([options.snapcraft, "clean"])
26if ret != 0:48if ret != 0:
27 sys.exit(ret)49 sys.exit(ret)
2850
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-09-22 16:11:03 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-11-07 11:20:39 +0000
@@ -62,6 +62,11 @@
62 ProjectExplorer::Abi::GenericLinuxFlavor,62 ProjectExplorer::Abi::GenericLinuxFlavor,
63 ProjectExplorer::Abi::ElfFormat,63 ProjectExplorer::Abi::ElfFormat,
64 64));64 64));
65 map.insert(QLatin1String("arm64") , ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture,
66 ProjectExplorer::Abi::LinuxOS,
67 ProjectExplorer::Abi::GenericLinuxFlavor,
68 ProjectExplorer::Abi::ElfFormat,
69 64));
65 return map;70 return map;
66}71}
6772
@@ -130,6 +135,15 @@
130 return clickArchitectures[arch];135 return clickArchitectures[arch];
131}136}
132137
138QString ClickToolChain::abiToArchitectureName(const ProjectExplorer::Abi &abi)
139{
140 for (auto i = clickArchitectures.constBegin(); i != clickArchitectures.constEnd(); i++){
141 if (i.value() == abi)
142 return i.key();
143 }
144 return QString("unknown");
145}
146
133QList<QString> ClickToolChain::supportedArchitectures()147QList<QString> ClickToolChain::supportedArchitectures()
134{148{
135 return clickArchitectures.keys();149 return clickArchitectures.keys();
@@ -158,7 +172,13 @@
158{172{
159 switch(abi.architecture()) {173 switch(abi.architecture()) {
160 case ProjectExplorer::Abi::ArmArchitecture:174 case ProjectExplorer::Abi::ArmArchitecture:
161 return QLatin1String("arm-linux-gnueabihf");175 switch(abi.wordWidth())
176 {
177 case 32:
178 return QLatin1String("arm-linux-gnueabihf");
179 case 64:
180 return QLatin1String("aarch64-linux-gnu");
181 }
162 break;182 break;
163 case ProjectExplorer::Abi::X86Architecture:183 case ProjectExplorer::Abi::X86Architecture:
164 switch(abi.wordWidth())184 switch(abi.wordWidth())
165185
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-09-22 16:11:03 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-11-07 11:20:39 +0000
@@ -50,6 +50,7 @@
50 const UbuntuClickTool::Target &clickTarget () const;50 const UbuntuClickTool::Target &clickTarget () const;
5151
52 static ProjectExplorer::Abi architectureNameToAbi ( const QString &arch );52 static ProjectExplorer::Abi architectureNameToAbi ( const QString &arch );
53 static QString abiToArchitectureName ( const ProjectExplorer::Abi &abi );
53 static QList<QString> supportedArchitectures ();54 static QList<QString> supportedArchitectures ();
5455
55 QString remoteCompilerCommand () const;56 QString remoteCompilerCommand () const;
5657
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp 2016-11-07 11:20:39 +0000
@@ -1,6 +1,7 @@
1#include "snapcraftbuildconfiguration.h"1#include "snapcraftbuildconfiguration.h"
22
3#include <ubuntu/ubuntuconstants.h>3#include <ubuntu/ubuntuconstants.h>
4#include <QDebug>
45
5namespace Ubuntu {6namespace Ubuntu {
6namespace Internal {7namespace Internal {
@@ -24,7 +25,9 @@
2425
25QVariantMap SnapcraftBuildConfiguration::toMap() const26QVariantMap SnapcraftBuildConfiguration::toMap() const
26{27{
27 return ProjectExplorer::BuildConfiguration::toMap();28 QVariantMap data = ProjectExplorer::BuildConfiguration::toMap();
29 qDebug()<<"Storing ID: "<<ProjectExplorer::idFromMap(data);
30 return data;
28}31}
2932
30ProjectExplorer::NamedWidget *SnapcraftBuildConfiguration::createConfigWidget()33ProjectExplorer::NamedWidget *SnapcraftBuildConfiguration::createConfigWidget()
3134
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp 2016-11-07 11:20:39 +0000
@@ -11,6 +11,7 @@
11#include <projectexplorer/projectmacroexpander.h>11#include <projectexplorer/projectmacroexpander.h>
12#include <projectexplorer/projectexplorerconstants.h>12#include <projectexplorer/projectexplorerconstants.h>
13#include <projectexplorer/buildsteplist.h>13#include <projectexplorer/buildsteplist.h>
14#include <projectexplorer/kitinformation.h>
1415
15#include <coreplugin/documentmanager.h>16#include <coreplugin/documentmanager.h>
16#include <utils/mimetypes/mimedatabase.h>17#include <utils/mimetypes/mimedatabase.h>
@@ -35,6 +36,10 @@
35 if (qobject_cast<SnapcraftProject *>(parent->project()))36 if (qobject_cast<SnapcraftProject *>(parent->project()))
36 return {};37 return {};
3738
39 //restrict this to local devices type kits for now
40 if (ProjectExplorer::DeviceKitInformation::deviceId(parent->kit()) != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
41 return {};
42
38 QList<ProjectExplorer::BuildInfo *> infoList;43 QList<ProjectExplorer::BuildInfo *> infoList;
39 ProjectExplorer::BuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectFilePath().toString());44 ProjectExplorer::BuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectFilePath().toString());
40 if (info)45 if (info)
@@ -57,6 +62,10 @@
57{62{
58 Utils::MimeDatabase db;63 Utils::MimeDatabase db;
5964
65 //restrict this to local devices type kits for now
66 if (ProjectExplorer::DeviceKitInformation::deviceId(k) != ProjectExplorer::Constants::DESKTOP_DEVICE_ID)
67 return {};
68
60 auto mimeType = db.mimeTypeForFile(projectPath);69 auto mimeType = db.mimeTypeForFile(projectPath);
61 if (!mimeType.matchesName(Constants::SNAPCRAFT_PROJECT_MIMETYPE))70 if (!mimeType.matchesName(Constants::SNAPCRAFT_PROJECT_MIMETYPE))
62 return {};71 return {};
6372
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp 2016-11-07 11:20:39 +0000
@@ -26,6 +26,8 @@
26#include <projectexplorer/kitinformation.h>26#include <projectexplorer/kitinformation.h>
27#include <projectexplorer/toolchain.h>27#include <projectexplorer/toolchain.h>
28#include <projectexplorer/projectmacroexpander.h>28#include <projectexplorer/projectmacroexpander.h>
29#include <projectexplorer/projectexplorerconstants.h>
30#include <projectexplorer/taskhub.h>
29#include <qmljs/qmljssimplereader.h>31#include <qmljs/qmljssimplereader.h>
30#include <qtsupport/qtkitinformation.h>32#include <qtsupport/qtkitinformation.h>
31#include <qtsupport/qtsupportconstants.h>33#include <qtsupport/qtsupportconstants.h>
@@ -39,6 +41,10 @@
39using namespace Ubuntu;41using namespace Ubuntu;
40using namespace Ubuntu::Internal;42using namespace Ubuntu::Internal;
4143
44enum {
45 debug = 0
46};
47
42SnapcraftProject::SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName)48SnapcraftProject::SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName)
43 : m_manager(manager),49 : m_manager(manager),
44 m_fileName(fileName),50 m_fileName(fileName),
@@ -135,17 +141,69 @@
135141
136void SnapcraftProject::asyncUpdate()142void SnapcraftProject::asyncUpdate()
137{143{
138 qDebug()<<"Syncing from yaml";144 if(debug) qDebug()<<"Syncing from yaml";
145
146 QString oldDisplayName = displayName();
147
139 try {148 try {
140 YAML::Node yaml = YAML::LoadFile(m_fileName.toString().toStdString());149 YAML::Node yaml = YAML::LoadFile(m_fileName.toString().toStdString());
141 if (!m_rootNode->syncFromYAMLNode(yaml)) {150 if (!m_rootNode->syncFromYAMLNode(yaml)) {
142 qDebug()<<"Invalid YAML file";151 ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
143 }152 QString::fromLatin1("Error while parsing snapcraft.yaml: file is invalid"),
153 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
154 projectFilePath());
155 }
156
157 QStringList commandList;
158
159 try {
160 YAML::Node commands = yaml["apps"];
161 if (!commands.IsMap()) {
162 ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
163 QString::fromLatin1("Error while parsing snapcraft.yaml: apps is not a map"),
164 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
165 projectFilePath());
166 } else {
167 for (auto it = commands.begin(); it != commands.end(); ++it) {
168 if(!it->second.IsMap() || it->second["daemon"])
169 continue;
170
171 commandList << QString::fromStdString(it->first.as<std::string>());
172 }
173 }
174
175 if(yaml["version"]) {
176 QString snapVer = QString::fromStdString(yaml["version"].as<std::string>());
177 if (snapVer != m_snapVersion) {
178 if(debug) qDebug()<<"Snap version is"<<snapVer;
179 m_snapVersion = snapVer;
180 emit snapVersionChanged();
181 }
182 }
183
184 } catch (const YAML::Exception &e) {
185 ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
186 QString::fromLatin1("Error while parsing the command list: %1").arg(QString::fromLatin1(e.what())),
187 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
188 projectFilePath(),
189 e.mark.line);
190 }
191
192 if (m_commands != commandList) {
193 m_commands = commandList;
194 emit commandListChanged(m_commands);
195 }
196
144 } catch (const YAML::Exception &e) {197 } catch (const YAML::Exception &e) {
145 qDebug() << e.what();198 ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
199 QString::fromLatin1("Error while parsing the project file: %1").arg(QString::fromLatin1(e.what())),
200 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
201 projectFilePath(),
202 e.mark.line);
146 }203 }
147204
148 emit displayNameChanged();205 if (oldDisplayName != displayName())
206 emit displayNameChanged();
149}207}
150208
151void SnapcraftProject::maybeUpdate(const QString &pathChanged)209void SnapcraftProject::maybeUpdate(const QString &pathChanged)
152210
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h 2016-11-07 11:20:39 +0000
@@ -47,6 +47,10 @@
47 SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName);47 SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName);
4848
49 QString displayName() const override;49 QString displayName() const override;
50 QString snapVersion() const{
51 return m_snapVersion;
52 }
53
50 ProjectExplorer::IProjectManager *projectManager() const override;54 ProjectExplorer::IProjectManager *projectManager() const override;
5155
52 ProjectExplorer::ProjectNode *rootProjectNode() const override;56 ProjectExplorer::ProjectNode *rootProjectNode() const override;
@@ -60,6 +64,10 @@
60 return m_fileName.toString();64 return m_fileName.toString();
61 }65 }
6266
67 QStringList commands () const {
68 return m_commands;
69 }
70
63 // Project interface71 // Project interface
64 bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;72 bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
65 bool needsConfiguration() const override;73 bool needsConfiguration() const override;
@@ -73,9 +81,15 @@
73 void asyncUpdate ();81 void asyncUpdate ();
74 void maybeUpdate (const QString &pathChanged);82 void maybeUpdate (const QString &pathChanged);
7583
84signals:
85 void commandListChanged (const QStringList &commands);
86 void snapVersionChanged ();
87
76private:88private:
77 SnapcraftProjectManager *m_manager;89 SnapcraftProjectManager *m_manager;
78 QString m_projectName;90 QString m_projectName;
91 QStringList m_commands;
92 QString m_snapVersion;
79 QPointer<SnapcraftProjectFile> m_file;93 QPointer<SnapcraftProjectFile> m_file;
8094
81 Utils::FileName m_fileName;95 Utils::FileName m_fileName;
8296
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp 2016-11-07 11:20:39 +0000
@@ -17,8 +17,11 @@
17 */17 */
1818
19#include "snapcraftprojectnode.h"19#include "snapcraftprojectnode.h"
20#include "snapcraftproject.h"
2021
21#include <projectexplorer/nodesvisitor.h>22#include <projectexplorer/nodesvisitor.h>
23#include <projectexplorer/projectexplorerconstants.h>
24#include <projectexplorer/taskhub.h>
22#include <coreplugin/fileiconprovider.h>25#include <coreplugin/fileiconprovider.h>
23#include <ubuntu/ubuntuconstants.h>26#include <ubuntu/ubuntuconstants.h>
2427
@@ -35,6 +38,11 @@
35namespace Ubuntu {38namespace Ubuntu {
36namespace Internal {39namespace Internal {
3740
41enum {
42 debug = 0
43};
44
45
38static QIcon generateIcon(const QString &overlay) {46static QIcon generateIcon(const QString &overlay) {
39 const QSize desiredSize = QSize(16, 16);47 const QSize desiredSize = QSize(16, 16);
4048
@@ -62,27 +70,27 @@
62 m_rootProject(rootProject),70 m_rootProject(rootProject),
63 m_watcher(watcher)71 m_watcher(watcher)
64{72{
65 setDisplayName(projectFilePath.parentDir().toString());73 setDisplayName(projectFilePath.parentDir().toFileInfo().fileName());
66 setIcon(generateProjectIcon());74 setIcon(generateProjectIcon());
67}75}
6876
69SnapcraftProjectNode::~SnapcraftProjectNode()77SnapcraftProjectNode::~SnapcraftProjectNode()
70{78{
71 if (m_watcher) {
72
73 }
74}79}
7580
76bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)81bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode)
77{82{
78 qDebug()<<"Sync from YAML node";83 if(debug) qDebug()<<"Sync from YAML node";
79 try {84 try {
80 QString displayName = QString::fromStdString(rootNode["name"].as<std::string>());85 QString displayName = QString::fromStdString(rootNode["name"].as<std::string>());
81 setDisplayName(displayName);86 setDisplayName(displayName);
8287
83 YAML::Node parts = rootNode["parts"];88 YAML::Node parts = rootNode["parts"];
84 if (!parts.IsMap()) {89 if (!parts.IsMap()) {
85 qDebug()<<"Parts is not a map";90 ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
91 QString::fromLatin1("Error while parsing snapcraft.yaml: parts is not a map"),
92 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
93 m_rootProject->projectFilePath());
86 return false;94 return false;
87 }95 }
8896
@@ -145,9 +153,13 @@
145 }153 }
146154
147 QSet<QString> obsoleteParts = existingParts.toSet() - partsFromYaml.toSet();155 QSet<QString> obsoleteParts = existingParts.toSet() - partsFromYaml.toSet();
148 qDebug()<<"Parts in yaml"<<partsFromYaml;156
149 qDebug()<<"Currently known parts"<<existingParts;157 if(debug) {
150 qDebug()<<"Parts now obsolete: "<<obsoleteParts;158 qDebug()<<"Parts in yaml"<<partsFromYaml;
159 qDebug()<<"Currently known parts"<<existingParts;
160 qDebug()<<"Parts now obsolete: "<<obsoleteParts;
161 }
162
151 for (const auto &part : obsoleteParts) {163 for (const auto &part : obsoleteParts) {
152 int idx = existingParts.indexOf(part);164 int idx = existingParts.indexOf(part);
153 if (idx >= 0)165 if (idx >= 0)
@@ -158,7 +170,11 @@
158 removeFolderNodes(nodesToRemove);170 removeFolderNodes(nodesToRemove);
159 addFolderNodes(nodesToAdd);171 addFolderNodes(nodesToAdd);
160 } catch (const YAML::Exception &e) {172 } catch (const YAML::Exception &e) {
161 qDebug()<<"ERRROR ERROR ERROR "<<e.what();173 ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error,
174 QString::fromLatin1("Error while parsing snapcraft.yaml: %1").arg(QString::fromLatin1(e.what())),
175 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM,
176 m_rootProject->projectFilePath(),
177 e.mark.line);
162 return false;178 return false;
163 }179 }
164180
@@ -191,9 +207,9 @@
191 setIcon(generateProjectIcon());207 setIcon(generateProjectIcon());
192208
193 if (watcher->addPath(folderPath.toString())) {209 if (watcher->addPath(folderPath.toString())) {
194 qDebug()<<"Added"<<folderPath.toString()<<"to watcher";210 if(debug) qDebug()<<"Added"<<folderPath.toString()<<"to watcher";
195 } else {211 } else {
196 qDebug()<<"Failed to add"<<folderPath.toString()<<"to watcher";212 if(debug) qDebug()<<"Failed to add"<<folderPath.toString()<<"to watcher";
197 }213 }
198 m_watcherConnection = QObject::connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path){214 m_watcherConnection = QObject::connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path){
199 maybeScheduleProjectScan(path);215 maybeScheduleProjectScan(path);
@@ -228,7 +244,7 @@
228 if (m_scanning)244 if (m_scanning)
229 return;245 return;
230246
231 qDebug()<<"Scheduling Project scan";247 if(debug) qDebug()<<"Scheduling Project scan";
232248
233 m_scanning = true;249 m_scanning = true;
234250
@@ -236,7 +252,7 @@
236 rescanTimer->setSingleShot(true);252 rescanTimer->setSingleShot(true);
237 rescanTimer->start(0);253 rescanTimer->start(0);
238 QObject::connect(rescanTimer, &QTimer::timeout, [this, rescanTimer](){254 QObject::connect(rescanTimer, &QTimer::timeout, [this, rescanTimer](){
239 qDebug()<<"Starting Project scan";255 if(debug) qDebug()<<"Starting Project scan";
240 delete rescanTimer;256 delete rescanTimer;
241 this->scanProjectDirectory();257 this->scanProjectDirectory();
242258
@@ -335,10 +351,12 @@
335 QList<Utils::FileName> dirsToRemove = (oldDirs - newDirs).toList();351 QList<Utils::FileName> dirsToRemove = (oldDirs - newDirs).toList();
336 QSet<Utils::FileName> dirsToAdd = newDirs - oldDirs;352 QSet<Utils::FileName> dirsToAdd = newDirs - oldDirs;
337353
338 qDebug()<<"Removing dirs " <<dirsToRemove;354 if(debug) {
339 qDebug()<<"Adding dirs " <<dirsToAdd;355 qDebug()<<"Removing dirs " <<dirsToRemove;
340 qDebug()<<"Removing files" <<filesToRemove;356 qDebug()<<"Adding dirs " <<dirsToAdd;
341 qDebug()<<"Adding files " <<filesToAdd;357 qDebug()<<"Removing files" <<filesToRemove;
358 qDebug()<<"Adding files " <<filesToAdd;
359 }
342360
343 removeFileNodes(filesToRemove.toList());361 removeFileNodes(filesToRemove.toList());
344 removeFolderNodes(dirsToRemove);362 removeFolderNodes(dirsToRemove);
@@ -401,7 +419,8 @@
401419
402 watches << currentPath.toFileInfo().absoluteFilePath();420 watches << currentPath.toFileInfo().absoluteFilePath();
403 }421 }
404 qDebug()<<"Failed to add watches: "<<m_watcher->addPaths(watches);422
423 m_watcher->addPaths(watches);
405 return currFolder;424 return currFolder;
406}425}
407426
408427
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp 2016-11-07 11:20:39 +0000
@@ -3,25 +3,81 @@
3#include "snapcraftbuildconfiguration.h"3#include "snapcraftbuildconfiguration.h"
44
5#include <ubuntu/snap/settings/snapcraftkitinformation.h>5#include <ubuntu/snap/settings/snapcraftkitinformation.h>
6
7#include <ubuntu/ubuntuconstants.h>6#include <ubuntu/ubuntuconstants.h>
7#include <ubuntu/clicktoolchain.h>
88
9#include <projectexplorer/target.h>9#include <projectexplorer/target.h>
10#include <utils/environment.h>10#include <utils/environment.h>
1111
12#include <QRegularExpression>
13
14
12namespace Ubuntu {15namespace Ubuntu {
13namespace Internal {16namespace Internal {
1417
18static const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
19
15SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl)20SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl)
16 : ProjectExplorer::AbstractProcessStep(bsl, Constants::SNAPCRAFT_BUILDSTEP_ID)21 : ProjectExplorer::AbstractProcessStep(bsl, Constants::SNAPCRAFT_BUILDSTEP_ID)
17{22{
18 setDefaultDisplayName(tr("Snapcraft"));23 setDefaultDisplayName(tr("Snapcraft"));
24
25 connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::snapVersionChanged,
26 this, &SnapcraftStep::packagePathChanged);
27 connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::displayNameChanged,
28 this, &SnapcraftStep::packagePathChanged);
19}29}
2030
21SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs)31SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs)
22 : ProjectExplorer::AbstractProcessStep(bsl, bs)32 : ProjectExplorer::AbstractProcessStep(bsl, bs)
23{33{
2434 connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::snapVersionChanged,
35 this, &SnapcraftStep::packagePathChanged);
36 connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::displayNameChanged,
37 this, &SnapcraftStep::packagePathChanged);
38}
39
40void SnapcraftStep::stdOutput(const QString &line)
41{
42 m_lastLine = line;
43 ProjectExplorer::AbstractProcessStep::stdOutput(line);
44}
45
46void SnapcraftStep::processStarted()
47{
48 m_packagePath.clear();
49 emit packagePathChanged();
50
51 ProjectExplorer::AbstractProcessStep::processStarted();
52}
53
54void SnapcraftStep::processFinished(int exitCode, QProcess::ExitStatus status)
55{
56 Utils::FileName newPackagePath;
57
58 ProjectExplorer::AbstractProcessStep::processFinished(exitCode, status);
59 if (status == QProcess::NormalExit && exitCode == 0) {
60 QRegularExpression exp((QLatin1String(PACKAGE_NAME_REGEX)));
61 QRegularExpressionMatch m = exp.match(m_lastLine);
62 if(m.hasMatch()) {
63 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
64 if(bc)
65 newPackagePath = bc->buildDirectory().appendPath(m.captured(1));
66 }
67 }
68
69 if (m_packagePath != newPackagePath) {
70 m_packagePath = newPackagePath;
71 emit packagePathChanged();
72 }
73}
74
75bool SnapcraftStep::processSucceeded(int exitCode, QProcess::ExitStatus status)
76{
77 if (!ProjectExplorer::AbstractProcessStep::processSucceeded(exitCode, status))
78 return false;
79
80 return m_packagePath.toFileInfo().exists();
25}81}
2682
27bool SnapcraftStep::init(QList<const ProjectExplorer::BuildStep *> &)83bool SnapcraftStep::init(QList<const ProjectExplorer::BuildStep *> &)
@@ -63,5 +119,21 @@
63 return bin;119 return bin;
64}120}
65121
122Utils::FileName SnapcraftStep::packagePath() const
123{
124 if (!m_packagePath.isEmpty())
125 return m_packagePath;
126
127 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
128 SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(target()->project());
129 ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
130 if(bc && pro && tc && !pro->displayName().isEmpty() && !pro->snapVersion().isEmpty())
131 return bc->buildDirectory().appendPath(QStringLiteral("%1_%2_%3.snap")
132 .arg(pro->displayName())
133 .arg(pro->snapVersion())
134 .arg(ClickToolChain::abiToArchitectureName(tc->targetAbi())));
135 return Utils::FileName();
136}
137
66} // namespace Internal138} // namespace Internal
67} // namespace Ubuntu139} // namespace Ubuntu
68140
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h 2016-11-07 11:20:39 +0000
@@ -2,6 +2,7 @@
2#define UBUNTU_INTERNAL_SNAPCRAFTSTEP_H2#define UBUNTU_INTERNAL_SNAPCRAFTSTEP_H
33
4#include <projectexplorer/abstractprocessstep.h>4#include <projectexplorer/abstractprocessstep.h>
5#include <utils/fileutils.h>
56
6namespace Ubuntu {7namespace Ubuntu {
7namespace Internal {8namespace Internal {
@@ -21,10 +22,26 @@
21 virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;22 virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
2223
23 Utils::FileName snapcraftCommand () const;24 Utils::FileName snapcraftCommand () const;
25 Utils::FileName packagePath () const;
26
27signals:
28 void packagePathChanged ();
2429
25protected:30protected:
26 SnapcraftStep(ProjectExplorer::BuildStepList *bsl);31 SnapcraftStep(ProjectExplorer::BuildStepList *bsl);
27 SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs);32 SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs);
33
34 // AbstractProcessStep interface
35 virtual void stdOutput(const QString &line);
36 virtual void processStarted() override;
37 virtual void processFinished(int exitCode, QProcess::ExitStatus status) override;
38 virtual bool processSucceeded(int exitCode, QProcess::ExitStatus status) override;
39
40
41
42private:
43 QString m_lastLine;
44 Utils::FileName m_packagePath;
28};45};
2946
30} // namespace Internal47} // namespace Internal
3148
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp 2016-11-07 11:20:39 +0000
@@ -0,0 +1,241 @@
1#include "snaprunconfiguration.h"
2#include "snapcraftstep.h"
3#include "snapcraftproject.h"
4
5#include <ubuntu/ubuntuconstants.h>
6
7#include <projectexplorer/runnables.h>
8#include <projectexplorer/target.h>
9#include <projectexplorer/buildconfiguration.h>
10#include <projectexplorer/buildstep.h>
11#include <projectexplorer/buildsteplist.h>
12#include <projectexplorer/projectexplorerconstants.h>
13#include <projectexplorer/localenvironmentaspect.h>
14#include <projectexplorer/runconfigurationaspects.h>
15#include <utils/qtcprocess.h>
16#include <utils/pathchooser.h>
17
18#include <QFileInfo>
19#include <QFormLayout>
20#include <QComboBox>
21
22namespace Ubuntu {
23namespace Internal {
24
25const QString COMMAND_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapCommand");
26const QString WORKINGDIRECTORYASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.WorkingDirectoryAspect");
27const QString ARGUMENTASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.ArgumentAspect");
28const QString TERMINALASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.TerminalAspect");
29
30SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent)
31 : ProjectExplorer::RunConfiguration(parent, Constants::SNAP_RUNCONFIGURATION_ID)
32 , m_workingDirectoryAspect(new ProjectExplorer::WorkingDirectoryAspect(this, WORKINGDIRECTORYASPECT_ID))
33 , m_argumentAspect(new ProjectExplorer::ArgumentsAspect(this, ARGUMENTASPECT_ID))
34 , m_terminalAspect(new ProjectExplorer::TerminalAspect(this, TERMINALASPECT_ID))
35 , m_localEnvironmentAspect(new ProjectExplorer::LocalEnvironmentAspect(this, ProjectExplorer::LocalEnvironmentAspect::BaseEnvironmentModifier()))
36{
37 m_terminalAspect->setRunMode(ProjectExplorer::ApplicationLauncher::Gui);
38
39 addExtraAspect(m_argumentAspect);
40 addExtraAspect(m_terminalAspect);
41 addExtraAspect(m_localEnvironmentAspect);
42 addExtraAspect(m_workingDirectoryAspect);
43
44 if(parent) {
45 SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(parent->project());
46 if (pro) {
47 setDisplayName(pro->displayName());
48 QStringList comms = pro->commands();
49 if (comms.size())
50 m_command = comms.first();
51 }
52 m_workingDirectoryAspect->setDefaultWorkingDirectory(Utils::FileName::fromString(pro->projectDir().absolutePath()));
53 }
54
55 // Connect target signals
56 connect(this->target(), &ProjectExplorer::Target::activeBuildConfigurationChanged,
57 this, &SnapRunConfiguration::updateConfiguration);
58 updateConfiguration();
59}
60
61SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent, SnapRunConfiguration *source)
62 : ProjectExplorer::RunConfiguration(parent, source),
63 m_command(source->m_command)
64{
65 // Connect target signals
66 connect(this->target(), &ProjectExplorer::Target::activeBuildConfigurationChanged,
67 this, &SnapRunConfiguration::updateConfiguration);
68 updateConfiguration();
69}
70
71QString SnapRunConfiguration::command() const
72{
73 return m_command;
74}
75
76void SnapRunConfiguration::setCommand(const QString &command)
77{
78 if (command != m_command) {
79 m_command = command;
80 emit enabledChanged();
81 }
82}
83
84bool SnapRunConfiguration::fromMap(const QVariantMap &map)
85{
86 if (!ProjectExplorer::RunConfiguration::fromMap(map))
87 return false;
88
89 m_command = map.value(COMMAND_KEY, QString()).toString();
90 return true;
91}
92
93QVariantMap SnapRunConfiguration::toMap() const
94{
95 QVariantMap map = ProjectExplorer::RunConfiguration::toMap();
96 map.insert(COMMAND_KEY, m_command);
97 return map;
98}
99
100bool SnapRunConfiguration::isEnabled() const
101{
102 return !m_command.isEmpty();
103}
104
105QString SnapRunConfiguration::disabledReason() const
106{
107 return tr("Please select a command to run in the runconfiguration.");
108}
109
110QWidget *SnapRunConfiguration::createConfigurationWidget()
111{
112 return new SnapRunConfigurationWidget(this);
113}
114
115ProjectExplorer::Runnable SnapRunConfiguration::runnable() const
116{
117 SnapcraftStep *pckStep = activeSnapcraftStep();
118 if (!pckStep) {
119 return ProjectExplorer::Runnable();
120 }
121
122 Utils::FileName packagePath = pckStep->packagePath();
123 if(packagePath.isEmpty()) {
124 return ProjectExplorer::Runnable();
125 }
126
127 qDebug()<<"Going to run "<<packagePath.toUserOutput();
128
129 QStringList args{
130 packagePath.toUserOutput(),
131 m_command
132 };
133
134 ProjectExplorer::StandardRunnable r;
135 r.executable = Utils::FileName::fromString(Constants::UBUNTU_SCRIPTPATH).appendPath(QStringLiteral("qtc_desktop_snaprunner.py")).toString();;
136 r.workingDirectory = m_workingDirectoryAspect->workingDirectory().toString();
137 r.environment = m_localEnvironmentAspect->environment();
138 r.commandLineArguments = Utils::QtcProcess::joinArgs(args);
139 if (!m_argumentAspect->arguments().isEmpty()) {
140 r.commandLineArguments.append(QStringLiteral(" -- %1").arg(m_argumentAspect->arguments()));
141 }
142 return r;
143}
144
145SnapcraftStep *SnapRunConfiguration::activeSnapcraftStep() const
146{
147 ProjectExplorer::BuildConfiguration *buildConf = activeBuildConfiguration();
148 if(!buildConf)
149 return nullptr;
150
151 ProjectExplorer::BuildStepList *bsList = buildConf->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
152 for(ProjectExplorer::BuildStep *currStep : bsList->steps()) {
153 SnapcraftStep *pckStep = qobject_cast<SnapcraftStep*>(currStep);
154 if(pckStep)
155 return pckStep;
156 }
157 return nullptr;
158}
159
160void SnapRunConfiguration::updateConfiguration()
161{
162 if(m_currBuildConfConn)
163 disconnect(m_currBuildConfConn);
164
165 m_currBuildConfConn = connect(activeSnapcraftStep(), &SnapcraftStep::packagePathChanged,
166 this, &ProjectExplorer::RunConfiguration::requestRunActionsUpdate);
167
168}
169
170SnapRunConfigurationWidget::SnapRunConfigurationWidget(SnapRunConfiguration *config)
171 : QWidget (nullptr),
172 m_rc(config),
173 m_updating(false)
174{
175 QFormLayout *layout = new QFormLayout(this);
176 layout->setMargin(0);
177 layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
178
179 setLayout(layout);
180
181 m_commandsBox = new QComboBox(this);
182 updateComboBox();
183
184 connect(m_commandsBox, SIGNAL(currentIndexChanged(int)),
185 this, SLOT(commandSelected(int)));
186
187 int idx = m_commandsBox->findText(config->command());
188 if (idx >= 0)
189 m_commandsBox->setCurrentIndex(idx);
190
191 layout->addRow(tr("Command:"), m_commandsBox);
192 config->extraAspect<ProjectExplorer::ArgumentsAspect>()->addToMainConfigurationWidget(this, layout);
193 config->extraAspect<ProjectExplorer::WorkingDirectoryAspect>()->addToMainConfigurationWidget(this,layout);
194 config->extraAspect<ProjectExplorer::TerminalAspect>()->addToMainConfigurationWidget(this,layout);
195
196 if(config->target()) {
197 connect(qobject_cast<SnapcraftProject*>(config->target()->project()), &SnapcraftProject::commandListChanged,
198 this, &SnapRunConfigurationWidget::updateComboBox);
199 }
200}
201
202void SnapRunConfigurationWidget::updateComboBox()
203{
204 QString currItem = m_rc->command();
205
206 //TODO check if project is still loading, so we do not override something we need
207
208 m_updating = true;
209 m_commandsBox->clear();
210 m_commandsBox->addItem(QString());
211 if(m_rc && m_rc->target()) {
212 SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(m_rc->target()->project());
213 if (pro) {
214 QStringList comms = pro->commands();
215 m_commandsBox->addItems(comms);
216 }
217 }
218 m_updating = false;
219
220 int idx = m_commandsBox->findText(currItem);
221 if (idx <= 0 && m_commandsBox->count() > 1)
222 m_commandsBox->setCurrentIndex(1);
223 else if (idx > 0)
224 m_commandsBox->setCurrentIndex(idx);
225 else
226 m_commandsBox->setCurrentIndex(0);
227}
228
229void SnapRunConfigurationWidget::commandSelected(const int index)
230{
231 if(m_updating)
232 return;
233
234 if(index == 0)
235 m_rc->setCommand(QString());
236 else
237 m_rc->setCommand(m_commandsBox->itemText(index));
238}
239
240} // namespace Internal
241} // namespace Ubuntu
0242
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h 2016-11-07 11:20:39 +0000
@@ -0,0 +1,87 @@
1#ifndef UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H
2#define UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H
3
4#include "snaprunconfigurationfactory.h"
5
6#include <projectexplorer/runconfiguration.h>
7#include <utils/fileutils.h>
8
9#include <QStringList>
10
11class QComboBox;
12
13namespace Utils {
14 class PathChooser;
15}
16
17namespace ProjectExplorer {
18 class WorkingDirectoryAspect;
19 class ArgumentsAspect;
20 class TerminalAspect;
21 class LocalEnvironmentAspect;
22}
23
24namespace Ubuntu {
25namespace Internal {
26
27class SnapcraftStep;
28
29class SnapRunConfiguration : public ProjectExplorer::RunConfiguration
30{
31 Q_OBJECT
32 friend class SnapRunConfigurationFactory;
33protected:
34 SnapRunConfiguration(ProjectExplorer::Target *parent);
35 SnapRunConfiguration(ProjectExplorer::Target *parent, SnapRunConfiguration *source);
36
37public:
38
39 QString command () const;
40 void setCommand (const QString &command);
41
42 // ProjectConfiguration interface
43 virtual bool fromMap(const QVariantMap &map) override;
44 virtual QVariantMap toMap() const override;
45
46 // RunConfiguration interface
47 virtual bool isEnabled() const override;
48 virtual QString disabledReason() const override;
49 virtual QWidget *createConfigurationWidget() override;
50 virtual ProjectExplorer::Runnable runnable() const override;
51
52private:
53 SnapcraftStep *activeSnapcraftStep() const;
54 void updateCommandList(const QStringList &commands);
55 void updateConfiguration();
56
57private:
58 QString m_command;
59 QMetaObject::Connection m_currBuildConfConn;
60 ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect;
61 ProjectExplorer::ArgumentsAspect* m_argumentAspect;
62 ProjectExplorer::TerminalAspect* m_terminalAspect;
63 ProjectExplorer::LocalEnvironmentAspect* m_localEnvironmentAspect;
64};
65
66class SnapRunConfigurationWidget : public QWidget
67{
68 Q_OBJECT
69public:
70 SnapRunConfigurationWidget(SnapRunConfiguration *config);
71
72protected:
73 void updateComboBox ();
74
75protected slots:
76 void commandSelected (const int index);
77
78private:
79 SnapRunConfiguration *m_rc;
80 QComboBox *m_commandsBox;
81 bool m_updating;
82};
83
84} // namespace Internal
85} // namespace Ubuntu
86
87#endif // UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H
088
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp 2016-11-07 11:20:39 +0000
@@ -0,0 +1,85 @@
1#include "snaprunconfigurationfactory.h"
2#include "snaprunconfiguration.h"
3#include "snapcraftproject.h"
4
5#include <ubuntu/ubuntuconstants.h>
6#include <projectexplorer/target.h>
7
8#include <utils/qtcassert.h>
9
10namespace Ubuntu {
11namespace Internal {
12
13SnapRunConfigurationFactory::SnapRunConfigurationFactory()
14{
15 setObjectName(QStringLiteral("SnapRunConfigurationFactory"));
16}
17
18QList<Core::Id> SnapRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent,
19 ProjectExplorer::IRunConfigurationFactory::CreationMode mode) const
20{
21 Q_UNUSED(mode);
22
23 if (!parent)
24 return {};
25 if (!qobject_cast<SnapcraftProject *>(parent->project()))
26 return {};
27
28 return {
29 Constants::SNAP_RUNCONFIGURATION_ID
30 };
31}
32
33QString SnapRunConfigurationFactory::displayNameForId(Core::Id id) const
34{
35 if (id == Constants::SNAP_RUNCONFIGURATION_ID)
36 return tr("Snapcraft Runconfiguration");
37
38 return QString();
39}
40
41bool SnapRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, Core::Id id) const
42{
43 return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(id);
44}
45
46bool SnapRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const
47{
48 return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(ProjectExplorer::idFromMap(map));
49}
50
51bool SnapRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const
52{
53 return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(product->id());
54}
55
56ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product)
57{
58 QTC_ASSERT(canClone(parent, product), return nullptr);
59 return new SnapRunConfiguration(parent, static_cast<SnapRunConfiguration *>(product));
60}
61
62ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id)
63{
64 QTC_ASSERT(canCreate(parent, id), return nullptr);
65 if (id == Constants::SNAP_RUNCONFIGURATION_ID)
66 return new SnapRunConfiguration(parent);
67 return nullptr;
68}
69
70ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, const QVariantMap &map)
71{
72 QTC_ASSERT(canRestore(parent, map), return nullptr);
73
74 SnapRunConfiguration *conf = new SnapRunConfiguration(parent);
75 if (conf->fromMap(map))
76 return conf;
77
78 //something went wrong
79 delete conf;
80 return nullptr;
81
82}
83
84} // namespace Internal
85} // namespace Ubuntu
086
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h 2016-11-07 11:20:39 +0000
@@ -0,0 +1,31 @@
1#ifndef UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H
2#define UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H
3
4#include <projectexplorer/runconfiguration.h>
5
6namespace Ubuntu {
7namespace Internal {
8
9class SnapRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory
10{
11public:
12
13 SnapRunConfigurationFactory();
14
15 // IRunConfigurationFactory interface
16 virtual QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const override;
17 virtual QString displayNameForId(Core::Id id) const override;
18 virtual bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override;
19 virtual bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override;
20 virtual bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const override;
21 virtual ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) override;
22
23private:
24 virtual ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id) override;
25 virtual ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
26};
27
28} // namespace Internal
29} // namespace Ubuntu
30
31#endif // UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H
032
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri 2016-11-07 11:20:39 +0000
@@ -11,7 +11,9 @@
11 $$PWD/project/snapcraftrsyncstep.cpp \11 $$PWD/project/snapcraftrsyncstep.cpp \
12 $$PWD/project/snapcraftstep.cpp \12 $$PWD/project/snapcraftstep.cpp \
13 $$PWD/project/snapcraftbuildstepfactory.cpp \13 $$PWD/project/snapcraftbuildstepfactory.cpp \
14 $$PWD/settings/snapcraftkitinformation.cpp14 $$PWD/settings/snapcraftkitinformation.cpp \
15 $$PWD/project/snaprunconfiguration.cpp \
16 $$PWD/project/snaprunconfigurationfactory.cpp
1517
16HEADERS += \18HEADERS += \
17 $$PWD/project/snapcraftproject.h \19 $$PWD/project/snapcraftproject.h \
@@ -23,5 +25,7 @@
23 $$PWD/project/snapcraftrsyncstep.h \25 $$PWD/project/snapcraftrsyncstep.h \
24 $$PWD/project/snapcraftstep.h \26 $$PWD/project/snapcraftstep.h \
25 $$PWD/project/snapcraftbuildstepfactory.h \27 $$PWD/project/snapcraftbuildstepfactory.h \
26 $$PWD/settings/snapcraftkitinformation.h28 $$PWD/settings/snapcraftkitinformation.h \
29 $$PWD/project/snaprunconfiguration.h \
30 $$PWD/project/snaprunconfigurationfactory.h
2731
2832
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 2016-09-22 16:11:03 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 2016-11-07 11:20:39 +0000
@@ -37,7 +37,7 @@
37namespace Ubuntu {37namespace Ubuntu {
38namespace Internal {38namespace Internal {
3939
40const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";40static const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
4141
42SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl)42SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl)
43 : ProjectExplorer::BuildStep (bsl, Constants::UBUNTU_SNAP_PACKAGESTEP_ID)43 : ProjectExplorer::BuildStep (bsl, Constants::UBUNTU_SNAP_PACKAGESTEP_ID)
4444
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-11-07 11:20:39 +0000
@@ -260,23 +260,21 @@
260const char FEATURE_UBUNTU_TRUSTY[] = "Ubuntu.Wizards.FeatureUbuntuTrusty";260const char FEATURE_UBUNTU_TRUSTY[] = "Ubuntu.Wizards.FeatureUbuntuTrusty";
261const char FEATURE_UBUNTU_UTOPIC[] = "Ubuntu.Wizards.FeatureUbuntuUtopic";261const char FEATURE_UBUNTU_UTOPIC[] = "Ubuntu.Wizards.FeatureUbuntuUtopic";
262262
263const char DISTRIB_ID[] = "DISTRIB_ID=";
264const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME=";
265const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE=";
266const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION=";
267const char LSB_RELEASE[] = "/etc/lsb-release";
268
269const char PRECISE[] = "precise";
270const char QUANTAL[] = "quantal";
271const char RARING[] = "raring";
272const char SAUCY[] = "saucy";
273const char TRUSTY[] = "trusty";
274const char UTOPIC[] = "utopic";
275
276const char PLATFORM_DESKTOP[] = "Desktop";263const char PLATFORM_DESKTOP[] = "Desktop";
277const char PLATFORM_DESKTOP_DISPLAYNAME[] = "Ubuntu %0";264const char PLATFORM_DESKTOP_DISPLAYNAME[] = "Ubuntu %0";
265
266const QString PRECISE (QStringLiteral("precise"));
267const QString QUANTAL (QStringLiteral("quantal"));
268const QString RARING (QStringLiteral("raring"));
269const QString SAUCY (QStringLiteral("saucy"));
270const QString TRUSTY (QStringLiteral("trusty"));
271const QString UTOPIC (QStringLiteral("utopic"));
272const QString VIVID (QStringLiteral("vivid"));
273const QString WILY (QStringLiteral("wily"));
278*/274*/
279275
276const QString XENIAL (QStringLiteral("xenial"));
277
280const char TASK_DEVICE_SCRIPT[] = "Ubuntu.Task.DeviceScript";278const char TASK_DEVICE_SCRIPT[] = "Ubuntu.Task.DeviceScript";
281279
282const char UBUNTU_SETTINGS_ICON[] = ":/ubuntu/images/ubuntu-32.png";280const char UBUNTU_SETTINGS_ICON[] = ":/ubuntu/images/ubuntu-32.png";
@@ -400,6 +398,7 @@
400const char SNAPCRAFT_BUILDCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapcraftBuildconfiguration.Id";398const char SNAPCRAFT_BUILDCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapcraftBuildconfiguration.Id";
401const char SNAPCRAFT_RSYNCBUILSSTEP_ID[] = "SnapcraftProjectManager.SnapcraftRsyncStep.Id";399const char SNAPCRAFT_RSYNCBUILSSTEP_ID[] = "SnapcraftProjectManager.SnapcraftRsyncStep.Id";
402const char SNAPCRAFT_BUILDSTEP_ID[] = "SnapcraftProjectManager.SnapcraftStep.Id";400const char SNAPCRAFT_BUILDSTEP_ID[] = "SnapcraftProjectManager.SnapcraftStep.Id";
401const char SNAP_RUNCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapRunConfiguration.Id";
403402
404403
405404
406405
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 2016-09-22 16:11:03 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 2016-11-07 11:20:39 +0000
@@ -15,8 +15,11 @@
15 *15 *
16 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>16 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
17 */17 */
18
18#include "ubuntujsextension.h"19#include "ubuntujsextension.h"
19#include <ubuntu/ubuntubzr.h>20#include <ubuntu/ubuntubzr.h>
21#include <ubuntu/ubuntuversion.h>
22#include <ubuntu/ubuntuconstants.h>
2023
21namespace Ubuntu {24namespace Ubuntu {
22namespace Internal {25namespace Internal {
@@ -43,4 +46,12 @@
43 return maintainer;46 return maintainer;
44}47}
4548
49bool UbuntuJsExtension::supportsSnappy() const
50{
51 UbuntuVersion *v = UbuntuVersion::instance();
52 if (v->isValid())
53 return v->supportsSnappy();
54 return false;
55}
56
46}}57}}
4758
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 2016-09-22 16:11:03 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 2016-11-07 11:20:39 +0000
@@ -30,6 +30,7 @@
30 explicit UbuntuJsExtension(QObject *parent = 0);30 explicit UbuntuJsExtension(QObject *parent = 0);
3131
32 Q_INVOKABLE QString developerId() const;32 Q_INVOKABLE QString developerId() const;
33 Q_INVOKABLE bool supportsSnappy() const;
33};34};
3435
35}}36}}
3637
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-10-18 07:45:16 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-11-07 11:20:39 +0000
@@ -52,11 +52,13 @@
52#include <ubuntu/wizards/ubuntuprojectapplicationwizard.h>52#include <ubuntu/wizards/ubuntuprojectapplicationwizard.h>
53#include <ubuntu/wizards/ubuntufirstrunwizard.h>53#include <ubuntu/wizards/ubuntufirstrunwizard.h>
54#include <ubuntu/wizards/ubuntuprojectmigrationwizard.h>54#include <ubuntu/wizards/ubuntuprojectmigrationwizard.h>
55#include <ubuntu/ubuntuversion.h>
5556
56#include <ubuntu/snap/project/snapcraftprojectmanager.h>57#include <ubuntu/snap/project/snapcraftprojectmanager.h>
57#include <ubuntu/snap/project/snapcraftbuildconfigurationfactory.h>58#include <ubuntu/snap/project/snapcraftbuildconfigurationfactory.h>
58#include <ubuntu/snap/project/snapcraftbuildstepfactory.h>59#include <ubuntu/snap/project/snapcraftbuildstepfactory.h>
59#include <ubuntu/snap/settings/snapcraftkitinformation.h>60#include <ubuntu/snap/settings/snapcraftkitinformation.h>
61#include <ubuntu/snap/project/snaprunconfiguration.h>
6062
61#include "ubuntujsextension.h"63#include "ubuntujsextension.h"
6264
@@ -181,11 +183,14 @@
181 addAutoReleasedObject(new UbuntuLocalRunControlFactory);183 addAutoReleasedObject(new UbuntuLocalRunControlFactory);
182184
183185
184 addAutoReleasedObject(new SnapcraftProjectManager);186 if (UbuntuVersion::instance()->supportsSnappy()) {
185 addAutoReleasedObject(new SnapcraftBuildConfigurationFactory);187 addAutoReleasedObject(new SnapcraftProjectManager);
186 addAutoReleasedObject(new SnapcraftBuildStepFactory);188 addAutoReleasedObject(new SnapcraftBuildConfigurationFactory);
189 addAutoReleasedObject(new SnapcraftBuildStepFactory);
190 addAutoReleasedObject(new SnapRunConfigurationFactory);
187191
188 ProjectExplorer::KitManager::registerKitInformation(new SnapcraftKitInformation);192 ProjectExplorer::KitManager::registerKitInformation(new SnapcraftKitInformation);
193 }
189194
190 // Build support195 // Build support
191 addAutoReleasedObject(new ClickToolChainFactory);196 addAutoReleasedObject(new ClickToolChainFactory);
192197
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp 2016-06-09 08:47:42 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp 2016-11-07 11:20:39 +0000
@@ -21,61 +21,59 @@
21#include <QFile>21#include <QFile>
22#include <QStringList>22#include <QStringList>
2323
24using namespace Ubuntu::Internal;24namespace Ubuntu {
25namespace Internal {
26
27Q_GLOBAL_STATIC(UbuntuVersion, g_instance);
28
29const char DISTRIB_ID[] = "DISTRIB_ID=";
30const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME=";
31const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE=";
32const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION=";
33const char LSB_RELEASE[] = "/etc/lsb-release";
2534
26UbuntuVersion::UbuntuVersion()35UbuntuVersion::UbuntuVersion()
27{36{
2837 initFromLsbFile();
29}38}
3039
31Core::FeatureSet UbuntuVersion::features() {40bool UbuntuVersion::supportsSnappy() const
32 Core::FeatureSet retval;41{
3342 if (m_valid)
34 QString cName = codename();43 return codename() == Constants::XENIAL;
35 if (cName==QLatin1String(Constants::PRECISE)) {44 return false;
36 retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_PRECISE);45}
37 } else if (cName==QLatin1String(Constants::QUANTAL)) {46
38 retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_QUANTAL);47UbuntuVersion *UbuntuVersion::instance()
39 } else if (cName==QLatin1String(Constants::RARING)) {48{
40 retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_RARING);49 return g_instance();
41 } else if (cName==QLatin1String(Constants::SAUCY)) {50}
42 retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_SAUCY);51
43 retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE);52void UbuntuVersion::initFromLsbFile()
44 } else if (cName==QLatin1String(Constants::TRUSTY)) {53{
45 retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_TRUSTY);54 QFile lsbRelease(QString::fromLatin1(LSB_RELEASE));
46 retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE);
47 } else if (cName==QLatin1String(Constants::UTOPIC)) {
48 retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_UTOPIC);
49 retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE);
50 }
51 return retval;
52}
53
54UbuntuVersion *UbuntuVersion::fromLsbFile(const QString &fileName)
55{
56 QFile lsbRelease(fileName);
57 if (lsbRelease.open(QIODevice::ReadOnly)) {55 if (lsbRelease.open(QIODevice::ReadOnly)) {
58 QByteArray data = lsbRelease.readAll();56 QByteArray data = lsbRelease.readAll();
59 lsbRelease.close();57 lsbRelease.close();
6058
61 UbuntuVersion *ver = new UbuntuVersion;
62
63 foreach(QString line, QString::fromLatin1(data).split(QLatin1String("\n"))) {59 foreach(QString line, QString::fromLatin1(data).split(QLatin1String("\n"))) {
64 if (line.startsWith(QLatin1String(Constants::DISTRIB_ID))) {60 if (line.startsWith(QLatin1String(DISTRIB_ID))) {
65 ver->m_id = line.replace(QLatin1String(Constants::DISTRIB_ID),QLatin1String(""));61 m_id = line.replace(QLatin1String(DISTRIB_ID),QLatin1String(""));
6662
67 } else if (line.startsWith(QLatin1String(Constants::DISTRIB_RELEASE))) {63 } else if (line.startsWith(QLatin1String(DISTRIB_RELEASE))) {
68 ver->m_release = line.replace(QLatin1String(Constants::DISTRIB_RELEASE),QLatin1String(""));64 m_release = line.replace(QLatin1String(DISTRIB_RELEASE),QLatin1String(""));
6965
70 } else if (line.startsWith(QLatin1String(Constants::DISTRIB_CODENAME))) {66 } else if (line.startsWith(QLatin1String(DISTRIB_CODENAME))) {
71 ver->m_codename = line.replace(QLatin1String(Constants::DISTRIB_CODENAME),QLatin1String(""));67 m_codename = line.replace(QLatin1String(DISTRIB_CODENAME),QLatin1String(""));
7268
73 } else if (line.startsWith(QLatin1String(Constants::DISTRIB_DESCRIPTION))) {69 } else if (line.startsWith(QLatin1String(DISTRIB_DESCRIPTION))) {
74 ver->m_description = line.replace(QLatin1String(Constants::DISTRIB_DESCRIPTION),QLatin1String(""));70 m_description = line.replace(QLatin1String(DISTRIB_DESCRIPTION),QLatin1String(""));
75 }71 }
76 }72 }
7773
78 return ver;74 m_valid = true;
79 }75 }
80 return 0;
81}76}
77
78}}
79
8280
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h 2016-06-09 08:47:42 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h 2016-11-07 11:20:39 +0000
@@ -27,28 +27,30 @@
27namespace Internal {27namespace Internal {
2828
2929
30class UbuntuVersion : public QObject30class UbuntuVersion
31{31{
32 Q_OBJECT
33
34public:32public:
35 explicit UbuntuVersion();33 explicit UbuntuVersion();
36 34
37public slots:35public slots:
38 QString id() { return m_id; }36 bool isValid () const { return m_valid; }
39 QString release() { return m_release; }37 QString id() const { return m_id; }
40 QString codename() { return m_codename; }38 QString release() const { return m_release; }
41 QString description() { return m_description; }39 QString codename() const { return m_codename; }
4240 QString description() const { return m_description; }
43 Core::FeatureSet features();41 bool supportsSnappy () const;
4442
45 static UbuntuVersion *fromLsbFile( const QString &fileName );43 static UbuntuVersion *instance( );
44
45protected:
46 void initFromLsbFile( );
4647
47protected:48protected:
48 QString m_id;49 QString m_id;
49 QString m_release;50 QString m_release;
50 QString m_codename;51 QString m_codename;
51 QString m_description;52 QString m_description;
53 bool m_valid = false;
52};54};
53}55}
54}56}

Subscribers

People subscribed via source and target branches