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

Proposed by Benjamin Zeller on 2016-09-22
Status: Merged
Approved by: Zoltan Balogh on 2016-09-22
Approved revision: 162
Merged at revision: 162
Proposed branch: lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-step1
Merge into: lp:ubuntu-sdk-ide
Diff against target: 1792 lines (+1298/-81)
30 files modified
CMakeLists.txt (+1/-1)
apply-patches.sh (+12/-0)
debian/patches/cmake_ubuntuspecificbits.diff (+101/-60)
dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro (+9/-2)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro (+32/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml (+54/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop (+9/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro (+48/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc (+5/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper (+63/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp (+14/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml (+23/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json (+108/-0)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml (+2/-2)
dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build (+1/-0)
dist/qtcreator/src/plugins/ubuntu/src/plugin.pri (+1/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp (+1/-1)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h (+1/-1)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp (+468/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h (+105/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp (+30/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h (+22/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h (+1/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp (+46/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h (+37/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp (+86/-5)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h (+1/-0)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp (+9/-3)
dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp (+7/-5)
fix-qt-build.py (+1/-1)
To merge this branch: bzr merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-step1
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-09-22
Zoltan Balogh (community) 2016-09-22 Approve on 2016-09-22
Review via email: mp+306510@code.launchpad.net

Commit message

Support to package snapcraft projects in the IDE (Step 1)

Description of the change

Support to package snapcraft projects in the IDE (Step 1)

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

let's see it in action in the meantime

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2016-09-14 14:37:07 +0000
3+++ CMakeLists.txt 2016-09-22 16:34:17 +0000
4@@ -86,7 +86,7 @@
5 ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
6
7 add_custom_target(ApplyPatches
8- env QUILT_PATCHES=debian/patches quilt push -a
9+ ${CMAKE_SOURCE_DIR}/apply-patches.sh
10 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
11
12 ExternalProject_Add(${QT_VERSION}
13
14=== added file 'apply-patches.sh'
15--- apply-patches.sh 1970-01-01 00:00:00 +0000
16+++ apply-patches.sh 2016-09-22 16:34:17 +0000
17@@ -0,0 +1,12 @@
18+#!/bin/bash
19+
20+env QUILT_PATCHES=debian/patches quilt push -a
21+
22+RESULT=$?
23+
24+if [ $RESULT -eq 0 -o $RESULT -eq 2 ]; then
25+ exit 0
26+fi
27+
28+exit 1
29+
30
31=== modified file 'debian/patches/cmake_ubuntuspecificbits.diff'
32--- debian/patches/cmake_ubuntuspecificbits.diff 2016-09-15 12:31:17 +0000
33+++ debian/patches/cmake_ubuntuspecificbits.diff 2016-09-22 16:34:17 +0000
34@@ -1,8 +1,6 @@
35-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
36-===================================================================
37---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
38-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
39-@@ -165,10 +165,10 @@ void CMakeManager::createXmlFile(Utils::
40+--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
41++++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
42+@@ -165,10 +165,10 @@
43 proc->setWorkingDirectory(buildDirectoryPath);
44 proc->setEnvironment(env);
45
46@@ -16,11 +14,9 @@
47 Utils::QtcProcess::addArgs(&args, arguments);
48
49 proc->setCommand(executable, args);
50-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
51-===================================================================
52---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
53-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
54-@@ -288,9 +288,10 @@ Internal::Manager *QmlProject::projectMa
55+--- a/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
56++++ b/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
57+@@ -288,9 +288,10 @@
58 bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const
59 {
60 Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);
61@@ -33,11 +29,9 @@
62 return false;
63 }
64
65-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
66-===================================================================
67---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
68-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
69-@@ -2024,6 +2024,7 @@ EvalResult *QmakeProFileNode::evaluate(c
70+--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
71++++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
72+@@ -2024,6 +2024,7 @@
73 result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS"));
74 result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS"));
75 result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME"));
76@@ -45,11 +39,9 @@
77
78 result->isDeployable = false;
79 if (result->projectType == ApplicationTemplate) {
80-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
81-===================================================================
82---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
83-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
84-@@ -107,7 +107,8 @@ enum QmakeVariable {
85+--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
86++++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
87+@@ -107,7 +107,8 @@
88 AndroidPackageSourceDir,
89 AndroidExtraLibs,
90 IsoIconsVar,
91@@ -59,10 +51,8 @@
92 };
93
94 namespace Internal {
95-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
96-===================================================================
97---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
98-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
99+--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
100++++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
101 @@ -25,6 +25,8 @@
102
103 #pragma once
104@@ -72,7 +62,7 @@
105 #include <QByteArray>
106 #include <QList>
107
108-@@ -34,7 +36,7 @@ namespace ProjectExplorer { class Kit; }
109+@@ -34,7 +36,7 @@
110
111 namespace CMakeProjectManager {
112
113@@ -81,11 +71,9 @@
114 public:
115 enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC };
116 CMakeConfigItem();
117-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
118-===================================================================
119---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
120-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
121-@@ -568,6 +568,11 @@ bool QtVersionManager::isValidId(int id)
122+--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
123++++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
124+@@ -568,6 +568,11 @@
125 return m_versions.contains(id);
126 }
127
128@@ -97,11 +85,9 @@
129 BaseQtVersion *QtVersionManager::version(int id)
130 {
131 QTC_ASSERT(isLoaded(), return 0);
132-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
133-===================================================================
134---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
135-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
136-@@ -63,6 +63,7 @@ public:
137+--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
138++++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
139+@@ -63,6 +63,7 @@
140 static void removeVersion(BaseQtVersion *version);
141
142 static bool isValidId(int id);
143@@ -109,11 +95,9 @@
144
145 signals:
146 // content of BaseQtVersion objects with qmake path might have changed
147-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
148-===================================================================
149---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/plugins.pro
150-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
151-@@ -56,7 +56,8 @@ SUBDIRS = \
152+--- a/dist/qtcreator/src/plugins/plugins.pro
153++++ b/dist/qtcreator/src/plugins/plugins.pro
154+@@ -56,7 +56,8 @@
155 winrt \
156 qmlprofiler \
157 updateinfo \
158@@ -123,11 +107,9 @@
159
160 DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)
161 isEmpty(DO_NOT_BUILD_QMLDESIGNER) {
162-Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
163-===================================================================
164---- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
165-+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
166-@@ -11,10 +11,10 @@ load(qt_parts)
167+--- a/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
168++++ b/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
169+@@ -11,10 +11,10 @@
170 src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher
171 src_uitk_launcher.depends = sub-src
172
173@@ -141,11 +123,9 @@
174
175 # additional 'make test' target required by continuous integration system
176 test.target = test
177-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
178-===================================================================
179---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
180-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
181-@@ -387,6 +387,18 @@ void CMakeProject::runCMake()
182+--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
183++++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
184+@@ -387,6 +387,18 @@
185 }
186 }
187
188@@ -164,10 +144,8 @@
189 QList<CMakeBuildTarget> CMakeProject::buildTargets() const
190 {
191 BuildDirManager *bdm = nullptr;
192-Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
193-===================================================================
194---- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
195-+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
196+--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
197++++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
198 @@ -27,6 +27,7 @@
199
200 #include "cmake_global.h"
201@@ -176,7 +154,7 @@
202
203 #include <projectexplorer/extracompiler.h>
204 #include <projectexplorer/project.h>
205-@@ -111,6 +112,8 @@ public:
206+@@ -111,6 +112,8 @@
207
208 void runCMake();
209
210@@ -185,11 +163,9 @@
211 signals:
212 /// emitted when cmake is running:
213 void parsingStarted();
214-Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
215-===================================================================
216---- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
217-+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
218-@@ -249,11 +249,11 @@ PlatformMenuWrapper::PlatformMenuWrapper
219+--- a/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
220++++ b/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
221+@@ -249,11 +249,11 @@
222 , m_target(target)
223 , m_inserted(false)
224 {
225@@ -206,3 +182,68 @@
226
227 syncPlatformMenu();
228 }
229+--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
230++++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
231+@@ -161,6 +161,12 @@
232+
233+ Utils::FileSaver saver(m_d->path, flags);
234+ saver.write(m_d->contents);
235++
236++ if (attributes() & UserExecutable) {
237++ QFile *createdFile = saver.file();
238++ createdFile->setPermissions(createdFile->permissions() | QFileDevice::ExeOwner);
239++ }
240++
241+ return saver.finalize(errorMessage);
242+ }
243+
244+--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
245++++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
246+@@ -46,7 +46,9 @@
247+ /* File exists and the user indicated that he wants to keep it */
248+ KeepExistingFileAttribute = 0x8,
249+ /* Force overwriting of a file without asking the user to keep it */
250+- ForceOverwrite = 0x10
251++ ForceOverwrite = 0x10,
252++ /* Set User executable flag*/
253++ UserExecutable = 0x20
254+ };
255+ Q_DECLARE_FLAGS(Attributes, Attribute)
256+
257+--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
258++++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
259+@@ -70,6 +70,7 @@
260+ f.overwrite = tmp.value(QLatin1String("overwrite"), false);
261+ f.openInEditor = tmp.value(QLatin1String("openInEditor"), false);
262+ f.openAsProject = tmp.value(QLatin1String("openAsProject"), false);
263++ f.isUserExecutable = tmp.value(QLatin1String("userExecutable"), false);
264+
265+ f.options = JsonWizard::parseOptions(tmp.value(QLatin1String("options")), errorMessage);
266+ if (!errorMessage->isEmpty())
267+@@ -146,6 +147,8 @@
268+ attributes |= Core::GeneratedFile::OpenProjectAttribute;
269+ if (JsonWizard::boolFromVariant(file.overwrite, expander))
270+ attributes |= Core::GeneratedFile::ForceOverwrite;
271++ if (JsonWizard::boolFromVariant(file.isUserExecutable, expander))
272++ attributes |= Core::GeneratedFile::UserExecutable;
273+
274+ if (file.keepExisting)
275+ attributes |= Core::GeneratedFile::KeepExistingFileAttribute;
276+@@ -231,6 +234,7 @@
277+ if (!file->write(errorMessage))
278+ return false;
279+ }
280++
281+ return true;
282+ }
283+
284+--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
285++++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
286+@@ -55,6 +55,7 @@
287+ QVariant overwrite = false;
288+ QVariant openInEditor = false;
289+ QVariant openAsProject = false;
290++ QVariant isUserExecutable = false;
291+
292+ QList<JsonWizard::OptionDefinition> options;
293+ };
294
295=== modified file 'dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro'
296--- dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-09-05 17:35:40 +0000
297+++ dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-09-22 16:34:17 +0000
298@@ -106,7 +106,10 @@
299 src/ubuntu/device/container/ubuntulocaldeployconfiguration.cpp \
300 src/ubuntu/device/container/ubuntulocalrunconfigurationfactory.cpp \
301 src/ubuntu/device/container/ubuntulocalrunconfiguration.cpp \
302- src/ubuntu/processoutputdialog.cpp
303+ src/ubuntu/processoutputdialog.cpp \
304+ $$PWD/src/ubuntu/ubuntujsextension.cpp \
305+ src/ubuntu/snap/snapcraftpackagestep.cpp \
306+ src/ubuntu/snap/snaphelper.cpp
307
308 HEADERS += \
309 src/ubuntu/ubuntuplugin.h \
310@@ -175,7 +178,10 @@
311 src/ubuntu/device/container/ubuntulocaldeployconfiguration.h \
312 src/ubuntu/device/container/ubuntulocalrunconfigurationfactory.h \
313 src/ubuntu/device/container/ubuntulocalrunconfiguration.h \
314- src/ubuntu/processoutputdialog.h
315+ src/ubuntu/processoutputdialog.h \
316+ $$PWD/src/ubuntu/ubuntujsextension.h \
317+ src/ubuntu/snap/snapcraftpackagestep.h \
318+ src/ubuntu/snap/snaphelper.h
319
320 #remote device support
321 SOURCES += \
322@@ -214,6 +220,7 @@
323 src/ubuntu/device/remote/ubuntudirectuploadstep.h \
324 src/ubuntu/device/remote/ubuntudeploystepfactory.h
325
326+
327 FORMS += \
328 src/ubuntu/device/remote/ubunturemoterunconfigurationwidget.ui \
329
330
331=== added directory 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake'
332=== added directory 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName'
333=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro'
334--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro 1970-01-01 00:00:00 +0000
335+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro 2016-09-22 16:34:17 +0000
336@@ -0,0 +1,32 @@
337+# This is the basic qmake template for the Ubuntu-SDK
338+# it handles creation and installation of the manifest
339+# file and takes care of subprojects
340+TEMPLATE = subdirs
341+
342+SUBDIRS += %{ProjectNameL}
343+
344+# enables/disabled the extra targets to build a snapcraft package
345+# also tells the IDE this is a snapcraft project
346+CONFIG += snapcraft
347+
348+snapcraft {
349+
350+ SNAPCRAFT_FILE=snapcraft.yaml
351+
352+ #the Ubuntu SDK IDE uses the snap target to create the package
353+ snappy.target = snap
354+ snappy.commands = cd $$OUT_PWD
355+ snappy.commands += && rm -rf \'$$OUT_PWD/snap-deploy\'
356+ snappy.commands += && make INSTALL_ROOT=$$OUT_PWD/snap-deploy install
357+ snappy.commands += && cd $$OUT_PWD/snap-deploy
358+ snappy.commands += && snapcraft
359+
360+ OTHER_FILES+=$$SNAPCRAFT_FILE
361+ QMAKE_EXTRA_TARGETS += snappy
362+
363+ packaging.files = $$SNAPCRAFT_FILE
364+ packaging.path = /
365+
366+ INSTALLS+=packaging
367+}
368+
369
370=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml'
371--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml 1970-01-01 00:00:00 +0000
372+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml 2016-09-22 16:34:17 +0000
373@@ -0,0 +1,54 @@
374+import QtQuick 2.4
375+import Ubuntu.Components 1.3
376+
377+/*!
378+ \brief MainView with a Label and Button elements.
379+*/
380+
381+MainView {
382+ // objectName for functional testing purposes (autopilot-qt5)
383+ objectName: "mainView"
384+
385+ applicationName: "%{ProjectNameL}.%{DeveloperId}"
386+
387+ width: units.gu(100)
388+ height: units.gu(75)
389+
390+ Page {
391+ header: PageHeader {
392+ id: pageHeader
393+ title: i18n.tr("%{ProjectNameL}")
394+ StyleHints {
395+ foregroundColor: UbuntuColors.orange
396+ backgroundColor: UbuntuColors.porcelain
397+ dividerColor: UbuntuColors.slate
398+ }
399+ }
400+
401+ Label {
402+ id: label
403+ objectName: "label"
404+ anchors {
405+ horizontalCenter: parent.horizontalCenter
406+ top: pageHeader.bottom
407+ topMargin: units.gu(2)
408+ }
409+
410+ text: i18n.tr("Hello..")
411+ }
412+
413+ Button {
414+ objectName: "button"
415+ anchors {
416+ horizontalCenter: parent.horizontalCenter
417+ top: label.bottom
418+ topMargin: units.gu(2)
419+ }
420+ width: parent.width
421+ text: i18n.tr("Tap me!")
422+ onClicked: {
423+ label.text = i18n.tr("..world!")
424+ }
425+ }
426+ }
427+}
428
429=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop'
430--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop 1970-01-01 00:00:00 +0000
431+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop 2016-09-22 16:34:17 +0000
432@@ -0,0 +1,9 @@
433+[Desktop Entry]
434+Version=1.0
435+Name=%{ProjectNameL}
436+Exec=%{ProjectNameL}
437+TryExec=%{ProjectNameL}
438+Icon=${SNAP}/meta/gui/%{ProjectNameL}.png
439+Terminal=false
440+Type=Application
441+X-Ubuntu-Touch=true
442
443=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.png'
444Binary files dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.png 1970-01-01 00:00:00 +0000 and dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.png 2016-09-22 16:34:17 +0000 differ
445=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro'
446--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro 1970-01-01 00:00:00 +0000
447+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro 2016-09-22 16:34:17 +0000
448@@ -0,0 +1,48 @@
449+TEMPLATE = app
450+TARGET = %{ProjectNameL}
451+
452+QT += qml quick
453+
454+# enables/disabled the extra targets to build a snapcraft package
455+# also tells the IDE this is a snapcraft project
456+CONFIG += snapcraft
457+
458+SOURCES += main.cpp
459+
460+RESOURCES += %{ProjectNameL}.qrc
461+
462+QML_FILES += $$files(*.qml,true) \
463+ $$files(*.js,true)
464+
465+CONF_FILES += %{ProjectNameL}.png
466+
467+AP_TEST_FILES += tests/autopilot/run \
468+ $$files(tests/*.py,true)
469+
470+#show all the files in QtCreator
471+OTHER_FILES += $${CONF_FILES} \
472+ $${QML_FILES} \
473+ $${AP_TEST_FILES} \
474+ %{ProjectNameL}.desktop \
475+ %{ProjectNameL}.wrapper
476+
477+snapcraft {
478+ #specify where the config files are installed to
479+ config_files.path = /setup/gui
480+ config_files.files += $${CONF_FILES}
481+ INSTALLS+=config_files
482+
483+ #install the desktop file
484+ desktop_file.path = /setup/gui
485+ desktop_file.files = $$PWD/%{ProjectNameL}.desktop
486+ desktop_file.CONFIG += no_check_exist
487+ INSTALLS+=desktop_file
488+
489+ # Default rules for deployment.
490+
491+ wrapper.files = %{ProjectNameL}.wrapper
492+ wrapper.path = /deploy/bin
493+
494+ target.path = /deploy/bin
495+ INSTALLS+=target wrapper
496+}
497
498=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc'
499--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc 1970-01-01 00:00:00 +0000
500+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc 2016-09-22 16:34:17 +0000
501@@ -0,0 +1,5 @@
502+<RCC>
503+ <qresource prefix="/">
504+ <file>Main.qml</file>
505+ </qresource>
506+</RCC>
507
508=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper'
509--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper 1970-01-01 00:00:00 +0000
510+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper 2016-09-22 16:34:17 +0000
511@@ -0,0 +1,63 @@
512+#!/bin/bash
513+
514+if [ "$SNAP_ARCH" == "amd64" ]; then
515+ ARCH="x86_64-linux-gnu"
516+elif [ "$SNAP_ARCH" == "armhf" ]; then
517+ ARCH="arm-linux-gnueabihf"
518+else
519+ ARCH="$SNAP_ARCH-linux-gnu"
520+fi
521+
522+export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
523+
524+# XKB config
525+export XKB_CONFIG_ROOT=$SNAP/usr/share/X11/xkb
526+
527+if [ "$DESKTOP_SESSION" == "unity8" ]; then
528+ # Qt Platform to Mir
529+ export QT_QPA_PLATFORM=ubuntumirclient
530+ # Mir runtime
531+ export MIR_SOCKET=$XDG_RUNTIME_DIR/mir_socket
532+ export MIR_CLIENT_PLATFORM_PATH=$SNAP/usr/lib/$ARCH/mir/client-platform
533+fi
534+
535+# Qt Libs
536+export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/qt5/libs:$LD_LIBRARY_PATH
537+export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/pulseaudio:$LD_LIBRARY_PATH
538+
539+# Qt Modules
540+export QT_PLUGIN_PATH=$SNAP/usr/lib/$ARCH/qt5/plugins
541+export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$SNAP/usr/lib/$ARCH/qt5/qml
542+export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$SNAP/lib/$ARCH
543+
544+# Mesa Libs
545+export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH
546+export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH
547+
548+# XDG Config
549+export XDG_CONFIG_DIRS=$SNAP/etc/xdg:$XDG_CONFIG_DIRS
550+export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$XDG_CONFIG_DIRS
551+# Note: this doesn't seem to work, QML's LocalStorage either ignores
552+# or fails to use $SNAP_USER_DATA if defined here
553+export XDG_DATA_DIRS=$SNAP_USER_DATA:$XDG_DATA_DIRS
554+export XDG_DATA_DIRS=$SNAP/usr/share:$XDG_DATA_DIRS
555+
556+# needed for fontconfig
557+export XDG_DATA_HOME=$SNAP/usr/share
558+
559+# Font Config
560+export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
561+export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
562+
563+# Tell libGL where to find the drivers
564+export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri
565+
566+# Necessary for the SDK to find the translations directory
567+export APP_DIR=$SNAP
568+
569+# ensure the snappy gl libs win
570+export LD_LIBRARY_PATH="$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH"
571+
572+cd $SNAP
573+exec $SNAP/bin/%{ProjectNameL}
574+
575
576=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp'
577--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp 1970-01-01 00:00:00 +0000
578+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp 2016-09-22 16:34:17 +0000
579@@ -0,0 +1,14 @@
580+#include <QGuiApplication>
581+#include <QQmlApplicationEngine>
582+#include <QQuickView>
583+
584+int main(int argc, char *argv[])
585+{
586+ QGuiApplication app(argc, argv);
587+
588+ QQuickView view;
589+ view.setSource(QUrl(QStringLiteral("qrc:///Main.qml")));
590+ view.setResizeMode(QQuickView::SizeRootObjectToView);
591+ view.show();
592+ return app.exec();
593+}
594
595=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml'
596--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 1970-01-01 00:00:00 +0000
597+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 2016-09-22 16:34:17 +0000
598@@ -0,0 +1,23 @@
599+name: %{ProjectNameL}
600+version: 0.01
601+summary: Example application
602+description: Shows a basic UITK based UI
603+confinement: strict
604+
605+apps:
606+ %{ProjectNameL}:
607+ command: %{ProjectNameL}.wrapper
608+ plugs: [unity7, opengl]
609+
610+parts:
611+ %{ProjectNameL}:
612+ plugin: dump
613+ source: deploy/
614+ stage-packages:
615+ - ubuntu-sdk-libs
616+ - qtubuntu-desktop
617+ - qtmir-desktop
618+ - mir-graphics-drivers-desktop
619+
620+
621+
622
623=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json'
624--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 1970-01-01 00:00:00 +0000
625+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 2016-09-22 16:34:17 +0000
626@@ -0,0 +1,108 @@
627+{
628+ "version": 1,
629+ "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
630+ "id": "A.QtQuick Snappy Application",
631+ "category": "B.Snapcraft",
632+ "trDescription": "Creates a experimental C++ Ubuntu snappy application project with a sample UI containing a Label and a Button.",
633+ "trDisplayName": "QtQuick App with QML Ubuntu UI",
634+ "trDisplayCategory": "Snapcraft",
635+ "icon": "../share/ubuntu.png",
636+ "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
637+
638+ "options":
639+ [
640+ { "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
641+ { "key": "ProjectNameL", "value": "%{JS: \"%{ProjectName}\".toLowerCase()}" },
642+ { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
643+ { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" }
644+ ],
645+
646+ "pages":
647+ [
648+ {
649+ "trDisplayName": "Project Location",
650+ "trShortTitle": "Location",
651+ "typeId": "Project"
652+ },
653+ {
654+ "trDisplayName": "Developer ID",
655+ "trShortTitle": "Developer ID",
656+ "typeId": "Fields",
657+ "data" :
658+ [
659+ {
660+ "name": "DeveloperId",
661+ "trDisplayName": "Developer ID:",
662+ "mandatory": true,
663+ "type": "LineEdit",
664+ "data": {
665+ "validator": "^[A-Za-z0-9-]+$",
666+ "trText": "%{JS: Ubuntu.developerId()}"
667+ }
668+ }
669+ ]
670+ },
671+ {
672+ "trDisplayName": "Kit Selection",
673+ "trShortTitle": "Kits",
674+ "typeId": "Kits",
675+ "enabled": "%{IsTopLevelProject}",
676+ "data": { "projectFilePath": "%{ProjectFile}" }
677+ },
678+ {
679+ "trDisplayName": "Project Management",
680+ "trShortTitle": "Summary",
681+ "typeId": "Summary"
682+ }
683+ ],
684+ "generators":
685+ [
686+ {
687+ "typeId": "File",
688+ "data":
689+ [
690+ {
691+ "source": "appName.pro",
692+ "target": "%{ProjectFile}",
693+ "openAsProject": true
694+ },
695+ {
696+ "source": "snapcraft.yaml",
697+ "openInEditor": true
698+ },
699+ {
700+ "source": "appName/main.cpp",
701+ "target": "%{ProjectDirectory}/%{ProjectNameL}/%{CppFileName}",
702+ "openInEditor": true
703+ },
704+ {
705+ "source": "appName/Main.qml",
706+ "target": "%{ProjectDirectory}/%{ProjectNameL}/Main.qml",
707+ "openInEditor": true
708+ },
709+ {
710+ "source": "appName/appName.desktop",
711+ "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.desktop"
712+ },
713+ {
714+ "source": "appName/appName.png",
715+ "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.png"
716+ },
717+ {
718+ "source": "appName/appName.pro",
719+ "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.pro"
720+ },
721+ {
722+ "source": "appName/appName.qrc",
723+ "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.qrc"
724+ },
725+ {
726+ "source": "appName/appName.wrapper",
727+ "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.wrapper",
728+ "userExecutable": true
729+ }
730+
731+ ]
732+ }
733+ ]
734+}
735
736=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml'
737--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml 2016-06-09 08:47:42 +0000
738+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml 2016-09-22 16:34:17 +0000
739@@ -80,7 +80,7 @@
740 spacing: units.gu(2)
741 Button {
742 visible: publishModel.showValidationUi
743- text: "Validate existing click package"
744+ text: "Validate existing package"
745 onClicked: {
746 publishModel.on_pushButtonReviewersTools_clicked();
747 }
748@@ -88,7 +88,7 @@
749 Button {
750 visible: publishModel.showValidationUi
751 enabled: publishModel.canBuild
752- text: "Build and validate click package"
753+ text: "Build and validate package"
754 onClicked: {
755 publishModel.on_pushButtonClickPackage_clicked();
756 }
757
758=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build'
759--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build 2016-08-26 14:14:29 +0000
760+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build 2016-09-22 16:34:17 +0000
761@@ -147,6 +147,7 @@
762 "qttools5-dev:{TARGET}",
763 "ubuntu-sdk-qmake-extras:{TARGET}",
764 "ubuntu-ui-toolkit-doc:{TARGET}",
765+ "snapcraft"
766 ],
767 "ubuntu-sdk-16.10": [
768 ]
769
770=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/plugin.pri'
771--- dist/qtcreator/src/plugins/ubuntu/src/plugin.pri 2016-06-09 08:47:42 +0000
772+++ dist/qtcreator/src/plugins/ubuntu/src/plugin.pri 2016-09-22 16:34:17 +0000
773@@ -71,3 +71,4 @@
774 LIBS += -L$$[QT_INSTALL_LIBS]/qtcreator
775 LIBS += -L$$[QT_INSTALL_LIBS]/qtcreator/plugins
776 }
777+
778
779=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp'
780--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-08-26 14:14:29 +0000
781+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-09-22 16:34:17 +0000
782@@ -1,5 +1,5 @@
783 /*
784- * Copyright 2014 Canonical Ltd.
785+ * Copyright 2016 Canonical Ltd.
786 *
787 * This program is free software; you can redistribute it and/or modify
788 * it under the terms of the GNU Lesser General Public License as published by
789
790=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h'
791--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-08-26 14:14:29 +0000
792+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-09-22 16:34:17 +0000
793@@ -1,5 +1,5 @@
794 /*
795- * Copyright 2014 Canonical Ltd.
796+ * Copyright 2016 Canonical Ltd.
797 *
798 * This program is free software; you can redistribute it and/or modify
799 * it under the terms of the GNU Lesser General Public License as published by
800
801=== added directory 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap'
802=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp'
803--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 1970-01-01 00:00:00 +0000
804+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 2016-09-22 16:34:17 +0000
805@@ -0,0 +1,468 @@
806+/*
807+ * Copyright 2016 Canonical Ltd.
808+ *
809+ * This program is free software; you can redistribute it and/or modify
810+ * it under the terms of the GNU Lesser General Public License as published by
811+ * the Free Software Foundation; version 2.1.
812+ *
813+ * This program is distributed in the hope that it will be useful,
814+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
815+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
816+ * GNU Lesser General Public License for more details.
817+ *
818+ * You should have received a copy of the GNU Lesser General Public License
819+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
820+ *
821+ * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
822+ */
823+
824+#include "snapcraftpackagestep.h"
825+
826+#include <ubuntu/ubuntuconstants.h>
827+#include <ubuntu/ubuntupackageoutputparser.h>
828+
829+#include <projectexplorer/target.h>
830+#include <projectexplorer/task.h>
831+#include <projectexplorer/kitinformation.h>
832+#include <projectexplorer/project.h>
833+#include <projectexplorer/projectexplorerconstants.h>
834+#include <projectexplorer/buildconfiguration.h>
835+#include <projectexplorer/toolchain.h>
836+#include <utils/qtcassert.h>
837+#include <utils/fileutils.h>
838+
839+#include <QTimer>
840+#include <QRegularExpression>
841+
842+namespace Ubuntu {
843+namespace Internal {
844+
845+const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
846+
847+SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl)
848+ : ProjectExplorer::BuildStep (bsl, Constants::UBUNTU_SNAP_PACKAGESTEP_ID)
849+{
850+
851+}
852+
853+SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl, SnapcraftPackageStep *other)
854+ : ProjectExplorer::BuildStep (bsl, other)
855+{
856+
857+}
858+
859+SnapcraftPackageStep::~SnapcraftPackageStep()
860+{
861+ cleanup();
862+}
863+
864+QString SnapcraftPackageStep::packagePath() const
865+{
866+ if(m_snapPackageName.isEmpty())
867+ return QString();
868+ return snapWorkingDir()
869+ + QDir::separator()
870+ + m_snapPackageName;
871+}
872+
873+QString SnapcraftPackageStep::snapWorkingDir() const
874+{
875+ return m_buildDir+QStringLiteral("/snap-deploy");
876+}
877+
878+bool SnapcraftPackageStep::init(QList<const ProjectExplorer::BuildStep *> &earlierSteps)
879+{
880+ Q_UNUSED(earlierSteps)
881+ return true;
882+}
883+
884+void SnapcraftPackageStep::run(QFutureInterface<bool> &fi)
885+{
886+ internalInit();
887+
888+ if (m_tasks.size()) {
889+ foreach (const ProjectExplorer::Task& task, m_tasks) {
890+ addTask(task);
891+ }
892+ emit addOutput(tr("Configuration is invalid. Aborting build")
893+ ,ProjectExplorer::BuildStep::MessageOutput);
894+
895+ reportRunResult(fi, false);
896+ cleanup();
897+ return;
898+ }
899+
900+ m_state = Idle;
901+ m_futureInterface = &fi;
902+ m_futureInterface->setProgressRange(0,2);
903+ QTimer::singleShot(0,this,SLOT(doNextStep()));
904+}
905+
906+void SnapcraftPackageStep::cleanup()
907+{
908+ if (m_process) {
909+ m_process->disconnect(this);
910+ m_process->kill();
911+ m_process->deleteLater();
912+ m_process = 0;
913+ }
914+
915+ //not owned by us
916+ m_futureInterface = 0;
917+
918+ if (m_outputParserChain) {
919+ delete m_outputParserChain;
920+ m_outputParserChain = 0;
921+ }
922+
923+ //reset params
924+ m_SnapReviewParam = m_MakeParam = ProjectExplorer::ProcessParameters();
925+ m_currParam = nullptr;
926+}
927+
928+/*!
929+ * \brief UbuntuPackageStep::setupAndStartProcess
930+ * Setups the interal QProcess and connects the required SIGNALS
931+ * also makes sure the process has a clean output parser
932+ */
933+void SnapcraftPackageStep::setupAndStartProcess(ProjectExplorer::ProcessParameters &params)
934+{
935+ if (m_process) {
936+ m_process->disconnect(this);
937+ m_process->kill();
938+ m_process->deleteLater();
939+ }
940+
941+ m_currParam = &params;
942+
943+ QDir wd(params.effectiveWorkingDirectory());
944+ if (!wd.exists())
945+ wd.mkpath(wd.absolutePath());
946+
947+ QString effectiveCommand = params.effectiveCommand();
948+ if (!QFileInfo(effectiveCommand).exists()) {
949+ onProcessFailedToStart();
950+ return;
951+ }
952+
953+ m_process = new Utils::QtcProcess();
954+ connect(m_process,SIGNAL(finished(int)),this,SLOT(doNextStep()));
955+ connect(m_process,SIGNAL(readyReadStandardOutput()),this,SLOT(onProcessStdOut()));
956+ connect(m_process,SIGNAL(readyReadStandardError()),this,SLOT(onProcessStdErr()));
957+
958+ m_process->setCommand(params.effectiveCommand(),params.effectiveArguments());
959+ m_process->setEnvironment(params.environment());
960+ m_process->setWorkingDirectory(wd.absolutePath());
961+
962+ emit addOutput(tr("Starting: \"%1 %2\"").arg(params.effectiveCommand(),params.effectiveArguments()),
963+ BuildStep::MessageOutput);
964+
965+ ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser();
966+
967+ //add special parser on click review step
968+ if(m_state == SnapReview) {
969+ UbuntuPackageOutputParser *packageStepParser = new UbuntuPackageOutputParser;
970+ //packageStepParser->setTreatAllErrorsAsWarnings(m_treatClickErrorsAsWarnings);
971+ connect(this,SIGNAL(currentSubStepFinished()),packageStepParser,SLOT(setEndOfData()));
972+ if (parser)
973+ parser->appendOutputParser(packageStepParser);
974+ else
975+ parser = packageStepParser;
976+
977+ }
978+
979+ if(m_outputParserChain) {
980+ delete m_outputParserChain;
981+ m_outputParserChain = 0;
982+ }
983+
984+ if(parser) {
985+ m_outputParserChain = parser;
986+ m_outputParserChain->setWorkingDirectory(params.effectiveWorkingDirectory());
987+
988+ connect(m_outputParserChain,SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)),
989+ this,SLOT(outputAdded(QString,ProjectExplorer::BuildStep::OutputFormat)));
990+ connect(m_outputParserChain,SIGNAL(addTask(ProjectExplorer::Task)),
991+ this,SLOT(taskAdded(ProjectExplorer::Task)));
992+ }
993+
994+ m_process->start();
995+ if(!m_process->waitForStarted()) {
996+ onProcessFailedToStart();
997+ return;
998+ }
999+}
1000+
1001+/*!
1002+ * \brief UbuntuPackageStep::checkLastProcessSuccess
1003+ * Checks if the last process has run without any errors
1004+ */
1005+bool SnapcraftPackageStep::processFinished(FinishedCheckMode mode)
1006+{
1007+ //make sure all data has been read
1008+ QString line = QString::fromLocal8Bit(m_process->readAllStandardError());
1009+ if (!line.isEmpty())
1010+ stdError(line);
1011+
1012+ line = QString::fromLocal8Bit(m_process->readAllStandardOutput());
1013+ if (!line.isEmpty())
1014+ stdOutput(line);
1015+
1016+ emit currentSubStepFinished();
1017+
1018+ bool success = true;
1019+
1020+ if (m_outputParserChain) {
1021+ m_outputParserChain->flush();
1022+
1023+ if(m_outputParserChain->hasFatalErrors())
1024+ success = false;
1025+ }
1026+
1027+ if(success) {
1028+ QString command;
1029+ if(m_currParam)
1030+ command = QDir::toNativeSeparators(m_currParam->effectiveCommand());
1031+ else
1032+ command = tr("Unknown command");
1033+
1034+ if (m_process->exitStatus() == QProcess::NormalExit && m_process->exitCode() == 0) {
1035+ emit addOutput(tr("The process \"%1\" exited normally.").arg(command),
1036+ BuildStep::MessageOutput);
1037+ } else if (m_process->exitStatus() == QProcess::NormalExit) {
1038+ emit addOutput(tr("The process \"%1\" exited with code %2.")
1039+ .arg(command, QString::number(m_process->exitCode())),
1040+ BuildStep::ErrorMessageOutput);
1041+ if(mode == CheckReturnCode)
1042+ //error
1043+ success = false;
1044+ else {
1045+ emit addOutput(tr("Ignoring return code for this step"),BuildStep::ErrorMessageOutput);
1046+ }
1047+ } else {
1048+ emit addOutput(tr("The process \"%1\" crashed.").arg(command), BuildStep::ErrorMessageOutput);
1049+
1050+ //error
1051+ success = false;
1052+ }
1053+ }
1054+
1055+ //the process failed, lets clean up
1056+ if (!success) {
1057+ if(m_futureInterface)
1058+ reportRunResult(*m_futureInterface, false);
1059+ cleanup();
1060+ }
1061+ return success;
1062+}
1063+
1064+void SnapcraftPackageStep::stdOutput(const QString &line)
1065+{
1066+ m_lastLine = line;
1067+
1068+ if (m_outputParserChain)
1069+ m_outputParserChain->stdOutput(line);
1070+ emit addOutput(line, BuildStep::NormalOutput, BuildStep::DontAppendNewline);
1071+}
1072+
1073+void SnapcraftPackageStep::stdError(const QString &line)
1074+{
1075+ if (m_outputParserChain)
1076+ m_outputParserChain->stdError(line);
1077+ emit addOutput(line, BuildStep::ErrorOutput, BuildStep::DontAppendNewline);
1078+}
1079+
1080+
1081+void SnapcraftPackageStep::onProcessStdOut()
1082+{
1083+ m_process->setReadChannel(QProcess::StandardOutput);
1084+ while (m_process->canReadLine()) {
1085+ QString line = QString::fromLocal8Bit(m_process->readLine());
1086+ stdOutput(line);
1087+ }
1088+}
1089+
1090+void SnapcraftPackageStep::onProcessStdErr()
1091+{
1092+ m_process->setReadChannel(QProcess::StandardError);
1093+ while (m_process->canReadLine()) {
1094+ QString line = QString::fromLocal8Bit(m_process->readLine());
1095+ stdError(line);
1096+ }
1097+}
1098+
1099+void SnapcraftPackageStep::outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format)
1100+{
1101+ emit addOutput(string, format, BuildStep::DontAppendNewline);
1102+}
1103+
1104+void SnapcraftPackageStep::taskAdded(const ProjectExplorer::Task &task)
1105+{
1106+ emit addTask(task);
1107+}
1108+
1109+void SnapcraftPackageStep::onProcessFailedToStart()
1110+{
1111+ if(m_futureInterface)
1112+ reportRunResult(*m_futureInterface, false);
1113+
1114+ QString command = tr("Unknown command");
1115+ QString args;
1116+
1117+ if (m_currParam) {
1118+ command = QDir::toNativeSeparators(m_currParam->effectiveCommand());
1119+ args = m_currParam->prettyArguments();
1120+ }
1121+
1122+ emit addOutput(tr("Could not start process \"%1\" %2")
1123+ .arg(command, args),
1124+ BuildStep::ErrorMessageOutput);
1125+
1126+ cleanup();
1127+
1128+}
1129+
1130+QString SnapcraftPackageStep::makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const
1131+{
1132+ if (tc)
1133+ return tc->makeCommand(env);
1134+ return QString();
1135+}
1136+
1137+
1138+ProjectExplorer::BuildStepConfigWidget *SnapcraftPackageStep::createConfigWidget()
1139+{
1140+ return nullptr;
1141+}
1142+
1143+void SnapcraftPackageStep::cancel()
1144+{
1145+
1146+}
1147+
1148+bool SnapcraftPackageStep::immutable() const
1149+{
1150+ return true;
1151+}
1152+
1153+bool SnapcraftPackageStep::runInGuiThread() const
1154+{
1155+ return true;
1156+}
1157+
1158+void SnapcraftPackageStep::doNextStep()
1159+{
1160+ switch (m_state) {
1161+ case Idle: {
1162+ m_state = MakeSnap;
1163+ m_currParam = nullptr;
1164+ setupAndStartProcess(m_MakeParam);
1165+ break;
1166+ }
1167+ case MakeSnap: {
1168+ if (!processFinished(CheckReturnCode))
1169+ return;
1170+
1171+ m_currParam = nullptr;
1172+
1173+ QRegularExpression exp((QLatin1String(PACKAGE_NAME_REGEX)));
1174+ QRegularExpressionMatch m = exp.match(m_lastLine);
1175+ if(m.hasMatch()) {
1176+ m_snapPackageName = m.captured(1);
1177+ emit addOutput(tr("The click package has been created in %1").arg(snapWorkingDir()) ,
1178+ ProjectExplorer::BuildStep::MessageOutput);
1179+ }
1180+
1181+ m_futureInterface->setProgressValueAndText(1,tr("Reviewing snap package"));
1182+ m_state = SnapReview;
1183+
1184+ m_SnapReviewParam.setArguments(QString::fromLatin1(Constants::CLICK_REVIEWERSTOOLS_ARGS).arg(packagePath()));
1185+ m_SnapReviewParam.resolveAll();
1186+ setupAndStartProcess(m_SnapReviewParam);
1187+ break;
1188+ }
1189+ case SnapReview: {
1190+ //we need to ignore the return code for now,
1191+ //until we have proper support for ignoring specific errors
1192+ if (!processFinished(IgnoreReturnCode))
1193+ return;
1194+
1195+ if(m_futureInterface)
1196+ reportRunResult(*m_futureInterface, true);
1197+ cleanup();
1198+ break;
1199+ }
1200+ }
1201+}
1202+
1203+void SnapcraftPackageStep::internalInit()
1204+{
1205+ m_tasks.clear();
1206+
1207+ QString projectDir = target()->project()->projectDirectory().toString();
1208+ m_buildDir.clear();
1209+ Utils::Environment env = Utils::Environment::systemEnvironment();
1210+ Utils::MacroExpander *mExp = 0;
1211+
1212+
1213+ ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
1214+ if (!bc) {
1215+ ProjectExplorer::Task t(ProjectExplorer::Task::Error
1216+ ,tr("No valid BuildConfiguration set for step: %1").arg(displayName())
1217+ ,Utils::FileName(),-1
1218+ ,ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
1219+ m_tasks.append(t);
1220+
1221+ //SnapcraftPackageStep::run will stop if tasks exist
1222+ return;
1223+
1224+ }
1225+
1226+ m_buildDir = bc->buildDirectory().toString();
1227+ env = bc->environment();
1228+ mExp = bc->macroExpander();
1229+
1230+ {
1231+ QStringList arguments {
1232+ QStringLiteral("snap")
1233+ };
1234+
1235+ ProjectExplorer::ProcessParameters* params = &m_MakeParam;
1236+ params->setMacroExpander(mExp);
1237+
1238+ //setup process parameters
1239+ params->setWorkingDirectory(m_buildDir);
1240+ params->setCommand(
1241+ makeCommand(ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit()),
1242+ env));
1243+ params->setArguments(Utils::QtcProcess::joinArgs(arguments));
1244+
1245+ Utils::Environment tmpenv = env;
1246+ // Force output to english for the parsers. Do this here and not in the toolchain's
1247+ // addToEnvironment() to not screw up the users run environment.
1248+ tmpenv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
1249+ params->setEnvironment(tmpenv);
1250+
1251+ params->resolveAll();
1252+ }
1253+
1254+ //builds the snap review arguments
1255+ {
1256+ ProjectExplorer::ProcessParameters* params = &m_SnapReviewParam;
1257+ params->setMacroExpander(mExp);
1258+
1259+ //setup process parameters
1260+ params->setWorkingDirectory(m_buildDir);
1261+ params->setCommand(QLatin1String(Constants::CLICK_REVIEWERSTOOLS_BINARY));
1262+
1263+ Utils::Environment tmpEnv = env;
1264+ // Force output to english for the parsers. Do this here and not in the toolchain's
1265+ // addToEnvironment() to not screw up the users run environment.
1266+ tmpEnv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
1267+ params->setEnvironment(tmpEnv);
1268+ }
1269+}
1270+
1271+
1272+} // namespace Internal
1273+} // namespace Ubuntu
1274
1275=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h'
1276--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h 1970-01-01 00:00:00 +0000
1277+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h 2016-09-22 16:34:17 +0000
1278@@ -0,0 +1,105 @@
1279+/*
1280+ * Copyright 2016 Canonical Ltd.
1281+ *
1282+ * This program is free software; you can redistribute it and/or modify
1283+ * it under the terms of the GNU Lesser General Public License as published by
1284+ * the Free Software Foundation; version 2.1.
1285+ *
1286+ * This program is distributed in the hope that it will be useful,
1287+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1288+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1289+ * GNU Lesser General Public License for more details.
1290+ *
1291+ * You should have received a copy of the GNU Lesser General Public License
1292+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1293+ *
1294+ * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
1295+ */
1296+
1297+#ifndef UBUNTU_INTERNAL_SNAPCRAFTPACKAGESTEP_H
1298+#define UBUNTU_INTERNAL_SNAPCRAFTPACKAGESTEP_H
1299+
1300+
1301+#include <projectexplorer/buildstep.h>
1302+#include <projectexplorer/ioutputparser.h>
1303+#include <projectexplorer/processparameters.h>
1304+#include <utils/qtcprocess.h>
1305+
1306+namespace ProjectExplorer{
1307+class ToolChain;
1308+}
1309+
1310+namespace Ubuntu {
1311+namespace Internal {
1312+
1313+class SnapcraftPackageStep : public ProjectExplorer::BuildStep
1314+{
1315+ Q_OBJECT
1316+public:
1317+
1318+ enum State {
1319+ Idle,
1320+ MakeSnap,
1321+ SnapReview
1322+ };
1323+
1324+ enum FinishedCheckMode {
1325+ CheckReturnCode,
1326+ IgnoreReturnCode
1327+ };
1328+
1329+ SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl);
1330+ SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl, SnapcraftPackageStep *other);
1331+ virtual ~SnapcraftPackageStep();
1332+
1333+ QString packagePath () const;
1334+ QString snapWorkingDir () const;
1335+
1336+ // BuildStep interface
1337+ virtual bool init(QList<const ProjectExplorer::BuildStep *> &earlierSteps) override;
1338+ virtual void run(QFutureInterface<bool> &fi) override;
1339+ virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
1340+ virtual void cancel() override;
1341+ virtual bool immutable() const override;
1342+ virtual bool runInGuiThread() const override;
1343+
1344+signals:
1345+ void currentSubStepFinished();
1346+
1347+protected slots:
1348+ void doNextStep ();
1349+ void onProcessFailedToStart();
1350+ void onProcessStdOut();
1351+ void onProcessStdErr();
1352+ void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
1353+ void taskAdded (const ProjectExplorer::Task & task);
1354+
1355+private:
1356+ void internalInit ();
1357+ void cleanup();
1358+ QString makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const;
1359+ void setupAndStartProcess(ProjectExplorer::ProcessParameters &params);
1360+ void stdOutput(const QString &line);
1361+ void stdError(const QString &line);
1362+ bool processFinished(FinishedCheckMode mode);
1363+
1364+private:
1365+ State m_state = SnapcraftPackageStep::Idle;
1366+ QList<ProjectExplorer::Task> m_tasks;
1367+ QFutureInterface<bool> *m_futureInterface;
1368+
1369+ Utils::QtcProcess *m_process = nullptr;
1370+ ProjectExplorer::IOutputParser *m_outputParserChain = nullptr;
1371+
1372+ QString m_buildDir;
1373+ QString m_lastLine;
1374+ QString m_snapPackageName;
1375+ ProjectExplorer::ProcessParameters m_MakeParam;
1376+ ProjectExplorer::ProcessParameters m_SnapReviewParam;
1377+ ProjectExplorer::ProcessParameters *m_currParam = nullptr;
1378+};
1379+
1380+} // namespace Internal
1381+} // namespace Ubuntu
1382+
1383+#endif // UBUNTU_INTERNAL_SNAPCRAFTPACKAGESTEP_H
1384
1385=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp'
1386--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp 1970-01-01 00:00:00 +0000
1387+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp 2016-09-22 16:34:17 +0000
1388@@ -0,0 +1,30 @@
1389+#include "snaphelper.h"
1390+
1391+#include <projectexplorer/project.h>
1392+#include <qmakeprojectmanager/qmakeproject.h>
1393+#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
1394+
1395+namespace Ubuntu {
1396+namespace Internal {
1397+
1398+SnapHelper::SnapHelper()
1399+{
1400+
1401+}
1402+
1403+bool SnapHelper::isSnappyProject(ProjectExplorer::Project *project)
1404+{
1405+ if (!project)
1406+ return false;
1407+
1408+ QString mimeType = project->projectManager()->mimeType();
1409+ if(mimeType != QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE))
1410+ return false;
1411+
1412+ QmakeProjectManager::QmakeProject *qPro = static_cast<QmakeProjectManager::QmakeProject *>(project);
1413+ QmakeProjectManager::QmakeProFileNode *node = qPro->rootProjectNode();
1414+ return node->variableValue(QmakeProjectManager::ConfigVar).contains(QStringLiteral("snapcraft"), Qt::CaseInsensitive);
1415+}
1416+
1417+} // namespace Internal
1418+} // namespace Ubuntu
1419
1420=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h'
1421--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h 1970-01-01 00:00:00 +0000
1422+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h 2016-09-22 16:34:17 +0000
1423@@ -0,0 +1,22 @@
1424+#ifndef UBUNTU_INTERNAL_SNAPHELPER_H
1425+#define UBUNTU_INTERNAL_SNAPHELPER_H
1426+
1427+namespace ProjectExplorer {
1428+class Project;
1429+}
1430+
1431+namespace Ubuntu {
1432+namespace Internal {
1433+
1434+class SnapHelper
1435+{
1436+public:
1437+ SnapHelper();
1438+
1439+ static bool isSnappyProject (ProjectExplorer::Project* project);
1440+};
1441+
1442+} // namespace Internal
1443+} // namespace Ubuntu
1444+
1445+#endif // UBUNTU_INTERNAL_SNAPHELPER_H
1446
1447=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h'
1448--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-08-26 14:14:29 +0000
1449+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-09-22 16:34:17 +0000
1450@@ -344,6 +344,7 @@
1451 const char UBUNTU_DEPLOY_UPLOADSTEP_ID[] = "UbuntuProjectManager.UploadStep";
1452 const char UBUNTU_DEPLOY_MAKESTEP_ID[] = "UbuntuProjectManager.UbuntuCMake.DeployMakeStep";
1453 const char UBUNTU_CLICK_PACKAGESTEP_ID[] = "UbuntuProjectManager.ClickPackageStep";
1454+const char UBUNTU_SNAP_PACKAGESTEP_ID[] = "UbuntuProjectManager.SnapPackageStep";
1455 const char UBUNTU_DEPLOY_DESTDIR[] = ".ubuntu-sdk-deploy";
1456 const char UBUNTU_CLICK_SUCCESS_PACKAGE_REGEX[] = "^.*'(.*)'.$";
1457
1458
1459=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp'
1460--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 1970-01-01 00:00:00 +0000
1461+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 2016-09-22 16:34:17 +0000
1462@@ -0,0 +1,46 @@
1463+/*
1464+ * Copyright 2016 Canonical Ltd.
1465+ *
1466+ * This program is free software; you can redistribute it and/or modify
1467+ * it under the terms of the GNU Lesser General Public License as published by
1468+ * the Free Software Foundation; version 2.1.
1469+ *
1470+ * This program is distributed in the hope that it will be useful,
1471+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1472+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1473+ * GNU Lesser General Public License for more details.
1474+ *
1475+ * You should have received a copy of the GNU Lesser General Public License
1476+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1477+ *
1478+ * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
1479+ */
1480+#include "ubuntujsextension.h"
1481+#include <ubuntu/ubuntubzr.h>
1482+
1483+namespace Ubuntu {
1484+namespace Internal {
1485+
1486+UbuntuJsExtension::UbuntuJsExtension(QObject *parent) : QObject(parent)
1487+{
1488+
1489+}
1490+
1491+QString UbuntuJsExtension::developerId() const
1492+{
1493+ QString maintainer = QStringLiteral("username");
1494+ UbuntuBzr *bzr = UbuntuBzr::instance();
1495+
1496+ if(!bzr->isInitialized()) {
1497+ bzr->initialize();
1498+ bzr->waitForFinished();
1499+ }
1500+
1501+ if(bzr->isInitialized()) {
1502+ maintainer = bzr->launchpadId();
1503+ }
1504+
1505+ return maintainer;
1506+}
1507+
1508+}}
1509
1510=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h'
1511--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 1970-01-01 00:00:00 +0000
1512+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 2016-09-22 16:34:17 +0000
1513@@ -0,0 +1,37 @@
1514+/*
1515+ * Copyright 2016 Canonical Ltd.
1516+ *
1517+ * This program is free software; you can redistribute it and/or modify
1518+ * it under the terms of the GNU Lesser General Public License as published by
1519+ * the Free Software Foundation; version 2.1.
1520+ *
1521+ * This program is distributed in the hope that it will be useful,
1522+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1523+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1524+ * GNU Lesser General Public License for more details.
1525+ *
1526+ * You should have received a copy of the GNU Lesser General Public License
1527+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1528+ *
1529+ * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
1530+ */
1531+#ifndef UBUNTUJSEXTENSION_H
1532+#define UBUNTUJSEXTENSION_H
1533+
1534+#include <QObject>
1535+
1536+namespace Ubuntu {
1537+namespace Internal {
1538+
1539+class UbuntuJsExtension : public QObject
1540+{
1541+ Q_OBJECT
1542+public:
1543+ explicit UbuntuJsExtension(QObject *parent = 0);
1544+
1545+ Q_INVOKABLE QString developerId() const;
1546+};
1547+
1548+}}
1549+
1550+#endif // UBUNTUJSEXTENSION_H
1551
1552=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp'
1553--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp 2016-09-05 17:35:40 +0000
1554+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp 2016-09-22 16:34:17 +0000
1555@@ -30,6 +30,8 @@
1556 #include "ubuntuproject.h"
1557
1558 #include <ubuntu/device/remote/ubuntudevice.h>
1559+#include <ubuntu/snap/snaphelper.h>
1560+#include <ubuntu/snap/snapcraftpackagestep.h>
1561
1562 #include <projectexplorer/projectexplorer.h>
1563 #include <projectexplorer/project.h>
1564@@ -159,7 +161,6 @@
1565 m_ubuntuProcess.append(QStringList() << QString::fromLatin1(Constants::CLICK_REVIEWERSTOOLS_LOCATION).arg(sClickPackagePath));
1566 m_ubuntuProcess.start(QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE)).arg(sClickPackagePath));
1567 }
1568-
1569 }
1570
1571 void UbuntuPackagingModel::onMessage(QString msg)
1572@@ -294,6 +295,16 @@
1573 if(!project)
1574 return;
1575
1576+ if (SnapHelper::isSnappyProject(project)) {
1577+ if(m_reviewToolsInstalled)
1578+ m_postPackageTask = Verify;
1579+ else
1580+ m_postPackageTask = None;
1581+
1582+ buildSnapPackage();
1583+ return;
1584+ }
1585+
1586 QString mimeType = project->projectManager()->mimeType();
1587 if(mimeType == QLatin1String(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE)
1588 || mimeType == QLatin1String(Ubuntu::Constants::UBUNTUPROJECT_MIMETYPE)
1589@@ -303,6 +314,7 @@
1590 m_postPackageTask = Verify;
1591 else
1592 m_postPackageTask = None;
1593+
1594 buildClickPackage();
1595 } else {
1596 m_UbuntuMenu_connection = QObject::connect(UbuntuMenu::instance(),SIGNAL(finished_action(const QProcess*,QString)),this,SLOT(onFinishedAction(const QProcess*,QString)));
1597@@ -330,10 +342,11 @@
1598 if (success) {
1599 //the step that created the click package is always in the last list and always the last step
1600 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(m_packageBuildSteps.last()->steps().last());
1601- if (pckStep && !pckStep->packagePath().isEmpty()) {
1602+ SnapcraftPackageStep *snapPckStep = qobject_cast<SnapcraftPackageStep*>(m_packageBuildSteps.last()->steps().last());
1603+ if ((pckStep && !pckStep->packagePath().isEmpty()) || (snapPckStep && !snapPckStep->packagePath().isEmpty())) {
1604 m_ubuntuProcess.stop();
1605
1606- QString sClickPackagePath = pckStep->packagePath();
1607+ QString sClickPackagePath = pckStep ? pckStep->packagePath() : snapPckStep->packagePath();
1608 if (sClickPackagePath.isEmpty()) {
1609 clearPackageBuildList();
1610 return;
1611@@ -381,19 +394,34 @@
1612 void UbuntuPackagingModel::buildAndInstallPackageRequested()
1613 {
1614 m_postPackageTask = Install;
1615+
1616+ if (SnapHelper::isSnappyProject(ProjectExplorer::SessionManager::startupProject())) {
1617+ QMessageBox::information(Core::ICore::mainWindow(), qApp->applicationName(),
1618+ tr("Installing is currently not supported for snappy projects."));
1619+ return;
1620+ }
1621+
1622 buildClickPackage();
1623 }
1624
1625 void UbuntuPackagingModel::buildAndVerifyPackageRequested()
1626 {
1627 m_postPackageTask = Verify;
1628- buildClickPackage();
1629+
1630+ if (SnapHelper::isSnappyProject(ProjectExplorer::SessionManager::startupProject()))
1631+ buildSnapPackage();
1632+ else
1633+ buildClickPackage();
1634 }
1635
1636 void UbuntuPackagingModel::buildPackageRequested()
1637 {
1638 m_postPackageTask = None;
1639- buildClickPackage();
1640+
1641+ if (SnapHelper::isSnappyProject(ProjectExplorer::SessionManager::startupProject()))
1642+ buildSnapPackage();
1643+ else
1644+ buildClickPackage();
1645 }
1646
1647 void UbuntuPackagingModel::targetChanged()
1648@@ -561,6 +589,59 @@
1649 }
1650 }
1651
1652+void UbuntuPackagingModel::buildSnapPackage()
1653+{
1654+ ProjectExplorer::Project* project = ProjectExplorer::SessionManager::startupProject();
1655+ if(!project) {
1656+ QMessageBox::warning(Core::ICore::mainWindow(),tr("No Project"),tr("No valid project loaded."));
1657+ return;
1658+ }
1659+
1660+ if(ProjectExplorer::BuildManager::isBuilding()) {
1661+ QMessageBox::information(Core::ICore::mainWindow(),tr("Build running"),tr("There is currently a build running, please wait for it to be finished"));
1662+ return;
1663+ }
1664+
1665+ if(!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
1666+ return;
1667+
1668+ if(!SnapHelper::isSnappyProject(project))
1669+ return;
1670+
1671+ ProjectExplorer::Target* target = project->activeTarget();
1672+ if(!target)
1673+ return;
1674+
1675+ ProjectExplorer::BuildConfiguration* bc = target->activeBuildConfiguration();
1676+ if(!bc) {
1677+ QMessageBox::information(Core::ICore::mainWindow(),tr("Error"),tr("Please add a valid buildconfiguration to your project"));
1678+ return;
1679+ }
1680+
1681+ if(!bc->isEnabled()) {
1682+ QString disabledReason = bc->disabledReason();
1683+ QMessageBox::information(Core::ICore::mainWindow(),tr("Disabled"),tr("The currently selected Buildconfiguration is disabled. %1").arg(disabledReason));
1684+ return;
1685+ }
1686+
1687+ clearPackageBuildList();
1688+
1689+ m_packageBuildSteps.append(QSharedPointer<ProjectExplorer::BuildStepList> (new ProjectExplorer::BuildStepList(bc,ProjectExplorer::Constants::BUILDSTEPS_BUILD)));
1690+ ProjectExplorer::BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
1691+ if (buildSteps && buildSteps->count() > 0) {
1692+ //add the normal buildsteps
1693+ m_packageBuildSteps.last()->cloneSteps(buildSteps);
1694+ }
1695+
1696+ //append the snap packaging step
1697+ SnapcraftPackageStep *package = new SnapcraftPackageStep(m_packageBuildSteps.last().data());
1698+ m_packageBuildSteps.last()->appendStep(package);
1699+
1700+ m_buildManagerConnection = connect(ProjectExplorer::BuildManager::instance(),SIGNAL(buildQueueFinished(bool)),this,SLOT(buildFinished(bool)));
1701+
1702+ ProjectExplorer::BuildManager::buildList(m_packageBuildSteps.last().data(),tr("Build Project"));
1703+}
1704+
1705 /*!
1706 * \brief UbuntuPackagingWidget::clearAdditionalBuildSteps
1707 * Clears the last used additional buildsteps
1708
1709=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h'
1710--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h 2016-06-09 08:47:42 +0000
1711+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h 2016-09-22 16:34:17 +0000
1712@@ -95,6 +95,7 @@
1713
1714 private:
1715 void buildClickPackage ();
1716+ void buildSnapPackage ();
1717 void clearPackageBuildList ();
1718 void updateFrameworkList ();
1719 void resetValidationResult ();
1720
1721=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp'
1722--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-09-05 17:35:40 +0000
1723+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-09-22 16:34:17 +0000
1724@@ -49,9 +49,11 @@
1725 #include <ubuntu/device/remote/ubunturemotedeployconfiguration.h>
1726 #include <ubuntu/device/remote/ubuntudeploystepfactory.h>
1727
1728-#include "wizards/ubuntuprojectapplicationwizard.h"
1729-#include "wizards/ubuntufirstrunwizard.h"
1730-#include "wizards/ubuntuprojectmigrationwizard.h"
1731+#include <ubuntu/wizards/ubuntuprojectapplicationwizard.h>
1732+#include <ubuntu/wizards/ubuntufirstrunwizard.h>
1733+#include <ubuntu/wizards/ubuntuprojectmigrationwizard.h>
1734+
1735+#include "ubuntujsextension.h"
1736
1737 #include <coreplugin/modemanager.h>
1738 #include <projectexplorer/kitmanager.h>
1739@@ -60,6 +62,7 @@
1740 #include <projectexplorer/processparameters.h>
1741 #include <coreplugin/featureprovider.h>
1742 #include <coreplugin/coreplugin.h>
1743+#include <coreplugin/jsexpander.h>
1744 #include <utils/mimetypes/mimedatabase.h>
1745 #include <utils/mimetypes/mimeglobpattern_p.h>
1746 #include <cmakeprojectmanager/cmaketoolmanager.h>
1747@@ -233,6 +236,9 @@
1748 addAutoReleasedObject(new Internal::UbuntuManifestEditorFactory);
1749 addAutoReleasedObject(new Internal::UbuntuApparmorEditorFactory);
1750
1751+ //Ubuntu expander
1752+ Core::JsExpander::registerQObjectForJs(QStringLiteral("Ubuntu"), new UbuntuJsExtension);
1753+
1754 //trigger kit autodetection and update after projectexplorer loaded the kits
1755 connect(ProjectExplorer::KitManager::instance(),SIGNAL(kitsLoaded())
1756 ,this,SLOT(onKitsLoaded()));
1757
1758=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp'
1759--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp 2016-09-05 17:35:40 +0000
1760+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp 2016-09-22 16:34:17 +0000
1761@@ -18,11 +18,13 @@
1762
1763 #include "ubuntuprojectapplicationwizard.h"
1764 #include "ubuntufirstrunwizard.h"
1765-#include "../ubuntushared.h"
1766-#include "../ubuntuconstants.h"
1767-#include "../ubuntuproject.h"
1768-#include "../ubuntubzr.h"
1769-#include "../ubuntuclicktool.h"
1770+
1771+#include <ubuntu/ubuntushared.h>
1772+#include <ubuntu/ubuntushared.h>
1773+#include <ubuntu/ubuntuconstants.h>
1774+#include <ubuntu/ubuntuproject.h>
1775+#include <ubuntu/ubuntubzr.h>
1776+#include <ubuntu/ubuntuclicktool.h>
1777
1778 #include <utils/qtcassert.h>
1779 #include <utils/pathchooser.h>
1780
1781=== modified file 'fix-qt-build.py'
1782--- fix-qt-build.py 2016-09-14 14:37:07 +0000
1783+++ fix-qt-build.py 2016-09-22 16:34:17 +0000
1784@@ -24,7 +24,7 @@
1785 for root, dirs, files in os.walk(workDir):
1786 for file in files:
1787 if file.endswith("ubuntu_save_gitmodules"):
1788- shutil.move(os.path.join(root, file), os.path.join(root, ".gitmodules"))
1789+ shutil.copy2(os.path.join(root, file), os.path.join(root, ".gitmodules"))
1790
1791 #all subdirectores need a .git dir
1792 for entry in os.listdir(workDir):

Subscribers

People subscribed via source and target branches