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

Proposed by Benjamin Zeller
Status: Merged
Approved by: Zoltan Balogh
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
Zoltan Balogh Approve
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.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

let's see it in action in the meantime

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-09-14 14:37:07 +0000
+++ CMakeLists.txt 2016-09-22 16:34:17 +0000
@@ -86,7 +86,7 @@
86ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)86ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG)
8787
88add_custom_target(ApplyPatches88add_custom_target(ApplyPatches
89 env QUILT_PATCHES=debian/patches quilt push -a89 ${CMAKE_SOURCE_DIR}/apply-patches.sh
90 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})90 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
9191
92ExternalProject_Add(${QT_VERSION}92ExternalProject_Add(${QT_VERSION}
9393
=== added file 'apply-patches.sh'
--- apply-patches.sh 1970-01-01 00:00:00 +0000
+++ apply-patches.sh 2016-09-22 16:34:17 +0000
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3env QUILT_PATCHES=debian/patches quilt push -a
4
5RESULT=$?
6
7if [ $RESULT -eq 0 -o $RESULT -eq 2 ]; then
8 exit 0
9fi
10
11exit 1
12
013
=== modified file 'debian/patches/cmake_ubuntuspecificbits.diff'
--- debian/patches/cmake_ubuntuspecificbits.diff 2016-09-15 12:31:17 +0000
+++ debian/patches/cmake_ubuntuspecificbits.diff 2016-09-22 16:34:17 +0000
@@ -1,8 +1,6 @@
1Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp1--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
2===================================================================2+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
3--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp3@@ -165,10 +165,10 @@
4+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
5@@ -165,10 +165,10 @@ void CMakeManager::createXmlFile(Utils::
6 proc->setWorkingDirectory(buildDirectoryPath);4 proc->setWorkingDirectory(buildDirectoryPath);
7 proc->setEnvironment(env);5 proc->setEnvironment(env);
8 6
@@ -16,11 +14,9 @@
16 Utils::QtcProcess::addArgs(&args, arguments);14 Utils::QtcProcess::addArgs(&args, arguments);
17 15
18 proc->setCommand(executable, args);16 proc->setCommand(executable, args);
19Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp17--- a/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
20===================================================================18+++ b/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
21--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp19@@ -288,9 +288,10 @@
22+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp
23@@ -288,9 +288,10 @@ Internal::Manager *QmlProject::projectMa
24 bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const20 bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const
25 {21 {
26 Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);22 Id deviceType = DeviceTypeKitInformation::deviceTypeId(k);
@@ -33,11 +29,9 @@
33 return false;29 return false;
34 }30 }
35 31
36Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp32--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
37===================================================================33+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
38--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp34@@ -2024,6 +2024,7 @@
39+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp
40@@ -2024,6 +2024,7 @@ EvalResult *QmakeProFileNode::evaluate(c
41 result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS"));35 result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS"));
42 result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS"));36 result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS"));
43 result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME"));37 result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME"));
@@ -45,11 +39,9 @@
45 39
46 result->isDeployable = false;40 result->isDeployable = false;
47 if (result->projectType == ApplicationTemplate) {41 if (result->projectType == ApplicationTemplate) {
48Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h42--- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
49===================================================================43+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
50--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h44@@ -107,7 +107,8 @@
51+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h
52@@ -107,7 +107,8 @@ enum QmakeVariable {
53 AndroidPackageSourceDir,45 AndroidPackageSourceDir,
54 AndroidExtraLibs,46 AndroidExtraLibs,
55 IsoIconsVar,47 IsoIconsVar,
@@ -59,10 +51,8 @@
59 };51 };
60 52
61 namespace Internal {53 namespace Internal {
62Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h54--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
63===================================================================55+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
64--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
65+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h
66@@ -25,6 +25,8 @@56@@ -25,6 +25,8 @@
67 57
68 #pragma once58 #pragma once
@@ -72,7 +62,7 @@
72 #include <QByteArray>62 #include <QByteArray>
73 #include <QList>63 #include <QList>
74 64
75@@ -34,7 +36,7 @@ namespace ProjectExplorer { class Kit; }65@@ -34,7 +36,7 @@
76 66
77 namespace CMakeProjectManager {67 namespace CMakeProjectManager {
78 68
@@ -81,11 +71,9 @@
81 public:71 public:
82 enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC };72 enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC };
83 CMakeConfigItem();73 CMakeConfigItem();
84Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp74--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
85===================================================================75+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
86--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp76@@ -568,6 +568,11 @@
87+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp
88@@ -568,6 +568,11 @@ bool QtVersionManager::isValidId(int id)
89 return m_versions.contains(id);77 return m_versions.contains(id);
90 }78 }
91 79
@@ -97,11 +85,9 @@
97 BaseQtVersion *QtVersionManager::version(int id)85 BaseQtVersion *QtVersionManager::version(int id)
98 {86 {
99 QTC_ASSERT(isLoaded(), return 0);87 QTC_ASSERT(isLoaded(), return 0);
100Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h88--- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
101===================================================================89+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
102--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h90@@ -63,6 +63,7 @@
103+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h
104@@ -63,6 +63,7 @@ public:
105 static void removeVersion(BaseQtVersion *version);91 static void removeVersion(BaseQtVersion *version);
106 92
107 static bool isValidId(int id);93 static bool isValidId(int id);
@@ -109,11 +95,9 @@
109 95
110 signals:96 signals:
111 // content of BaseQtVersion objects with qmake path might have changed97 // content of BaseQtVersion objects with qmake path might have changed
112Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro98--- a/dist/qtcreator/src/plugins/plugins.pro
113===================================================================99+++ b/dist/qtcreator/src/plugins/plugins.pro
114--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/plugins.pro100@@ -56,7 +56,8 @@
115+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro
116@@ -56,7 +56,8 @@ SUBDIRS = \
117 winrt \101 winrt \
118 qmlprofiler \102 qmlprofiler \
119 updateinfo \103 updateinfo \
@@ -123,11 +107,9 @@
123 107
124 DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)108 DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER)
125 isEmpty(DO_NOT_BUILD_QMLDESIGNER) {109 isEmpty(DO_NOT_BUILD_QMLDESIGNER) {
126Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro110--- a/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
127===================================================================111+++ b/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
128--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro112@@ -11,10 +11,10 @@
129+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro
130@@ -11,10 +11,10 @@ load(qt_parts)
131 src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher113 src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher
132 src_uitk_launcher.depends = sub-src114 src_uitk_launcher.depends = sub-src
133 115
@@ -141,11 +123,9 @@
141 123
142 # additional 'make test' target required by continuous integration system124 # additional 'make test' target required by continuous integration system
143 test.target = test125 test.target = test
144Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp126--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
145===================================================================127+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
146--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp128@@ -387,6 +387,18 @@
147+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp
148@@ -387,6 +387,18 @@ void CMakeProject::runCMake()
149 }129 }
150 }130 }
151 131
@@ -164,10 +144,8 @@
164 QList<CMakeBuildTarget> CMakeProject::buildTargets() const144 QList<CMakeBuildTarget> CMakeProject::buildTargets() const
165 {145 {
166 BuildDirManager *bdm = nullptr;146 BuildDirManager *bdm = nullptr;
167Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h147--- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
168===================================================================148+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
169--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
170+++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h
171@@ -27,6 +27,7 @@149@@ -27,6 +27,7 @@
172 150
173 #include "cmake_global.h"151 #include "cmake_global.h"
@@ -176,7 +154,7 @@
176 154
177 #include <projectexplorer/extracompiler.h>155 #include <projectexplorer/extracompiler.h>
178 #include <projectexplorer/project.h>156 #include <projectexplorer/project.h>
179@@ -111,6 +112,8 @@ public:157@@ -111,6 +112,8 @@
180 158
181 void runCMake();159 void runCMake();
182 160
@@ -185,11 +163,9 @@
185 signals:163 signals:
186 /// emitted when cmake is running:164 /// emitted when cmake is running:
187 void parsingStarted();165 void parsingStarted();
188Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp166--- a/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
189===================================================================167+++ b/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
190--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp168@@ -249,11 +249,11 @@
191+++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp
192@@ -249,11 +249,11 @@ PlatformMenuWrapper::PlatformMenuWrapper
193 , m_target(target)169 , m_target(target)
194 , m_inserted(false)170 , m_inserted(false)
195 {171 {
@@ -206,3 +182,68 @@
206 182
207 syncPlatformMenu();183 syncPlatformMenu();
208 }184 }
185--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
186+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp
187@@ -161,6 +161,12 @@
188
189 Utils::FileSaver saver(m_d->path, flags);
190 saver.write(m_d->contents);
191+
192+ if (attributes() & UserExecutable) {
193+ QFile *createdFile = saver.file();
194+ createdFile->setPermissions(createdFile->permissions() | QFileDevice::ExeOwner);
195+ }
196+
197 return saver.finalize(errorMessage);
198 }
199
200--- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
201+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.h
202@@ -46,7 +46,9 @@
203 /* File exists and the user indicated that he wants to keep it */
204 KeepExistingFileAttribute = 0x8,
205 /* Force overwriting of a file without asking the user to keep it */
206- ForceOverwrite = 0x10
207+ ForceOverwrite = 0x10,
208+ /* Set User executable flag*/
209+ UserExecutable = 0x20
210 };
211 Q_DECLARE_FLAGS(Attributes, Attribute)
212
213--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
214+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp
215@@ -70,6 +70,7 @@
216 f.overwrite = tmp.value(QLatin1String("overwrite"), false);
217 f.openInEditor = tmp.value(QLatin1String("openInEditor"), false);
218 f.openAsProject = tmp.value(QLatin1String("openAsProject"), false);
219+ f.isUserExecutable = tmp.value(QLatin1String("userExecutable"), false);
220
221 f.options = JsonWizard::parseOptions(tmp.value(QLatin1String("options")), errorMessage);
222 if (!errorMessage->isEmpty())
223@@ -146,6 +147,8 @@
224 attributes |= Core::GeneratedFile::OpenProjectAttribute;
225 if (JsonWizard::boolFromVariant(file.overwrite, expander))
226 attributes |= Core::GeneratedFile::ForceOverwrite;
227+ if (JsonWizard::boolFromVariant(file.isUserExecutable, expander))
228+ attributes |= Core::GeneratedFile::UserExecutable;
229
230 if (file.keepExisting)
231 attributes |= Core::GeneratedFile::KeepExistingFileAttribute;
232@@ -231,6 +234,7 @@
233 if (!file->write(errorMessage))
234 return false;
235 }
236+
237 return true;
238 }
239
240--- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
241+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h
242@@ -55,6 +55,7 @@
243 QVariant overwrite = false;
244 QVariant openInEditor = false;
245 QVariant openAsProject = false;
246+ QVariant isUserExecutable = false;
247
248 QList<JsonWizard::OptionDefinition> options;
249 };
209250
=== modified file 'dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro'
--- dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-09-05 17:35:40 +0000
+++ dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-09-22 16:34:17 +0000
@@ -106,7 +106,10 @@
106 src/ubuntu/device/container/ubuntulocaldeployconfiguration.cpp \106 src/ubuntu/device/container/ubuntulocaldeployconfiguration.cpp \
107 src/ubuntu/device/container/ubuntulocalrunconfigurationfactory.cpp \107 src/ubuntu/device/container/ubuntulocalrunconfigurationfactory.cpp \
108 src/ubuntu/device/container/ubuntulocalrunconfiguration.cpp \108 src/ubuntu/device/container/ubuntulocalrunconfiguration.cpp \
109 src/ubuntu/processoutputdialog.cpp109 src/ubuntu/processoutputdialog.cpp \
110 $$PWD/src/ubuntu/ubuntujsextension.cpp \
111 src/ubuntu/snap/snapcraftpackagestep.cpp \
112 src/ubuntu/snap/snaphelper.cpp
110113
111HEADERS += \114HEADERS += \
112 src/ubuntu/ubuntuplugin.h \115 src/ubuntu/ubuntuplugin.h \
@@ -175,7 +178,10 @@
175 src/ubuntu/device/container/ubuntulocaldeployconfiguration.h \178 src/ubuntu/device/container/ubuntulocaldeployconfiguration.h \
176 src/ubuntu/device/container/ubuntulocalrunconfigurationfactory.h \179 src/ubuntu/device/container/ubuntulocalrunconfigurationfactory.h \
177 src/ubuntu/device/container/ubuntulocalrunconfiguration.h \180 src/ubuntu/device/container/ubuntulocalrunconfiguration.h \
178 src/ubuntu/processoutputdialog.h181 src/ubuntu/processoutputdialog.h \
182 $$PWD/src/ubuntu/ubuntujsextension.h \
183 src/ubuntu/snap/snapcraftpackagestep.h \
184 src/ubuntu/snap/snaphelper.h
179185
180#remote device support186#remote device support
181SOURCES += \187SOURCES += \
@@ -214,6 +220,7 @@
214 src/ubuntu/device/remote/ubuntudirectuploadstep.h \220 src/ubuntu/device/remote/ubuntudirectuploadstep.h \
215 src/ubuntu/device/remote/ubuntudeploystepfactory.h221 src/ubuntu/device/remote/ubuntudeploystepfactory.h
216222
223
217FORMS += \224FORMS += \
218 src/ubuntu/device/remote/ubunturemoterunconfigurationwidget.ui \225 src/ubuntu/device/remote/ubunturemoterunconfigurationwidget.ui \
219226
220227
=== added directory 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake'
=== added directory 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName'
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName.pro 2016-09-22 16:34:17 +0000
@@ -0,0 +1,32 @@
1# This is the basic qmake template for the Ubuntu-SDK
2# it handles creation and installation of the manifest
3# file and takes care of subprojects
4TEMPLATE = subdirs
5
6SUBDIRS += %{ProjectNameL}
7
8# enables/disabled the extra targets to build a snapcraft package
9# also tells the IDE this is a snapcraft project
10CONFIG += snapcraft
11
12snapcraft {
13
14 SNAPCRAFT_FILE=snapcraft.yaml
15
16 #the Ubuntu SDK IDE uses the snap target to create the package
17 snappy.target = snap
18 snappy.commands = cd $$OUT_PWD
19 snappy.commands += && rm -rf \'$$OUT_PWD/snap-deploy\'
20 snappy.commands += && make INSTALL_ROOT=$$OUT_PWD/snap-deploy install
21 snappy.commands += && cd $$OUT_PWD/snap-deploy
22 snappy.commands += && snapcraft
23
24 OTHER_FILES+=$$SNAPCRAFT_FILE
25 QMAKE_EXTRA_TARGETS += snappy
26
27 packaging.files = $$SNAPCRAFT_FILE
28 packaging.path = /
29
30 INSTALLS+=packaging
31}
32
033
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/Main.qml 2016-09-22 16:34:17 +0000
@@ -0,0 +1,54 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3
4/*!
5 \brief MainView with a Label and Button elements.
6*/
7
8MainView {
9 // objectName for functional testing purposes (autopilot-qt5)
10 objectName: "mainView"
11
12 applicationName: "%{ProjectNameL}.%{DeveloperId}"
13
14 width: units.gu(100)
15 height: units.gu(75)
16
17 Page {
18 header: PageHeader {
19 id: pageHeader
20 title: i18n.tr("%{ProjectNameL}")
21 StyleHints {
22 foregroundColor: UbuntuColors.orange
23 backgroundColor: UbuntuColors.porcelain
24 dividerColor: UbuntuColors.slate
25 }
26 }
27
28 Label {
29 id: label
30 objectName: "label"
31 anchors {
32 horizontalCenter: parent.horizontalCenter
33 top: pageHeader.bottom
34 topMargin: units.gu(2)
35 }
36
37 text: i18n.tr("Hello..")
38 }
39
40 Button {
41 objectName: "button"
42 anchors {
43 horizontalCenter: parent.horizontalCenter
44 top: label.bottom
45 topMargin: units.gu(2)
46 }
47 width: parent.width
48 text: i18n.tr("Tap me!")
49 onClicked: {
50 label.text = i18n.tr("..world!")
51 }
52 }
53 }
54}
055
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.desktop 2016-09-22 16:34:17 +0000
@@ -0,0 +1,9 @@
1[Desktop Entry]
2Version=1.0
3Name=%{ProjectNameL}
4Exec=%{ProjectNameL}
5TryExec=%{ProjectNameL}
6Icon=${SNAP}/meta/gui/%{ProjectNameL}.png
7Terminal=false
8Type=Application
9X-Ubuntu-Touch=true
010
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.png'
1Binary 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 differ11Binary 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
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.pro 2016-09-22 16:34:17 +0000
@@ -0,0 +1,48 @@
1TEMPLATE = app
2TARGET = %{ProjectNameL}
3
4QT += qml quick
5
6# enables/disabled the extra targets to build a snapcraft package
7# also tells the IDE this is a snapcraft project
8CONFIG += snapcraft
9
10SOURCES += main.cpp
11
12RESOURCES += %{ProjectNameL}.qrc
13
14QML_FILES += $$files(*.qml,true) \
15 $$files(*.js,true)
16
17CONF_FILES += %{ProjectNameL}.png
18
19AP_TEST_FILES += tests/autopilot/run \
20 $$files(tests/*.py,true)
21
22#show all the files in QtCreator
23OTHER_FILES += $${CONF_FILES} \
24 $${QML_FILES} \
25 $${AP_TEST_FILES} \
26 %{ProjectNameL}.desktop \
27 %{ProjectNameL}.wrapper
28
29snapcraft {
30 #specify where the config files are installed to
31 config_files.path = /setup/gui
32 config_files.files += $${CONF_FILES}
33 INSTALLS+=config_files
34
35 #install the desktop file
36 desktop_file.path = /setup/gui
37 desktop_file.files = $$PWD/%{ProjectNameL}.desktop
38 desktop_file.CONFIG += no_check_exist
39 INSTALLS+=desktop_file
40
41 # Default rules for deployment.
42
43 wrapper.files = %{ProjectNameL}.wrapper
44 wrapper.path = /deploy/bin
45
46 target.path = /deploy/bin
47 INSTALLS+=target wrapper
48}
049
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.qrc 2016-09-22 16:34:17 +0000
@@ -0,0 +1,5 @@
1<RCC>
2 <qresource prefix="/">
3 <file>Main.qml</file>
4 </qresource>
5</RCC>
06
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/appName.wrapper 2016-09-22 16:34:17 +0000
@@ -0,0 +1,63 @@
1#!/bin/bash
2
3if [ "$SNAP_ARCH" == "amd64" ]; then
4 ARCH="x86_64-linux-gnu"
5elif [ "$SNAP_ARCH" == "armhf" ]; then
6 ARCH="arm-linux-gnueabihf"
7else
8 ARCH="$SNAP_ARCH-linux-gnu"
9fi
10
11export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH:$LD_LIBRARY_PATH
12
13# XKB config
14export XKB_CONFIG_ROOT=$SNAP/usr/share/X11/xkb
15
16if [ "$DESKTOP_SESSION" == "unity8" ]; then
17 # Qt Platform to Mir
18 export QT_QPA_PLATFORM=ubuntumirclient
19 # Mir runtime
20 export MIR_SOCKET=$XDG_RUNTIME_DIR/mir_socket
21 export MIR_CLIENT_PLATFORM_PATH=$SNAP/usr/lib/$ARCH/mir/client-platform
22fi
23
24# Qt Libs
25export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/qt5/libs:$LD_LIBRARY_PATH
26export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/pulseaudio:$LD_LIBRARY_PATH
27
28# Qt Modules
29export QT_PLUGIN_PATH=$SNAP/usr/lib/$ARCH/qt5/plugins
30export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$SNAP/usr/lib/$ARCH/qt5/qml
31export QML2_IMPORT_PATH=$QML2_IMPORT_PATH:$SNAP/lib/$ARCH
32
33# Mesa Libs
34export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH
35export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH
36
37# XDG Config
38export XDG_CONFIG_DIRS=$SNAP/etc/xdg:$XDG_CONFIG_DIRS
39export XDG_CONFIG_DIRS=$SNAP/usr/xdg:$XDG_CONFIG_DIRS
40# Note: this doesn't seem to work, QML's LocalStorage either ignores
41# or fails to use $SNAP_USER_DATA if defined here
42export XDG_DATA_DIRS=$SNAP_USER_DATA:$XDG_DATA_DIRS
43export XDG_DATA_DIRS=$SNAP/usr/share:$XDG_DATA_DIRS
44
45# needed for fontconfig
46export XDG_DATA_HOME=$SNAP/usr/share
47
48# Font Config
49export FONTCONFIG_PATH=$SNAP/etc/fonts/config.d
50export FONTCONFIG_FILE=$SNAP/etc/fonts/fonts.conf
51
52# Tell libGL where to find the drivers
53export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri
54
55# Necessary for the SDK to find the translations directory
56export APP_DIR=$SNAP
57
58# ensure the snappy gl libs win
59export LD_LIBRARY_PATH="$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH"
60
61cd $SNAP
62exec $SNAP/bin/%{ProjectNameL}
63
064
=== added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/appName/main.cpp 2016-09-22 16:34:17 +0000
@@ -0,0 +1,14 @@
1#include <QGuiApplication>
2#include <QQmlApplicationEngine>
3#include <QQuickView>
4
5int main(int argc, char *argv[])
6{
7 QGuiApplication app(argc, argv);
8
9 QQuickView view;
10 view.setSource(QUrl(QStringLiteral("qrc:///Main.qml")));
11 view.setResizeMode(QQuickView::SizeRootObjectToView);
12 view.show();
13 return app.exec();
14}
015
=== added 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 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 2016-09-22 16:34:17 +0000
@@ -0,0 +1,23 @@
1name: %{ProjectNameL}
2version: 0.01
3summary: Example application
4description: Shows a basic UITK based UI
5confinement: strict
6
7apps:
8 %{ProjectNameL}:
9 command: %{ProjectNameL}.wrapper
10 plugs: [unity7, opengl]
11
12parts:
13 %{ProjectNameL}:
14 plugin: dump
15 source: deploy/
16 stage-packages:
17 - ubuntu-sdk-libs
18 - qtubuntu-desktop
19 - qtmir-desktop
20 - mir-graphics-drivers-desktop
21
22
23
024
=== added 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 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 2016-09-22 16:34:17 +0000
@@ -0,0 +1,108 @@
1{
2 "version": 1,
3 "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
4 "id": "A.QtQuick Snappy Application",
5 "category": "B.Snapcraft",
6 "trDescription": "Creates a experimental C++ Ubuntu snappy application project with a sample UI containing a Label and a Button.",
7 "trDisplayName": "QtQuick App with QML Ubuntu UI",
8 "trDisplayCategory": "Snapcraft",
9 "icon": "../share/ubuntu.png",
10 "enabled": "%{JS: [ %{Plugins} ].indexOf('QmakeProjectManager') >= 0}",
11
12 "options":
13 [
14 { "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" },
15 { "key": "ProjectNameL", "value": "%{JS: \"%{ProjectName}\".toLowerCase()}" },
16 { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" },
17 { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" }
18 ],
19
20 "pages":
21 [
22 {
23 "trDisplayName": "Project Location",
24 "trShortTitle": "Location",
25 "typeId": "Project"
26 },
27 {
28 "trDisplayName": "Developer ID",
29 "trShortTitle": "Developer ID",
30 "typeId": "Fields",
31 "data" :
32 [
33 {
34 "name": "DeveloperId",
35 "trDisplayName": "Developer ID:",
36 "mandatory": true,
37 "type": "LineEdit",
38 "data": {
39 "validator": "^[A-Za-z0-9-]+$",
40 "trText": "%{JS: Ubuntu.developerId()}"
41 }
42 }
43 ]
44 },
45 {
46 "trDisplayName": "Kit Selection",
47 "trShortTitle": "Kits",
48 "typeId": "Kits",
49 "enabled": "%{IsTopLevelProject}",
50 "data": { "projectFilePath": "%{ProjectFile}" }
51 },
52 {
53 "trDisplayName": "Project Management",
54 "trShortTitle": "Summary",
55 "typeId": "Summary"
56 }
57 ],
58 "generators":
59 [
60 {
61 "typeId": "File",
62 "data":
63 [
64 {
65 "source": "appName.pro",
66 "target": "%{ProjectFile}",
67 "openAsProject": true
68 },
69 {
70 "source": "snapcraft.yaml",
71 "openInEditor": true
72 },
73 {
74 "source": "appName/main.cpp",
75 "target": "%{ProjectDirectory}/%{ProjectNameL}/%{CppFileName}",
76 "openInEditor": true
77 },
78 {
79 "source": "appName/Main.qml",
80 "target": "%{ProjectDirectory}/%{ProjectNameL}/Main.qml",
81 "openInEditor": true
82 },
83 {
84 "source": "appName/appName.desktop",
85 "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.desktop"
86 },
87 {
88 "source": "appName/appName.png",
89 "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.png"
90 },
91 {
92 "source": "appName/appName.pro",
93 "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.pro"
94 },
95 {
96 "source": "appName/appName.qrc",
97 "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.qrc"
98 },
99 {
100 "source": "appName/appName.wrapper",
101 "target": "%{ProjectDirectory}/%{ProjectNameL}/%{ProjectNameL}.wrapper",
102 "userExecutable": true
103 }
104
105 ]
106 }
107 ]
108}
0109
=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml 2016-06-09 08:47:42 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/qml/publishpage.qml 2016-09-22 16:34:17 +0000
@@ -80,7 +80,7 @@
80 spacing: units.gu(2)80 spacing: units.gu(2)
81 Button {81 Button {
82 visible: publishModel.showValidationUi82 visible: publishModel.showValidationUi
83 text: "Validate existing click package"83 text: "Validate existing package"
84 onClicked: {84 onClicked: {
85 publishModel.on_pushButtonReviewersTools_clicked();85 publishModel.on_pushButtonReviewersTools_clicked();
86 }86 }
@@ -88,7 +88,7 @@
88 Button {88 Button {
89 visible: publishModel.showValidationUi89 visible: publishModel.showValidationUi
90 enabled: publishModel.canBuild90 enabled: publishModel.canBuild
91 text: "Build and validate click package"91 text: "Build and validate package"
92 onClicked: {92 onClicked: {
93 publishModel.on_pushButtonClickPackage_clicked();93 publishModel.on_pushButtonClickPackage_clicked();
94 }94 }
9595
=== modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build'
--- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build 2016-08-26 14:14:29 +0000
+++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/usdk-target-build 2016-09-22 16:34:17 +0000
@@ -147,6 +147,7 @@
147 "qttools5-dev:{TARGET}",147 "qttools5-dev:{TARGET}",
148 "ubuntu-sdk-qmake-extras:{TARGET}",148 "ubuntu-sdk-qmake-extras:{TARGET}",
149 "ubuntu-ui-toolkit-doc:{TARGET}",149 "ubuntu-ui-toolkit-doc:{TARGET}",
150 "snapcraft"
150 ],151 ],
151 "ubuntu-sdk-16.10": [152 "ubuntu-sdk-16.10": [
152 ]153 ]
153154
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/plugin.pri'
--- dist/qtcreator/src/plugins/ubuntu/src/plugin.pri 2016-06-09 08:47:42 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/plugin.pri 2016-09-22 16:34:17 +0000
@@ -71,3 +71,4 @@
71 LIBS += -L$$[QT_INSTALL_LIBS]/qtcreator71 LIBS += -L$$[QT_INSTALL_LIBS]/qtcreator
72 LIBS += -L$$[QT_INSTALL_LIBS]/qtcreator/plugins72 LIBS += -L$$[QT_INSTALL_LIBS]/qtcreator/plugins
73}73}
74
7475
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-08-26 14:14:29 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-09-22 16:34:17 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2014 Canonical Ltd.2 * Copyright 2016 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
66
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-08-26 14:14:29 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-09-22 16:34:17 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright 2014 Canonical Ltd.2 * Copyright 2016 Canonical Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by5 * it under the terms of the GNU Lesser General Public License as published by
66
=== added directory 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap'
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 2016-09-22 16:34:17 +0000
@@ -0,0 +1,468 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 2.1.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
17 */
18
19#include "snapcraftpackagestep.h"
20
21#include <ubuntu/ubuntuconstants.h>
22#include <ubuntu/ubuntupackageoutputparser.h>
23
24#include <projectexplorer/target.h>
25#include <projectexplorer/task.h>
26#include <projectexplorer/kitinformation.h>
27#include <projectexplorer/project.h>
28#include <projectexplorer/projectexplorerconstants.h>
29#include <projectexplorer/buildconfiguration.h>
30#include <projectexplorer/toolchain.h>
31#include <utils/qtcassert.h>
32#include <utils/fileutils.h>
33
34#include <QTimer>
35#include <QRegularExpression>
36
37namespace Ubuntu {
38namespace Internal {
39
40const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$";
41
42SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl)
43 : ProjectExplorer::BuildStep (bsl, Constants::UBUNTU_SNAP_PACKAGESTEP_ID)
44{
45
46}
47
48SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl, SnapcraftPackageStep *other)
49 : ProjectExplorer::BuildStep (bsl, other)
50{
51
52}
53
54SnapcraftPackageStep::~SnapcraftPackageStep()
55{
56 cleanup();
57}
58
59QString SnapcraftPackageStep::packagePath() const
60{
61 if(m_snapPackageName.isEmpty())
62 return QString();
63 return snapWorkingDir()
64 + QDir::separator()
65 + m_snapPackageName;
66}
67
68QString SnapcraftPackageStep::snapWorkingDir() const
69{
70 return m_buildDir+QStringLiteral("/snap-deploy");
71}
72
73bool SnapcraftPackageStep::init(QList<const ProjectExplorer::BuildStep *> &earlierSteps)
74{
75 Q_UNUSED(earlierSteps)
76 return true;
77}
78
79void SnapcraftPackageStep::run(QFutureInterface<bool> &fi)
80{
81 internalInit();
82
83 if (m_tasks.size()) {
84 foreach (const ProjectExplorer::Task& task, m_tasks) {
85 addTask(task);
86 }
87 emit addOutput(tr("Configuration is invalid. Aborting build")
88 ,ProjectExplorer::BuildStep::MessageOutput);
89
90 reportRunResult(fi, false);
91 cleanup();
92 return;
93 }
94
95 m_state = Idle;
96 m_futureInterface = &fi;
97 m_futureInterface->setProgressRange(0,2);
98 QTimer::singleShot(0,this,SLOT(doNextStep()));
99}
100
101void SnapcraftPackageStep::cleanup()
102{
103 if (m_process) {
104 m_process->disconnect(this);
105 m_process->kill();
106 m_process->deleteLater();
107 m_process = 0;
108 }
109
110 //not owned by us
111 m_futureInterface = 0;
112
113 if (m_outputParserChain) {
114 delete m_outputParserChain;
115 m_outputParserChain = 0;
116 }
117
118 //reset params
119 m_SnapReviewParam = m_MakeParam = ProjectExplorer::ProcessParameters();
120 m_currParam = nullptr;
121}
122
123/*!
124 * \brief UbuntuPackageStep::setupAndStartProcess
125 * Setups the interal QProcess and connects the required SIGNALS
126 * also makes sure the process has a clean output parser
127 */
128void SnapcraftPackageStep::setupAndStartProcess(ProjectExplorer::ProcessParameters &params)
129{
130 if (m_process) {
131 m_process->disconnect(this);
132 m_process->kill();
133 m_process->deleteLater();
134 }
135
136 m_currParam = &params;
137
138 QDir wd(params.effectiveWorkingDirectory());
139 if (!wd.exists())
140 wd.mkpath(wd.absolutePath());
141
142 QString effectiveCommand = params.effectiveCommand();
143 if (!QFileInfo(effectiveCommand).exists()) {
144 onProcessFailedToStart();
145 return;
146 }
147
148 m_process = new Utils::QtcProcess();
149 connect(m_process,SIGNAL(finished(int)),this,SLOT(doNextStep()));
150 connect(m_process,SIGNAL(readyReadStandardOutput()),this,SLOT(onProcessStdOut()));
151 connect(m_process,SIGNAL(readyReadStandardError()),this,SLOT(onProcessStdErr()));
152
153 m_process->setCommand(params.effectiveCommand(),params.effectiveArguments());
154 m_process->setEnvironment(params.environment());
155 m_process->setWorkingDirectory(wd.absolutePath());
156
157 emit addOutput(tr("Starting: \"%1 %2\"").arg(params.effectiveCommand(),params.effectiveArguments()),
158 BuildStep::MessageOutput);
159
160 ProjectExplorer::IOutputParser *parser = target()->kit()->createOutputParser();
161
162 //add special parser on click review step
163 if(m_state == SnapReview) {
164 UbuntuPackageOutputParser *packageStepParser = new UbuntuPackageOutputParser;
165 //packageStepParser->setTreatAllErrorsAsWarnings(m_treatClickErrorsAsWarnings);
166 connect(this,SIGNAL(currentSubStepFinished()),packageStepParser,SLOT(setEndOfData()));
167 if (parser)
168 parser->appendOutputParser(packageStepParser);
169 else
170 parser = packageStepParser;
171
172 }
173
174 if(m_outputParserChain) {
175 delete m_outputParserChain;
176 m_outputParserChain = 0;
177 }
178
179 if(parser) {
180 m_outputParserChain = parser;
181 m_outputParserChain->setWorkingDirectory(params.effectiveWorkingDirectory());
182
183 connect(m_outputParserChain,SIGNAL(addOutput(QString,ProjectExplorer::BuildStep::OutputFormat)),
184 this,SLOT(outputAdded(QString,ProjectExplorer::BuildStep::OutputFormat)));
185 connect(m_outputParserChain,SIGNAL(addTask(ProjectExplorer::Task)),
186 this,SLOT(taskAdded(ProjectExplorer::Task)));
187 }
188
189 m_process->start();
190 if(!m_process->waitForStarted()) {
191 onProcessFailedToStart();
192 return;
193 }
194}
195
196/*!
197 * \brief UbuntuPackageStep::checkLastProcessSuccess
198 * Checks if the last process has run without any errors
199 */
200bool SnapcraftPackageStep::processFinished(FinishedCheckMode mode)
201{
202 //make sure all data has been read
203 QString line = QString::fromLocal8Bit(m_process->readAllStandardError());
204 if (!line.isEmpty())
205 stdError(line);
206
207 line = QString::fromLocal8Bit(m_process->readAllStandardOutput());
208 if (!line.isEmpty())
209 stdOutput(line);
210
211 emit currentSubStepFinished();
212
213 bool success = true;
214
215 if (m_outputParserChain) {
216 m_outputParserChain->flush();
217
218 if(m_outputParserChain->hasFatalErrors())
219 success = false;
220 }
221
222 if(success) {
223 QString command;
224 if(m_currParam)
225 command = QDir::toNativeSeparators(m_currParam->effectiveCommand());
226 else
227 command = tr("Unknown command");
228
229 if (m_process->exitStatus() == QProcess::NormalExit && m_process->exitCode() == 0) {
230 emit addOutput(tr("The process \"%1\" exited normally.").arg(command),
231 BuildStep::MessageOutput);
232 } else if (m_process->exitStatus() == QProcess::NormalExit) {
233 emit addOutput(tr("The process \"%1\" exited with code %2.")
234 .arg(command, QString::number(m_process->exitCode())),
235 BuildStep::ErrorMessageOutput);
236 if(mode == CheckReturnCode)
237 //error
238 success = false;
239 else {
240 emit addOutput(tr("Ignoring return code for this step"),BuildStep::ErrorMessageOutput);
241 }
242 } else {
243 emit addOutput(tr("The process \"%1\" crashed.").arg(command), BuildStep::ErrorMessageOutput);
244
245 //error
246 success = false;
247 }
248 }
249
250 //the process failed, lets clean up
251 if (!success) {
252 if(m_futureInterface)
253 reportRunResult(*m_futureInterface, false);
254 cleanup();
255 }
256 return success;
257}
258
259void SnapcraftPackageStep::stdOutput(const QString &line)
260{
261 m_lastLine = line;
262
263 if (m_outputParserChain)
264 m_outputParserChain->stdOutput(line);
265 emit addOutput(line, BuildStep::NormalOutput, BuildStep::DontAppendNewline);
266}
267
268void SnapcraftPackageStep::stdError(const QString &line)
269{
270 if (m_outputParserChain)
271 m_outputParserChain->stdError(line);
272 emit addOutput(line, BuildStep::ErrorOutput, BuildStep::DontAppendNewline);
273}
274
275
276void SnapcraftPackageStep::onProcessStdOut()
277{
278 m_process->setReadChannel(QProcess::StandardOutput);
279 while (m_process->canReadLine()) {
280 QString line = QString::fromLocal8Bit(m_process->readLine());
281 stdOutput(line);
282 }
283}
284
285void SnapcraftPackageStep::onProcessStdErr()
286{
287 m_process->setReadChannel(QProcess::StandardError);
288 while (m_process->canReadLine()) {
289 QString line = QString::fromLocal8Bit(m_process->readLine());
290 stdError(line);
291 }
292}
293
294void SnapcraftPackageStep::outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format)
295{
296 emit addOutput(string, format, BuildStep::DontAppendNewline);
297}
298
299void SnapcraftPackageStep::taskAdded(const ProjectExplorer::Task &task)
300{
301 emit addTask(task);
302}
303
304void SnapcraftPackageStep::onProcessFailedToStart()
305{
306 if(m_futureInterface)
307 reportRunResult(*m_futureInterface, false);
308
309 QString command = tr("Unknown command");
310 QString args;
311
312 if (m_currParam) {
313 command = QDir::toNativeSeparators(m_currParam->effectiveCommand());
314 args = m_currParam->prettyArguments();
315 }
316
317 emit addOutput(tr("Could not start process \"%1\" %2")
318 .arg(command, args),
319 BuildStep::ErrorMessageOutput);
320
321 cleanup();
322
323}
324
325QString SnapcraftPackageStep::makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const
326{
327 if (tc)
328 return tc->makeCommand(env);
329 return QString();
330}
331
332
333ProjectExplorer::BuildStepConfigWidget *SnapcraftPackageStep::createConfigWidget()
334{
335 return nullptr;
336}
337
338void SnapcraftPackageStep::cancel()
339{
340
341}
342
343bool SnapcraftPackageStep::immutable() const
344{
345 return true;
346}
347
348bool SnapcraftPackageStep::runInGuiThread() const
349{
350 return true;
351}
352
353void SnapcraftPackageStep::doNextStep()
354{
355 switch (m_state) {
356 case Idle: {
357 m_state = MakeSnap;
358 m_currParam = nullptr;
359 setupAndStartProcess(m_MakeParam);
360 break;
361 }
362 case MakeSnap: {
363 if (!processFinished(CheckReturnCode))
364 return;
365
366 m_currParam = nullptr;
367
368 QRegularExpression exp((QLatin1String(PACKAGE_NAME_REGEX)));
369 QRegularExpressionMatch m = exp.match(m_lastLine);
370 if(m.hasMatch()) {
371 m_snapPackageName = m.captured(1);
372 emit addOutput(tr("The click package has been created in %1").arg(snapWorkingDir()) ,
373 ProjectExplorer::BuildStep::MessageOutput);
374 }
375
376 m_futureInterface->setProgressValueAndText(1,tr("Reviewing snap package"));
377 m_state = SnapReview;
378
379 m_SnapReviewParam.setArguments(QString::fromLatin1(Constants::CLICK_REVIEWERSTOOLS_ARGS).arg(packagePath()));
380 m_SnapReviewParam.resolveAll();
381 setupAndStartProcess(m_SnapReviewParam);
382 break;
383 }
384 case SnapReview: {
385 //we need to ignore the return code for now,
386 //until we have proper support for ignoring specific errors
387 if (!processFinished(IgnoreReturnCode))
388 return;
389
390 if(m_futureInterface)
391 reportRunResult(*m_futureInterface, true);
392 cleanup();
393 break;
394 }
395 }
396}
397
398void SnapcraftPackageStep::internalInit()
399{
400 m_tasks.clear();
401
402 QString projectDir = target()->project()->projectDirectory().toString();
403 m_buildDir.clear();
404 Utils::Environment env = Utils::Environment::systemEnvironment();
405 Utils::MacroExpander *mExp = 0;
406
407
408 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
409 if (!bc) {
410 ProjectExplorer::Task t(ProjectExplorer::Task::Error
411 ,tr("No valid BuildConfiguration set for step: %1").arg(displayName())
412 ,Utils::FileName(),-1
413 ,ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
414 m_tasks.append(t);
415
416 //SnapcraftPackageStep::run will stop if tasks exist
417 return;
418
419 }
420
421 m_buildDir = bc->buildDirectory().toString();
422 env = bc->environment();
423 mExp = bc->macroExpander();
424
425 {
426 QStringList arguments {
427 QStringLiteral("snap")
428 };
429
430 ProjectExplorer::ProcessParameters* params = &m_MakeParam;
431 params->setMacroExpander(mExp);
432
433 //setup process parameters
434 params->setWorkingDirectory(m_buildDir);
435 params->setCommand(
436 makeCommand(ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit()),
437 env));
438 params->setArguments(Utils::QtcProcess::joinArgs(arguments));
439
440 Utils::Environment tmpenv = env;
441 // Force output to english for the parsers. Do this here and not in the toolchain's
442 // addToEnvironment() to not screw up the users run environment.
443 tmpenv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
444 params->setEnvironment(tmpenv);
445
446 params->resolveAll();
447 }
448
449 //builds the snap review arguments
450 {
451 ProjectExplorer::ProcessParameters* params = &m_SnapReviewParam;
452 params->setMacroExpander(mExp);
453
454 //setup process parameters
455 params->setWorkingDirectory(m_buildDir);
456 params->setCommand(QLatin1String(Constants::CLICK_REVIEWERSTOOLS_BINARY));
457
458 Utils::Environment tmpEnv = env;
459 // Force output to english for the parsers. Do this here and not in the toolchain's
460 // addToEnvironment() to not screw up the users run environment.
461 tmpEnv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
462 params->setEnvironment(tmpEnv);
463 }
464}
465
466
467} // namespace Internal
468} // namespace Ubuntu
0469
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.h 2016-09-22 16:34:17 +0000
@@ -0,0 +1,105 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 2.1.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
17 */
18
19#ifndef UBUNTU_INTERNAL_SNAPCRAFTPACKAGESTEP_H
20#define UBUNTU_INTERNAL_SNAPCRAFTPACKAGESTEP_H
21
22
23#include <projectexplorer/buildstep.h>
24#include <projectexplorer/ioutputparser.h>
25#include <projectexplorer/processparameters.h>
26#include <utils/qtcprocess.h>
27
28namespace ProjectExplorer{
29class ToolChain;
30}
31
32namespace Ubuntu {
33namespace Internal {
34
35class SnapcraftPackageStep : public ProjectExplorer::BuildStep
36{
37 Q_OBJECT
38public:
39
40 enum State {
41 Idle,
42 MakeSnap,
43 SnapReview
44 };
45
46 enum FinishedCheckMode {
47 CheckReturnCode,
48 IgnoreReturnCode
49 };
50
51 SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl);
52 SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl, SnapcraftPackageStep *other);
53 virtual ~SnapcraftPackageStep();
54
55 QString packagePath () const;
56 QString snapWorkingDir () const;
57
58 // BuildStep interface
59 virtual bool init(QList<const ProjectExplorer::BuildStep *> &earlierSteps) override;
60 virtual void run(QFutureInterface<bool> &fi) override;
61 virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
62 virtual void cancel() override;
63 virtual bool immutable() const override;
64 virtual bool runInGuiThread() const override;
65
66signals:
67 void currentSubStepFinished();
68
69protected slots:
70 void doNextStep ();
71 void onProcessFailedToStart();
72 void onProcessStdOut();
73 void onProcessStdErr();
74 void outputAdded(const QString &string, ProjectExplorer::BuildStep::OutputFormat format);
75 void taskAdded (const ProjectExplorer::Task & task);
76
77private:
78 void internalInit ();
79 void cleanup();
80 QString makeCommand(ProjectExplorer::ToolChain *tc, const Utils::Environment &env) const;
81 void setupAndStartProcess(ProjectExplorer::ProcessParameters &params);
82 void stdOutput(const QString &line);
83 void stdError(const QString &line);
84 bool processFinished(FinishedCheckMode mode);
85
86private:
87 State m_state = SnapcraftPackageStep::Idle;
88 QList<ProjectExplorer::Task> m_tasks;
89 QFutureInterface<bool> *m_futureInterface;
90
91 Utils::QtcProcess *m_process = nullptr;
92 ProjectExplorer::IOutputParser *m_outputParserChain = nullptr;
93
94 QString m_buildDir;
95 QString m_lastLine;
96 QString m_snapPackageName;
97 ProjectExplorer::ProcessParameters m_MakeParam;
98 ProjectExplorer::ProcessParameters m_SnapReviewParam;
99 ProjectExplorer::ProcessParameters *m_currParam = nullptr;
100};
101
102} // namespace Internal
103} // namespace Ubuntu
104
105#endif // UBUNTU_INTERNAL_SNAPCRAFTPACKAGESTEP_H
0106
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.cpp 2016-09-22 16:34:17 +0000
@@ -0,0 +1,30 @@
1#include "snaphelper.h"
2
3#include <projectexplorer/project.h>
4#include <qmakeprojectmanager/qmakeproject.h>
5#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
6
7namespace Ubuntu {
8namespace Internal {
9
10SnapHelper::SnapHelper()
11{
12
13}
14
15bool SnapHelper::isSnappyProject(ProjectExplorer::Project *project)
16{
17 if (!project)
18 return false;
19
20 QString mimeType = project->projectManager()->mimeType();
21 if(mimeType != QLatin1String(QmakeProjectManager::Constants::PROFILE_MIMETYPE))
22 return false;
23
24 QmakeProjectManager::QmakeProject *qPro = static_cast<QmakeProjectManager::QmakeProject *>(project);
25 QmakeProjectManager::QmakeProFileNode *node = qPro->rootProjectNode();
26 return node->variableValue(QmakeProjectManager::ConfigVar).contains(QStringLiteral("snapcraft"), Qt::CaseInsensitive);
27}
28
29} // namespace Internal
30} // namespace Ubuntu
031
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snaphelper.h 2016-09-22 16:34:17 +0000
@@ -0,0 +1,22 @@
1#ifndef UBUNTU_INTERNAL_SNAPHELPER_H
2#define UBUNTU_INTERNAL_SNAPHELPER_H
3
4namespace ProjectExplorer {
5class Project;
6}
7
8namespace Ubuntu {
9namespace Internal {
10
11class SnapHelper
12{
13public:
14 SnapHelper();
15
16 static bool isSnappyProject (ProjectExplorer::Project* project);
17};
18
19} // namespace Internal
20} // namespace Ubuntu
21
22#endif // UBUNTU_INTERNAL_SNAPHELPER_H
023
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-08-26 14:14:29 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-09-22 16:34:17 +0000
@@ -344,6 +344,7 @@
344const char UBUNTU_DEPLOY_UPLOADSTEP_ID[] = "UbuntuProjectManager.UploadStep";344const char UBUNTU_DEPLOY_UPLOADSTEP_ID[] = "UbuntuProjectManager.UploadStep";
345const char UBUNTU_DEPLOY_MAKESTEP_ID[] = "UbuntuProjectManager.UbuntuCMake.DeployMakeStep";345const char UBUNTU_DEPLOY_MAKESTEP_ID[] = "UbuntuProjectManager.UbuntuCMake.DeployMakeStep";
346const char UBUNTU_CLICK_PACKAGESTEP_ID[] = "UbuntuProjectManager.ClickPackageStep";346const char UBUNTU_CLICK_PACKAGESTEP_ID[] = "UbuntuProjectManager.ClickPackageStep";
347const char UBUNTU_SNAP_PACKAGESTEP_ID[] = "UbuntuProjectManager.SnapPackageStep";
347const char UBUNTU_DEPLOY_DESTDIR[] = ".ubuntu-sdk-deploy";348const char UBUNTU_DEPLOY_DESTDIR[] = ".ubuntu-sdk-deploy";
348const char UBUNTU_CLICK_SUCCESS_PACKAGE_REGEX[] = "^.*'(.*)'.$";349const char UBUNTU_CLICK_SUCCESS_PACKAGE_REGEX[] = "^.*'(.*)'.$";
349350
350351
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 2016-09-22 16:34:17 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 2.1.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
17 */
18#include "ubuntujsextension.h"
19#include <ubuntu/ubuntubzr.h>
20
21namespace Ubuntu {
22namespace Internal {
23
24UbuntuJsExtension::UbuntuJsExtension(QObject *parent) : QObject(parent)
25{
26
27}
28
29QString UbuntuJsExtension::developerId() const
30{
31 QString maintainer = QStringLiteral("username");
32 UbuntuBzr *bzr = UbuntuBzr::instance();
33
34 if(!bzr->isInitialized()) {
35 bzr->initialize();
36 bzr->waitForFinished();
37 }
38
39 if(bzr->isInitialized()) {
40 maintainer = bzr->launchpadId();
41 }
42
43 return maintainer;
44}
45
46}}
047
=== added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 1970-01-01 00:00:00 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 2016-09-22 16:34:17 +0000
@@ -0,0 +1,37 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 2.1.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Benjamin Zeller <benjamin.zeller@canonical.com>
17 */
18#ifndef UBUNTUJSEXTENSION_H
19#define UBUNTUJSEXTENSION_H
20
21#include <QObject>
22
23namespace Ubuntu {
24namespace Internal {
25
26class UbuntuJsExtension : public QObject
27{
28 Q_OBJECT
29public:
30 explicit UbuntuJsExtension(QObject *parent = 0);
31
32 Q_INVOKABLE QString developerId() const;
33};
34
35}}
36
37#endif // UBUNTUJSEXTENSION_H
038
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp 2016-09-05 17:35:40 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.cpp 2016-09-22 16:34:17 +0000
@@ -30,6 +30,8 @@
30#include "ubuntuproject.h"30#include "ubuntuproject.h"
3131
32#include <ubuntu/device/remote/ubuntudevice.h>32#include <ubuntu/device/remote/ubuntudevice.h>
33#include <ubuntu/snap/snaphelper.h>
34#include <ubuntu/snap/snapcraftpackagestep.h>
3335
34#include <projectexplorer/projectexplorer.h>36#include <projectexplorer/projectexplorer.h>
35#include <projectexplorer/project.h>37#include <projectexplorer/project.h>
@@ -159,7 +161,6 @@
159 m_ubuntuProcess.append(QStringList() << QString::fromLatin1(Constants::CLICK_REVIEWERSTOOLS_LOCATION).arg(sClickPackagePath));161 m_ubuntuProcess.append(QStringList() << QString::fromLatin1(Constants::CLICK_REVIEWERSTOOLS_LOCATION).arg(sClickPackagePath));
160 m_ubuntuProcess.start(QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE)).arg(sClickPackagePath));162 m_ubuntuProcess.start(QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE)).arg(sClickPackagePath));
161 }163 }
162
163}164}
164165
165void UbuntuPackagingModel::onMessage(QString msg)166void UbuntuPackagingModel::onMessage(QString msg)
@@ -294,6 +295,16 @@
294 if(!project)295 if(!project)
295 return;296 return;
296297
298 if (SnapHelper::isSnappyProject(project)) {
299 if(m_reviewToolsInstalled)
300 m_postPackageTask = Verify;
301 else
302 m_postPackageTask = None;
303
304 buildSnapPackage();
305 return;
306 }
307
297 QString mimeType = project->projectManager()->mimeType();308 QString mimeType = project->projectManager()->mimeType();
298 if(mimeType == QLatin1String(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE)309 if(mimeType == QLatin1String(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE)
299 || mimeType == QLatin1String(Ubuntu::Constants::UBUNTUPROJECT_MIMETYPE)310 || mimeType == QLatin1String(Ubuntu::Constants::UBUNTUPROJECT_MIMETYPE)
@@ -303,6 +314,7 @@
303 m_postPackageTask = Verify;314 m_postPackageTask = Verify;
304 else315 else
305 m_postPackageTask = None;316 m_postPackageTask = None;
317
306 buildClickPackage();318 buildClickPackage();
307 } else {319 } else {
308 m_UbuntuMenu_connection = QObject::connect(UbuntuMenu::instance(),SIGNAL(finished_action(const QProcess*,QString)),this,SLOT(onFinishedAction(const QProcess*,QString)));320 m_UbuntuMenu_connection = QObject::connect(UbuntuMenu::instance(),SIGNAL(finished_action(const QProcess*,QString)),this,SLOT(onFinishedAction(const QProcess*,QString)));
@@ -330,10 +342,11 @@
330 if (success) {342 if (success) {
331 //the step that created the click package is always in the last list and always the last step343 //the step that created the click package is always in the last list and always the last step
332 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(m_packageBuildSteps.last()->steps().last());344 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(m_packageBuildSteps.last()->steps().last());
333 if (pckStep && !pckStep->packagePath().isEmpty()) {345 SnapcraftPackageStep *snapPckStep = qobject_cast<SnapcraftPackageStep*>(m_packageBuildSteps.last()->steps().last());
346 if ((pckStep && !pckStep->packagePath().isEmpty()) || (snapPckStep && !snapPckStep->packagePath().isEmpty())) {
334 m_ubuntuProcess.stop();347 m_ubuntuProcess.stop();
335348
336 QString sClickPackagePath = pckStep->packagePath();349 QString sClickPackagePath = pckStep ? pckStep->packagePath() : snapPckStep->packagePath();
337 if (sClickPackagePath.isEmpty()) {350 if (sClickPackagePath.isEmpty()) {
338 clearPackageBuildList();351 clearPackageBuildList();
339 return;352 return;
@@ -381,19 +394,34 @@
381void UbuntuPackagingModel::buildAndInstallPackageRequested()394void UbuntuPackagingModel::buildAndInstallPackageRequested()
382{395{
383 m_postPackageTask = Install;396 m_postPackageTask = Install;
397
398 if (SnapHelper::isSnappyProject(ProjectExplorer::SessionManager::startupProject())) {
399 QMessageBox::information(Core::ICore::mainWindow(), qApp->applicationName(),
400 tr("Installing is currently not supported for snappy projects."));
401 return;
402 }
403
384 buildClickPackage();404 buildClickPackage();
385}405}
386406
387void UbuntuPackagingModel::buildAndVerifyPackageRequested()407void UbuntuPackagingModel::buildAndVerifyPackageRequested()
388{408{
389 m_postPackageTask = Verify;409 m_postPackageTask = Verify;
390 buildClickPackage();410
411 if (SnapHelper::isSnappyProject(ProjectExplorer::SessionManager::startupProject()))
412 buildSnapPackage();
413 else
414 buildClickPackage();
391}415}
392416
393void UbuntuPackagingModel::buildPackageRequested()417void UbuntuPackagingModel::buildPackageRequested()
394{418{
395 m_postPackageTask = None;419 m_postPackageTask = None;
396 buildClickPackage();420
421 if (SnapHelper::isSnappyProject(ProjectExplorer::SessionManager::startupProject()))
422 buildSnapPackage();
423 else
424 buildClickPackage();
397}425}
398426
399void UbuntuPackagingModel::targetChanged()427void UbuntuPackagingModel::targetChanged()
@@ -561,6 +589,59 @@
561 }589 }
562}590}
563591
592void UbuntuPackagingModel::buildSnapPackage()
593{
594 ProjectExplorer::Project* project = ProjectExplorer::SessionManager::startupProject();
595 if(!project) {
596 QMessageBox::warning(Core::ICore::mainWindow(),tr("No Project"),tr("No valid project loaded."));
597 return;
598 }
599
600 if(ProjectExplorer::BuildManager::isBuilding()) {
601 QMessageBox::information(Core::ICore::mainWindow(),tr("Build running"),tr("There is currently a build running, please wait for it to be finished"));
602 return;
603 }
604
605 if(!ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles())
606 return;
607
608 if(!SnapHelper::isSnappyProject(project))
609 return;
610
611 ProjectExplorer::Target* target = project->activeTarget();
612 if(!target)
613 return;
614
615 ProjectExplorer::BuildConfiguration* bc = target->activeBuildConfiguration();
616 if(!bc) {
617 QMessageBox::information(Core::ICore::mainWindow(),tr("Error"),tr("Please add a valid buildconfiguration to your project"));
618 return;
619 }
620
621 if(!bc->isEnabled()) {
622 QString disabledReason = bc->disabledReason();
623 QMessageBox::information(Core::ICore::mainWindow(),tr("Disabled"),tr("The currently selected Buildconfiguration is disabled. %1").arg(disabledReason));
624 return;
625 }
626
627 clearPackageBuildList();
628
629 m_packageBuildSteps.append(QSharedPointer<ProjectExplorer::BuildStepList> (new ProjectExplorer::BuildStepList(bc,ProjectExplorer::Constants::BUILDSTEPS_BUILD)));
630 ProjectExplorer::BuildStepList *buildSteps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
631 if (buildSteps && buildSteps->count() > 0) {
632 //add the normal buildsteps
633 m_packageBuildSteps.last()->cloneSteps(buildSteps);
634 }
635
636 //append the snap packaging step
637 SnapcraftPackageStep *package = new SnapcraftPackageStep(m_packageBuildSteps.last().data());
638 m_packageBuildSteps.last()->appendStep(package);
639
640 m_buildManagerConnection = connect(ProjectExplorer::BuildManager::instance(),SIGNAL(buildQueueFinished(bool)),this,SLOT(buildFinished(bool)));
641
642 ProjectExplorer::BuildManager::buildList(m_packageBuildSteps.last().data(),tr("Build Project"));
643}
644
564/*!645/*!
565 * \brief UbuntuPackagingWidget::clearAdditionalBuildSteps646 * \brief UbuntuPackagingWidget::clearAdditionalBuildSteps
566 * Clears the last used additional buildsteps647 * Clears the last used additional buildsteps
567648
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h 2016-06-09 08:47:42 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntupackagingmodel.h 2016-09-22 16:34:17 +0000
@@ -95,6 +95,7 @@
9595
96private:96private:
97 void buildClickPackage ();97 void buildClickPackage ();
98 void buildSnapPackage ();
98 void clearPackageBuildList ();99 void clearPackageBuildList ();
99 void updateFrameworkList ();100 void updateFrameworkList ();
100 void resetValidationResult ();101 void resetValidationResult ();
101102
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-09-05 17:35:40 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-09-22 16:34:17 +0000
@@ -49,9 +49,11 @@
49#include <ubuntu/device/remote/ubunturemotedeployconfiguration.h>49#include <ubuntu/device/remote/ubunturemotedeployconfiguration.h>
50#include <ubuntu/device/remote/ubuntudeploystepfactory.h>50#include <ubuntu/device/remote/ubuntudeploystepfactory.h>
5151
52#include "wizards/ubuntuprojectapplicationwizard.h"52#include <ubuntu/wizards/ubuntuprojectapplicationwizard.h>
53#include "wizards/ubuntufirstrunwizard.h"53#include <ubuntu/wizards/ubuntufirstrunwizard.h>
54#include "wizards/ubuntuprojectmigrationwizard.h"54#include <ubuntu/wizards/ubuntuprojectmigrationwizard.h>
55
56#include "ubuntujsextension.h"
5557
56#include <coreplugin/modemanager.h>58#include <coreplugin/modemanager.h>
57#include <projectexplorer/kitmanager.h>59#include <projectexplorer/kitmanager.h>
@@ -60,6 +62,7 @@
60#include <projectexplorer/processparameters.h>62#include <projectexplorer/processparameters.h>
61#include <coreplugin/featureprovider.h>63#include <coreplugin/featureprovider.h>
62#include <coreplugin/coreplugin.h>64#include <coreplugin/coreplugin.h>
65#include <coreplugin/jsexpander.h>
63#include <utils/mimetypes/mimedatabase.h>66#include <utils/mimetypes/mimedatabase.h>
64#include <utils/mimetypes/mimeglobpattern_p.h>67#include <utils/mimetypes/mimeglobpattern_p.h>
65#include <cmakeprojectmanager/cmaketoolmanager.h>68#include <cmakeprojectmanager/cmaketoolmanager.h>
@@ -233,6 +236,9 @@
233 addAutoReleasedObject(new Internal::UbuntuManifestEditorFactory);236 addAutoReleasedObject(new Internal::UbuntuManifestEditorFactory);
234 addAutoReleasedObject(new Internal::UbuntuApparmorEditorFactory);237 addAutoReleasedObject(new Internal::UbuntuApparmorEditorFactory);
235238
239 //Ubuntu expander
240 Core::JsExpander::registerQObjectForJs(QStringLiteral("Ubuntu"), new UbuntuJsExtension);
241
236 //trigger kit autodetection and update after projectexplorer loaded the kits242 //trigger kit autodetection and update after projectexplorer loaded the kits
237 connect(ProjectExplorer::KitManager::instance(),SIGNAL(kitsLoaded())243 connect(ProjectExplorer::KitManager::instance(),SIGNAL(kitsLoaded())
238 ,this,SLOT(onKitsLoaded()));244 ,this,SLOT(onKitsLoaded()));
239245
=== modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp'
--- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp 2016-09-05 17:35:40 +0000
+++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/wizards/ubuntuprojectapplicationwizard.cpp 2016-09-22 16:34:17 +0000
@@ -18,11 +18,13 @@
1818
19#include "ubuntuprojectapplicationwizard.h"19#include "ubuntuprojectapplicationwizard.h"
20#include "ubuntufirstrunwizard.h"20#include "ubuntufirstrunwizard.h"
21#include "../ubuntushared.h"21
22#include "../ubuntuconstants.h"22#include <ubuntu/ubuntushared.h>
23#include "../ubuntuproject.h"23#include <ubuntu/ubuntushared.h>
24#include "../ubuntubzr.h"24#include <ubuntu/ubuntuconstants.h>
25#include "../ubuntuclicktool.h"25#include <ubuntu/ubuntuproject.h>
26#include <ubuntu/ubuntubzr.h>
27#include <ubuntu/ubuntuclicktool.h>
2628
27#include <utils/qtcassert.h>29#include <utils/qtcassert.h>
28#include <utils/pathchooser.h>30#include <utils/pathchooser.h>
2931
=== modified file 'fix-qt-build.py'
--- fix-qt-build.py 2016-09-14 14:37:07 +0000
+++ fix-qt-build.py 2016-09-22 16:34:17 +0000
@@ -24,7 +24,7 @@
24 for root, dirs, files in os.walk(workDir):24 for root, dirs, files in os.walk(workDir):
25 for file in files:25 for file in files:
26 if file.endswith("ubuntu_save_gitmodules"):26 if file.endswith("ubuntu_save_gitmodules"):
27 shutil.move(os.path.join(root, file), os.path.join(root, ".gitmodules"))27 shutil.copy2(os.path.join(root, file), os.path.join(root, ".gitmodules"))
2828
29 #all subdirectores need a .git dir29 #all subdirectores need a .git dir
30 for entry in os.listdir(workDir):30 for entry in os.listdir(workDir):

Subscribers

People subscribed via source and target branches