Merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-run into lp:ubuntu-sdk-ide
- snapcraft-run
- Merge into trunk
Proposed by
Benjamin Zeller
Status: | Merged |
---|---|
Approved by: | Zoltan Balogh |
Approved revision: | 167 |
Merged at revision: | 165 |
Proposed branch: | lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-run |
Merge into: | lp:ubuntu-sdk-ide |
Diff against target: |
1902 lines (+1084/-159) 27 files modified
debian/patches/cmake_ubuntuspecificbits.diff (+192/-50) dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro (+2/-2) dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml (+1/-1) dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json (+2/-2) dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py (+84/-0) dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py (+22/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp (+21/-1) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h (+1/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp (+4/-1) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp (+9/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp (+63/-5) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h (+14/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp (+38/-19) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp (+74/-2) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h (+17/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp (+241/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h (+87/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp (+85/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h (+31/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri (+6/-2) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp (+1/-1) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h (+12/-13) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp (+11/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h (+1/-0) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp (+9/-4) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp (+43/-45) dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h (+13/-11) |
To merge this branch: | bzr merge lp:~zeller-benjamin/ubuntu-sdk-ide/snapcraft-run |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Zoltan Balogh | Approve | ||
Review via email: mp+310172@code.launchpad.net |
Commit message
- Support running snapcraft projects from the IDE
- Patch RunControlFactories to disable unwanted RC modes for snapcraft projects
Description of the change
- Support running snapcraft projects from the IDE
- Patch RunControlFactories to disable unwanted RC modes for snapcraft projects
To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:167
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/patches/cmake_ubuntuspecificbits.diff' |
2 | --- debian/patches/cmake_ubuntuspecificbits.diff 2016-09-22 16:11:03 +0000 |
3 | +++ debian/patches/cmake_ubuntuspecificbits.diff 2016-11-07 11:20:39 +0000 |
4 | @@ -1,6 +1,8 @@ |
5 | ---- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp |
6 | -+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp |
7 | -@@ -165,10 +165,10 @@ |
8 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp |
9 | +=================================================================== |
10 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp |
11 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp |
12 | +@@ -165,10 +165,10 @@ void CMakeManager::createXmlFile(Utils:: |
13 | proc->setWorkingDirectory(buildDirectoryPath); |
14 | proc->setEnvironment(env); |
15 | |
16 | @@ -14,9 +16,11 @@ |
17 | Utils::QtcProcess::addArgs(&args, arguments); |
18 | |
19 | proc->setCommand(executable, args); |
20 | ---- a/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp |
21 | -+++ b/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp |
22 | -@@ -288,9 +288,10 @@ |
23 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp |
24 | +=================================================================== |
25 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp |
26 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprojectmanager/qmlproject.cpp |
27 | +@@ -288,9 +288,10 @@ Internal::Manager *QmlProject::projectMa |
28 | bool QmlProject::supportsKit(Kit *k, QString *errorMessage) const |
29 | { |
30 | Id deviceType = DeviceTypeKitInformation::deviceTypeId(k); |
31 | @@ -29,9 +33,11 @@ |
32 | return false; |
33 | } |
34 | |
35 | ---- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp |
36 | -+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp |
37 | -@@ -2024,6 +2024,7 @@ |
38 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp |
39 | +=================================================================== |
40 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp |
41 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.cpp |
42 | +@@ -2024,6 +2024,7 @@ EvalResult *QmakeProFileNode::evaluate(c |
43 | result->newVarValues[AndroidExtraLibs] = input.readerExact->values(QLatin1String("ANDROID_EXTRA_LIBS")); |
44 | result->newVarValues[IsoIconsVar] = input.readerExact->values(QLatin1String("ISO_ICONS")); |
45 | result->newVarValues[QmakeProjectName] = input.readerExact->values(QLatin1String("QMAKE_PROJECT_NAME")); |
46 | @@ -39,9 +45,11 @@ |
47 | |
48 | result->isDeployable = false; |
49 | if (result->projectType == ApplicationTemplate) { |
50 | ---- a/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h |
51 | -+++ b/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h |
52 | -@@ -107,7 +107,8 @@ |
53 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h |
54 | +=================================================================== |
55 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h |
56 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmakeprojectmanager/qmakenodes.h |
57 | +@@ -107,7 +107,8 @@ enum QmakeVariable { |
58 | AndroidPackageSourceDir, |
59 | AndroidExtraLibs, |
60 | IsoIconsVar, |
61 | @@ -51,8 +59,10 @@ |
62 | }; |
63 | |
64 | namespace Internal { |
65 | ---- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h |
66 | -+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h |
67 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h |
68 | +=================================================================== |
69 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h |
70 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeconfigitem.h |
71 | @@ -25,6 +25,8 @@ |
72 | |
73 | #pragma once |
74 | @@ -62,7 +72,7 @@ |
75 | #include <QByteArray> |
76 | #include <QList> |
77 | |
78 | -@@ -34,7 +36,7 @@ |
79 | +@@ -34,7 +36,7 @@ namespace ProjectExplorer { class Kit; } |
80 | |
81 | namespace CMakeProjectManager { |
82 | |
83 | @@ -71,9 +81,11 @@ |
84 | public: |
85 | enum Type { FILEPATH, PATH, BOOL, STRING, INTERNAL, STATIC }; |
86 | CMakeConfigItem(); |
87 | ---- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp |
88 | -+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp |
89 | -@@ -568,6 +568,11 @@ |
90 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp |
91 | +=================================================================== |
92 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp |
93 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.cpp |
94 | +@@ -568,6 +568,11 @@ bool QtVersionManager::isValidId(int id) |
95 | return m_versions.contains(id); |
96 | } |
97 | |
98 | @@ -85,9 +97,11 @@ |
99 | BaseQtVersion *QtVersionManager::version(int id) |
100 | { |
101 | QTC_ASSERT(isLoaded(), return 0); |
102 | ---- a/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h |
103 | -+++ b/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h |
104 | -@@ -63,6 +63,7 @@ |
105 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h |
106 | +=================================================================== |
107 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h |
108 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qtsupport/qtversionmanager.h |
109 | +@@ -63,6 +63,7 @@ public: |
110 | static void removeVersion(BaseQtVersion *version); |
111 | |
112 | static bool isValidId(int id); |
113 | @@ -95,9 +109,11 @@ |
114 | |
115 | signals: |
116 | // content of BaseQtVersion objects with qmake path might have changed |
117 | ---- a/dist/qtcreator/src/plugins/plugins.pro |
118 | -+++ b/dist/qtcreator/src/plugins/plugins.pro |
119 | -@@ -56,7 +56,8 @@ |
120 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro |
121 | +=================================================================== |
122 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/plugins.pro |
123 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/plugins.pro |
124 | +@@ -56,7 +56,8 @@ SUBDIRS = \ |
125 | winrt \ |
126 | qmlprofiler \ |
127 | updateinfo \ |
128 | @@ -107,9 +123,11 @@ |
129 | |
130 | DO_NOT_BUILD_QMLDESIGNER = $$(DO_NOT_BUILD_QMLDESIGNER) |
131 | isEmpty(DO_NOT_BUILD_QMLDESIGNER) { |
132 | ---- a/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro |
133 | -+++ b/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro |
134 | -@@ -11,10 +11,10 @@ |
135 | +Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro |
136 | +=================================================================== |
137 | +--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro |
138 | ++++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/ubuntu-sdk.pro |
139 | +@@ -11,10 +11,10 @@ load(qt_parts) |
140 | src_uitk_launcher.subdir = ubuntu-ui-toolkit-launcher |
141 | src_uitk_launcher.depends = sub-src |
142 | |
143 | @@ -123,9 +141,11 @@ |
144 | |
145 | # additional 'make test' target required by continuous integration system |
146 | test.target = test |
147 | ---- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp |
148 | -+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp |
149 | -@@ -387,6 +387,18 @@ |
150 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp |
151 | +=================================================================== |
152 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp |
153 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.cpp |
154 | +@@ -387,6 +387,18 @@ void CMakeProject::runCMake() |
155 | } |
156 | } |
157 | |
158 | @@ -144,8 +164,10 @@ |
159 | QList<CMakeBuildTarget> CMakeProject::buildTargets() const |
160 | { |
161 | BuildDirManager *bdm = nullptr; |
162 | ---- a/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h |
163 | -+++ b/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h |
164 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h |
165 | +=================================================================== |
166 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h |
167 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/cmakeprojectmanager/cmakeproject.h |
168 | @@ -27,6 +27,7 @@ |
169 | |
170 | #include "cmake_global.h" |
171 | @@ -154,7 +176,7 @@ |
172 | |
173 | #include <projectexplorer/extracompiler.h> |
174 | #include <projectexplorer/project.h> |
175 | -@@ -111,6 +112,8 @@ |
176 | +@@ -111,6 +112,8 @@ public: |
177 | |
178 | void runCMake(); |
179 | |
180 | @@ -163,9 +185,11 @@ |
181 | signals: |
182 | /// emitted when cmake is running: |
183 | void parsingStarted(); |
184 | ---- a/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp |
185 | -+++ b/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp |
186 | -@@ -249,11 +249,11 @@ |
187 | +Index: ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp |
188 | +=================================================================== |
189 | +--- ubuntu-sdk-ide.orig/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp |
190 | ++++ ubuntu-sdk-ide/dist/qt5/ubuntu-sdk/src/UbuntuToolkit/menubar.cpp |
191 | +@@ -249,11 +249,11 @@ PlatformMenuWrapper::PlatformMenuWrapper |
192 | , m_target(target) |
193 | , m_inserted(false) |
194 | { |
195 | @@ -182,9 +206,11 @@ |
196 | |
197 | syncPlatformMenu(); |
198 | } |
199 | ---- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp |
200 | -+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp |
201 | -@@ -161,6 +161,12 @@ |
202 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp |
203 | +=================================================================== |
204 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp |
205 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.cpp |
206 | +@@ -161,6 +161,12 @@ bool GeneratedFile::write(QString *error |
207 | |
208 | Utils::FileSaver saver(m_d->path, flags); |
209 | saver.write(m_d->contents); |
210 | @@ -197,9 +223,11 @@ |
211 | return saver.finalize(errorMessage); |
212 | } |
213 | |
214 | ---- a/dist/qtcreator/src/plugins/coreplugin/generatedfile.h |
215 | -+++ b/dist/qtcreator/src/plugins/coreplugin/generatedfile.h |
216 | -@@ -46,7 +46,9 @@ |
217 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.h |
218 | +=================================================================== |
219 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/coreplugin/generatedfile.h |
220 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/coreplugin/generatedfile.h |
221 | +@@ -46,7 +46,9 @@ public: |
222 | /* File exists and the user indicated that he wants to keep it */ |
223 | KeepExistingFileAttribute = 0x8, |
224 | /* Force overwriting of a file without asking the user to keep it */ |
225 | @@ -210,9 +238,11 @@ |
226 | }; |
227 | Q_DECLARE_FLAGS(Attributes, Attribute) |
228 | |
229 | ---- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp |
230 | -+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp |
231 | -@@ -70,6 +70,7 @@ |
232 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp |
233 | +=================================================================== |
234 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp |
235 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp |
236 | +@@ -70,6 +70,7 @@ bool JsonWizardFileGenerator::setup(cons |
237 | f.overwrite = tmp.value(QLatin1String("overwrite"), false); |
238 | f.openInEditor = tmp.value(QLatin1String("openInEditor"), false); |
239 | f.openAsProject = tmp.value(QLatin1String("openAsProject"), false); |
240 | @@ -220,7 +250,7 @@ |
241 | |
242 | f.options = JsonWizard::parseOptions(tmp.value(QLatin1String("options")), errorMessage); |
243 | if (!errorMessage->isEmpty()) |
244 | -@@ -146,6 +147,8 @@ |
245 | +@@ -146,6 +147,8 @@ Core::GeneratedFile JsonWizardFileGenera |
246 | attributes |= Core::GeneratedFile::OpenProjectAttribute; |
247 | if (JsonWizard::boolFromVariant(file.overwrite, expander)) |
248 | attributes |= Core::GeneratedFile::ForceOverwrite; |
249 | @@ -229,7 +259,7 @@ |
250 | |
251 | if (file.keepExisting) |
252 | attributes |= Core::GeneratedFile::KeepExistingFileAttribute; |
253 | -@@ -231,6 +234,7 @@ |
254 | +@@ -231,6 +234,7 @@ bool JsonWizardFileGenerator::writeFile( |
255 | if (!file->write(errorMessage)) |
256 | return false; |
257 | } |
258 | @@ -237,9 +267,11 @@ |
259 | return true; |
260 | } |
261 | |
262 | ---- a/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h |
263 | -+++ b/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h |
264 | -@@ -55,6 +55,7 @@ |
265 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h |
266 | +=================================================================== |
267 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h |
268 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.h |
269 | +@@ -55,6 +55,7 @@ private: |
270 | QVariant overwrite = false; |
271 | QVariant openInEditor = false; |
272 | QVariant openAsProject = false; |
273 | @@ -247,3 +279,113 @@ |
274 | |
275 | QList<JsonWizard::OptionDefinition> options; |
276 | }; |
277 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp |
278 | +=================================================================== |
279 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp |
280 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/callgrindtool.cpp |
281 | +@@ -987,17 +987,20 @@ public: |
282 | + bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const override |
283 | + { |
284 | + Q_UNUSED(runConfiguration); |
285 | ++ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false; |
286 | + return runMode == CALLGRIND_RUN_MODE; |
287 | + } |
288 | + |
289 | + RunControl *create(RunConfiguration *runConfiguration, Core::Id runMode, QString *errorMessage) override |
290 | + { |
291 | + Q_UNUSED(errorMessage); |
292 | ++ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
293 | + return m_tool->createRunControl(runConfiguration, runMode); |
294 | + } |
295 | + |
296 | + IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override |
297 | + { |
298 | ++ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
299 | + return createValgrindRunConfigurationAspect(rc); |
300 | + } |
301 | + |
302 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp |
303 | +=================================================================== |
304 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp |
305 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/debugger/debuggerruncontrol.cpp |
306 | +@@ -553,6 +553,8 @@ public: |
307 | + QTC_ASSERT(runConfig, return 0); |
308 | + QTC_ASSERT(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain, return 0); |
309 | + |
310 | ++ if (runConfig->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
311 | ++ |
312 | + // We cover only local setup here. Remote setups are handled by the |
313 | + // RunControl factories in the target specific plugins. |
314 | + QStringList errors; |
315 | +@@ -568,6 +570,8 @@ public: |
316 | + if (!(mode == DebugRunMode || mode == DebugRunModeWithBreakOnMain)) |
317 | + return false; |
318 | + |
319 | ++ if (runConfig->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false; |
320 | ++ |
321 | + Runnable runnable = runConfig->runnable(); |
322 | + if (runnable.is<StandardRunnable>()) { |
323 | + IDevice::ConstPtr device = runnable.as<StandardRunnable>().device; |
324 | +@@ -582,6 +586,7 @@ public: |
325 | + |
326 | + IRunConfigurationAspect *createRunConfigurationAspect(RunConfiguration *rc) override |
327 | + { |
328 | ++ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
329 | + return new DebuggerRunConfigurationAspect(rc); |
330 | + } |
331 | + }; |
332 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp |
333 | +=================================================================== |
334 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp |
335 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/valgrind/memchecktool.cpp |
336 | +@@ -703,17 +703,20 @@ public: |
337 | + bool canRun(RunConfiguration *runConfiguration, Core::Id mode) const override |
338 | + { |
339 | + Q_UNUSED(runConfiguration); |
340 | ++ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false; |
341 | + return mode == MEMCHECK_RUN_MODE || mode == MEMCHECK_WITH_GDB_RUN_MODE; |
342 | + } |
343 | + |
344 | + RunControl *create(RunConfiguration *runConfiguration, Core::Id mode, QString *errorMessage) override |
345 | + { |
346 | + Q_UNUSED(errorMessage); |
347 | ++ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
348 | + return m_tool->createRunControl(runConfiguration, mode); |
349 | + } |
350 | + |
351 | + IRunConfigurationAspect *createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) override |
352 | + { |
353 | ++ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
354 | + return createValgrindRunConfigurationAspect(rc); |
355 | + } |
356 | + |
357 | +Index: ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp |
358 | +=================================================================== |
359 | +--- ubuntu-sdk-ide.orig/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp |
360 | ++++ ubuntu-sdk-ide/dist/qtcreator/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp |
361 | +@@ -65,6 +65,7 @@ QmlProfilerRunControlFactory::QmlProfile |
362 | + |
363 | + bool QmlProfilerRunControlFactory::canRun(RunConfiguration *runConfiguration, Core::Id mode) const |
364 | + { |
365 | ++ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return false; |
366 | + return mode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE && isLocal(runConfiguration); |
367 | + } |
368 | + |
369 | +@@ -72,6 +73,9 @@ RunControl *QmlProfilerRunControlFactory |
370 | + { |
371 | + QTC_ASSERT(canRun(runConfiguration, mode), return 0); |
372 | + QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0); |
373 | ++ |
374 | ++ if (runConfiguration->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
375 | ++ |
376 | + auto runnable = runConfiguration->runnable().as<StandardRunnable>(); |
377 | + |
378 | + if (runnable.executable.isEmpty()) { |
379 | +@@ -114,6 +118,7 @@ RunControl *QmlProfilerRunControlFactory |
380 | + ProjectExplorer::IRunConfigurationAspect * |
381 | + QmlProfilerRunControlFactory::createRunConfigurationAspect(ProjectExplorer::RunConfiguration *rc) |
382 | + { |
383 | ++ if (rc->id() == "SnapcraftProjectManager.SnapRunConfiguration.Id") return nullptr; |
384 | + return new QmlProfilerRunConfigurationAspect(rc); |
385 | + } |
386 | + |
387 | |
388 | === modified file 'dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro' |
389 | --- dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-10-18 07:45:16 +0000 |
390 | +++ dist/qtcreator/src/plugins/ubuntu/UbuntuPlugin.pro 2016-11-07 11:20:39 +0000 |
391 | @@ -52,7 +52,7 @@ |
392 | src/ubuntu/ubuntuproject.cpp \ |
393 | src/ubuntu/ubuntuprojectfile.cpp \ |
394 | src/ubuntu/ubuntuprojectnode.cpp \ |
395 | - #src/ubuntu/ubuntuversion.cpp \ |
396 | + src/ubuntu/ubuntuversion.cpp \ |
397 | #src/ubuntu/ubuntufeatureprovider.cpp \ |
398 | #src/ubuntu/ubuntuversionmanager.cpp \ |
399 | src/ubuntu/ubuntupackagingmode.cpp \ |
400 | @@ -123,7 +123,7 @@ |
401 | src/ubuntu/ubuntuproject.h \ |
402 | src/ubuntu/ubuntuprojectfile.h \ |
403 | src/ubuntu/ubuntuprojectnode.h \ |
404 | - #src/ubuntu/ubuntuversion.h \ |
405 | + src/ubuntu/ubuntuversion.h \ |
406 | #src/ubuntu/ubuntufeatureprovider.h \ |
407 | #src/ubuntu/ubuntuversionmanager.h \ |
408 | src/ubuntu/ubuntupackagingmode.h \ |
409 | |
410 | === modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml' |
411 | --- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 2016-10-18 07:45:16 +0000 |
412 | +++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/snapcraft.yaml 2016-11-07 11:20:39 +0000 |
413 | @@ -15,7 +15,7 @@ |
414 | source: %{ProjectNameL}/ |
415 | qt-version: qt5 |
416 | options: ["CONFIG+=snapcraft"] |
417 | - project-files: [%{ProjectNameL}] |
418 | + project-files: [%{ProjectNameL}.pro] |
419 | build-packages: |
420 | - build-essential |
421 | - qtbase5-dev |
422 | |
423 | === modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json' |
424 | --- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 2016-10-18 07:45:16 +0000 |
425 | +++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/templates/wizards/ubuntu/snap-qtquick-app-qmake/wizard.json 2016-11-07 11:20:39 +0000 |
426 | @@ -7,11 +7,11 @@ |
427 | "trDisplayName": "QtQuick App with QML Ubuntu UI", |
428 | "trDisplayCategory": "Snapcraft", |
429 | "icon": "../share/ubuntu.png", |
430 | - "enabled": "%{JS: [ %{Plugins} ].indexOf('Ubuntu') >= 0}", |
431 | + "enabled": "%{JS: [ %{Plugins} ].indexOf('Ubuntu') >= 0 && Ubuntu.supportsSnappy()}", |
432 | |
433 | "options": |
434 | [ |
435 | - { "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}" }, |
436 | + { "key": "ProjectFile", "value": "%{JS: Util.fileName('%{ProjectDirectory}/snapcraft','yaml')}" }, |
437 | { "key": "ProjectNameL", "value": "%{JS: \"%{ProjectName}\".toLowerCase()}" }, |
438 | { "key": "CppFileName", "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src')}" }, |
439 | { "key": "IsTopLevelProject", "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}'}" } |
440 | |
441 | === added file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py' |
442 | --- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py 1970-01-01 00:00:00 +0000 |
443 | +++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/qtc_desktop_snaprunner.py 2016-11-07 11:20:39 +0000 |
444 | @@ -0,0 +1,84 @@ |
445 | +#!/usr/bin/python3 |
446 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
447 | +# |
448 | +# QTC device applauncher |
449 | +# Copyright (C) 2014 Canonical |
450 | +# |
451 | +# This program is free software: you can redistribute it and/or modify |
452 | +# it under the terms of the GNU General Public License as published by |
453 | +# the Free Software Foundation, either version 3 of the License, or |
454 | +# (at your option) any later version. |
455 | +# |
456 | +# This program is distributed in the hope that it will be useful, |
457 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
458 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
459 | +# GNU General Public License for more details. |
460 | +# |
461 | +# You should have received a copy of the GNU General Public License |
462 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
463 | +# |
464 | +# Author: Benjamin Zeller <benjamin.zeller@canonical.com> |
465 | + |
466 | +import os |
467 | +import os.path |
468 | +import subprocess |
469 | +import argparse |
470 | +import signal |
471 | +import sys |
472 | + |
473 | +# register options to the argument parser |
474 | +parser = argparse.ArgumentParser(description="SDK snap launcher") |
475 | +parser.add_argument('snap_package',action="store") |
476 | +parser.add_argument('snap_command',action='store') |
477 | + |
478 | +options, args = parser.parse_known_args() |
479 | + |
480 | +if not os.path.isfile(options.snap_package): |
481 | + print("Snap file does not exist") |
482 | + sys.exit(1) |
483 | + |
484 | +#parse the package name which should be application_version_arch.snap |
485 | +app_info = os.path.basename(options.snap_package)[:-5].split("_") |
486 | +if len(app_info) != 3: |
487 | + print("The snap package name is invalid", file=sys.stderr) |
488 | + sys.exit(1) |
489 | + |
490 | +#flush all descriptors |
491 | +sys.stdout.flush() |
492 | +sys.stderr.flush() |
493 | + |
494 | +#ok lets install the snap package |
495 | +ret = subprocess.call(["snap", "install", options.snap_package, "--dangerous"], stdout=sys.stdout, stderr=sys.stderr) |
496 | +if ret != 0: |
497 | + sys.exit(ret) |
498 | + |
499 | +#flush all descriptors |
500 | +sys.stdout.flush() |
501 | +sys.stderr.flush() |
502 | + |
503 | +#this will contain the actual subprocess object |
504 | +proc = None |
505 | +stopped = False |
506 | +def signalHandler(signum, frame): |
507 | + print('Signal handler called with signal', signum) |
508 | + if proc is not None: |
509 | + proc.kill() |
510 | + else: |
511 | + stopped = True |
512 | + |
513 | +signal.signal(signal.SIGINT, signalHandler) |
514 | +signal.signal(signal.SIGTERM, signalHandler) |
515 | +signal.signal(signal.SIGHUP, signalHandler) |
516 | + |
517 | +#start the actual app |
518 | +if not stopped: |
519 | + proc = subprocess.Popen(["snap", "run", app_info[0]+"."+options.snap_command]+args, stdout=sys.stdout, stderr=sys.stderr) |
520 | + ret = proc.wait() |
521 | + |
522 | +#flush all descriptors |
523 | +sys.stdout.flush() |
524 | +sys.stderr.flush() |
525 | + |
526 | +subprocess.call(["snap", "remove", app_info[0]], stdout=sys.stdout, stderr=sys.stderr) |
527 | + |
528 | +sys.exit(ret) |
529 | |
530 | === modified file 'dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py' |
531 | --- dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py 2016-10-18 07:45:16 +0000 |
532 | +++ dist/qtcreator/src/plugins/ubuntu/share/qtcreator/ubuntu/scripts/run_snapcraft.py 2016-11-07 11:20:39 +0000 |
533 | @@ -1,4 +1,23 @@ |
534 | #!/usr/bin/python3 |
535 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
536 | +# |
537 | +# QTC device applauncher |
538 | +# Copyright (C) 2014 Canonical |
539 | +# |
540 | +# This program is free software: you can redistribute it and/or modify |
541 | +# it under the terms of the GNU General Public License as published by |
542 | +# the Free Software Foundation, either version 3 of the License, or |
543 | +# (at your option) any later version. |
544 | +# |
545 | +# This program is distributed in the hope that it will be useful, |
546 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
547 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
548 | +# GNU General Public License for more details. |
549 | +# |
550 | +# You should have received a copy of the GNU General Public License |
551 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
552 | +# |
553 | +# Author: Benjamin Zeller <benjamin.zeller@canonical.com> |
554 | |
555 | import os |
556 | import sys |
557 | @@ -22,6 +41,9 @@ |
558 | |
559 | print("Using snapcraft from :"+options.snapcraft) |
560 | |
561 | +sys.stdout.flush() |
562 | +sys.stderr.flush() |
563 | + |
564 | ret = subprocess.call([options.snapcraft, "clean"]) |
565 | if ret != 0: |
566 | sys.exit(ret) |
567 | |
568 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp' |
569 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-09-22 16:11:03 +0000 |
570 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.cpp 2016-11-07 11:20:39 +0000 |
571 | @@ -62,6 +62,11 @@ |
572 | ProjectExplorer::Abi::GenericLinuxFlavor, |
573 | ProjectExplorer::Abi::ElfFormat, |
574 | 64)); |
575 | + map.insert(QLatin1String("arm64") , ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, |
576 | + ProjectExplorer::Abi::LinuxOS, |
577 | + ProjectExplorer::Abi::GenericLinuxFlavor, |
578 | + ProjectExplorer::Abi::ElfFormat, |
579 | + 64)); |
580 | return map; |
581 | } |
582 | |
583 | @@ -130,6 +135,15 @@ |
584 | return clickArchitectures[arch]; |
585 | } |
586 | |
587 | +QString ClickToolChain::abiToArchitectureName(const ProjectExplorer::Abi &abi) |
588 | +{ |
589 | + for (auto i = clickArchitectures.constBegin(); i != clickArchitectures.constEnd(); i++){ |
590 | + if (i.value() == abi) |
591 | + return i.key(); |
592 | + } |
593 | + return QString("unknown"); |
594 | +} |
595 | + |
596 | QList<QString> ClickToolChain::supportedArchitectures() |
597 | { |
598 | return clickArchitectures.keys(); |
599 | @@ -158,7 +172,13 @@ |
600 | { |
601 | switch(abi.architecture()) { |
602 | case ProjectExplorer::Abi::ArmArchitecture: |
603 | - return QLatin1String("arm-linux-gnueabihf"); |
604 | + switch(abi.wordWidth()) |
605 | + { |
606 | + case 32: |
607 | + return QLatin1String("arm-linux-gnueabihf"); |
608 | + case 64: |
609 | + return QLatin1String("aarch64-linux-gnu"); |
610 | + } |
611 | break; |
612 | case ProjectExplorer::Abi::X86Architecture: |
613 | switch(abi.wordWidth()) |
614 | |
615 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h' |
616 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-09-22 16:11:03 +0000 |
617 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/clicktoolchain.h 2016-11-07 11:20:39 +0000 |
618 | @@ -50,6 +50,7 @@ |
619 | const UbuntuClickTool::Target &clickTarget () const; |
620 | |
621 | static ProjectExplorer::Abi architectureNameToAbi ( const QString &arch ); |
622 | + static QString abiToArchitectureName ( const ProjectExplorer::Abi &abi ); |
623 | static QList<QString> supportedArchitectures (); |
624 | |
625 | QString remoteCompilerCommand () const; |
626 | |
627 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp' |
628 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp 2016-10-18 07:45:16 +0000 |
629 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfiguration.cpp 2016-11-07 11:20:39 +0000 |
630 | @@ -1,6 +1,7 @@ |
631 | #include "snapcraftbuildconfiguration.h" |
632 | |
633 | #include <ubuntu/ubuntuconstants.h> |
634 | +#include <QDebug> |
635 | |
636 | namespace Ubuntu { |
637 | namespace Internal { |
638 | @@ -24,7 +25,9 @@ |
639 | |
640 | QVariantMap SnapcraftBuildConfiguration::toMap() const |
641 | { |
642 | - return ProjectExplorer::BuildConfiguration::toMap(); |
643 | + QVariantMap data = ProjectExplorer::BuildConfiguration::toMap(); |
644 | + qDebug()<<"Storing ID: "<<ProjectExplorer::idFromMap(data); |
645 | + return data; |
646 | } |
647 | |
648 | ProjectExplorer::NamedWidget *SnapcraftBuildConfiguration::createConfigWidget() |
649 | |
650 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp' |
651 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp 2016-10-18 07:45:16 +0000 |
652 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftbuildconfigurationfactory.cpp 2016-11-07 11:20:39 +0000 |
653 | @@ -11,6 +11,7 @@ |
654 | #include <projectexplorer/projectmacroexpander.h> |
655 | #include <projectexplorer/projectexplorerconstants.h> |
656 | #include <projectexplorer/buildsteplist.h> |
657 | +#include <projectexplorer/kitinformation.h> |
658 | |
659 | #include <coreplugin/documentmanager.h> |
660 | #include <utils/mimetypes/mimedatabase.h> |
661 | @@ -35,6 +36,10 @@ |
662 | if (qobject_cast<SnapcraftProject *>(parent->project())) |
663 | return {}; |
664 | |
665 | + //restrict this to local devices type kits for now |
666 | + if (ProjectExplorer::DeviceKitInformation::deviceId(parent->kit()) != ProjectExplorer::Constants::DESKTOP_DEVICE_ID) |
667 | + return {}; |
668 | + |
669 | QList<ProjectExplorer::BuildInfo *> infoList; |
670 | ProjectExplorer::BuildInfo *info = createBuildInfo(parent->kit(), parent->project()->projectFilePath().toString()); |
671 | if (info) |
672 | @@ -57,6 +62,10 @@ |
673 | { |
674 | Utils::MimeDatabase db; |
675 | |
676 | + //restrict this to local devices type kits for now |
677 | + if (ProjectExplorer::DeviceKitInformation::deviceId(k) != ProjectExplorer::Constants::DESKTOP_DEVICE_ID) |
678 | + return {}; |
679 | + |
680 | auto mimeType = db.mimeTypeForFile(projectPath); |
681 | if (!mimeType.matchesName(Constants::SNAPCRAFT_PROJECT_MIMETYPE)) |
682 | return {}; |
683 | |
684 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp' |
685 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp 2016-10-18 07:45:16 +0000 |
686 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.cpp 2016-11-07 11:20:39 +0000 |
687 | @@ -26,6 +26,8 @@ |
688 | #include <projectexplorer/kitinformation.h> |
689 | #include <projectexplorer/toolchain.h> |
690 | #include <projectexplorer/projectmacroexpander.h> |
691 | +#include <projectexplorer/projectexplorerconstants.h> |
692 | +#include <projectexplorer/taskhub.h> |
693 | #include <qmljs/qmljssimplereader.h> |
694 | #include <qtsupport/qtkitinformation.h> |
695 | #include <qtsupport/qtsupportconstants.h> |
696 | @@ -39,6 +41,10 @@ |
697 | using namespace Ubuntu; |
698 | using namespace Ubuntu::Internal; |
699 | |
700 | +enum { |
701 | + debug = 0 |
702 | +}; |
703 | + |
704 | SnapcraftProject::SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName) |
705 | : m_manager(manager), |
706 | m_fileName(fileName), |
707 | @@ -135,17 +141,69 @@ |
708 | |
709 | void SnapcraftProject::asyncUpdate() |
710 | { |
711 | - qDebug()<<"Syncing from yaml"; |
712 | + if(debug) qDebug()<<"Syncing from yaml"; |
713 | + |
714 | + QString oldDisplayName = displayName(); |
715 | + |
716 | try { |
717 | YAML::Node yaml = YAML::LoadFile(m_fileName.toString().toStdString()); |
718 | if (!m_rootNode->syncFromYAMLNode(yaml)) { |
719 | - qDebug()<<"Invalid YAML file"; |
720 | - } |
721 | + ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, |
722 | + QString::fromLatin1("Error while parsing snapcraft.yaml: file is invalid"), |
723 | + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM, |
724 | + projectFilePath()); |
725 | + } |
726 | + |
727 | + QStringList commandList; |
728 | + |
729 | + try { |
730 | + YAML::Node commands = yaml["apps"]; |
731 | + if (!commands.IsMap()) { |
732 | + ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, |
733 | + QString::fromLatin1("Error while parsing snapcraft.yaml: apps is not a map"), |
734 | + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM, |
735 | + projectFilePath()); |
736 | + } else { |
737 | + for (auto it = commands.begin(); it != commands.end(); ++it) { |
738 | + if(!it->second.IsMap() || it->second["daemon"]) |
739 | + continue; |
740 | + |
741 | + commandList << QString::fromStdString(it->first.as<std::string>()); |
742 | + } |
743 | + } |
744 | + |
745 | + if(yaml["version"]) { |
746 | + QString snapVer = QString::fromStdString(yaml["version"].as<std::string>()); |
747 | + if (snapVer != m_snapVersion) { |
748 | + if(debug) qDebug()<<"Snap version is"<<snapVer; |
749 | + m_snapVersion = snapVer; |
750 | + emit snapVersionChanged(); |
751 | + } |
752 | + } |
753 | + |
754 | + } catch (const YAML::Exception &e) { |
755 | + ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, |
756 | + QString::fromLatin1("Error while parsing the command list: %1").arg(QString::fromLatin1(e.what())), |
757 | + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM, |
758 | + projectFilePath(), |
759 | + e.mark.line); |
760 | + } |
761 | + |
762 | + if (m_commands != commandList) { |
763 | + m_commands = commandList; |
764 | + emit commandListChanged(m_commands); |
765 | + } |
766 | + |
767 | } catch (const YAML::Exception &e) { |
768 | - qDebug() << e.what(); |
769 | + ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, |
770 | + QString::fromLatin1("Error while parsing the project file: %1").arg(QString::fromLatin1(e.what())), |
771 | + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM, |
772 | + projectFilePath(), |
773 | + e.mark.line); |
774 | } |
775 | |
776 | - emit displayNameChanged(); |
777 | + if (oldDisplayName != displayName()) |
778 | + emit displayNameChanged(); |
779 | } |
780 | |
781 | void SnapcraftProject::maybeUpdate(const QString &pathChanged) |
782 | |
783 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h' |
784 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h 2016-10-18 07:45:16 +0000 |
785 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftproject.h 2016-11-07 11:20:39 +0000 |
786 | @@ -47,6 +47,10 @@ |
787 | SnapcraftProject(SnapcraftProjectManager *manager, const Utils::FileName &fileName); |
788 | |
789 | QString displayName() const override; |
790 | + QString snapVersion() const{ |
791 | + return m_snapVersion; |
792 | + } |
793 | + |
794 | ProjectExplorer::IProjectManager *projectManager() const override; |
795 | |
796 | ProjectExplorer::ProjectNode *rootProjectNode() const override; |
797 | @@ -60,6 +64,10 @@ |
798 | return m_fileName.toString(); |
799 | } |
800 | |
801 | + QStringList commands () const { |
802 | + return m_commands; |
803 | + } |
804 | + |
805 | // Project interface |
806 | bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override; |
807 | bool needsConfiguration() const override; |
808 | @@ -73,9 +81,15 @@ |
809 | void asyncUpdate (); |
810 | void maybeUpdate (const QString &pathChanged); |
811 | |
812 | +signals: |
813 | + void commandListChanged (const QStringList &commands); |
814 | + void snapVersionChanged (); |
815 | + |
816 | private: |
817 | SnapcraftProjectManager *m_manager; |
818 | QString m_projectName; |
819 | + QStringList m_commands; |
820 | + QString m_snapVersion; |
821 | QPointer<SnapcraftProjectFile> m_file; |
822 | |
823 | Utils::FileName m_fileName; |
824 | |
825 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp' |
826 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp 2016-10-18 07:45:16 +0000 |
827 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftprojectnode.cpp 2016-11-07 11:20:39 +0000 |
828 | @@ -17,8 +17,11 @@ |
829 | */ |
830 | |
831 | #include "snapcraftprojectnode.h" |
832 | +#include "snapcraftproject.h" |
833 | |
834 | #include <projectexplorer/nodesvisitor.h> |
835 | +#include <projectexplorer/projectexplorerconstants.h> |
836 | +#include <projectexplorer/taskhub.h> |
837 | #include <coreplugin/fileiconprovider.h> |
838 | #include <ubuntu/ubuntuconstants.h> |
839 | |
840 | @@ -35,6 +38,11 @@ |
841 | namespace Ubuntu { |
842 | namespace Internal { |
843 | |
844 | +enum { |
845 | + debug = 0 |
846 | +}; |
847 | + |
848 | + |
849 | static QIcon generateIcon(const QString &overlay) { |
850 | const QSize desiredSize = QSize(16, 16); |
851 | |
852 | @@ -62,27 +70,27 @@ |
853 | m_rootProject(rootProject), |
854 | m_watcher(watcher) |
855 | { |
856 | - setDisplayName(projectFilePath.parentDir().toString()); |
857 | + setDisplayName(projectFilePath.parentDir().toFileInfo().fileName()); |
858 | setIcon(generateProjectIcon()); |
859 | } |
860 | |
861 | SnapcraftProjectNode::~SnapcraftProjectNode() |
862 | { |
863 | - if (m_watcher) { |
864 | - |
865 | - } |
866 | } |
867 | |
868 | bool SnapcraftProjectNode::syncFromYAMLNode(YAML::Node rootNode) |
869 | { |
870 | - qDebug()<<"Sync from YAML node"; |
871 | + if(debug) qDebug()<<"Sync from YAML node"; |
872 | try { |
873 | QString displayName = QString::fromStdString(rootNode["name"].as<std::string>()); |
874 | setDisplayName(displayName); |
875 | |
876 | YAML::Node parts = rootNode["parts"]; |
877 | if (!parts.IsMap()) { |
878 | - qDebug()<<"Parts is not a map"; |
879 | + ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, |
880 | + QString::fromLatin1("Error while parsing snapcraft.yaml: parts is not a map"), |
881 | + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM, |
882 | + m_rootProject->projectFilePath()); |
883 | return false; |
884 | } |
885 | |
886 | @@ -145,9 +153,13 @@ |
887 | } |
888 | |
889 | QSet<QString> obsoleteParts = existingParts.toSet() - partsFromYaml.toSet(); |
890 | - qDebug()<<"Parts in yaml"<<partsFromYaml; |
891 | - qDebug()<<"Currently known parts"<<existingParts; |
892 | - qDebug()<<"Parts now obsolete: "<<obsoleteParts; |
893 | + |
894 | + if(debug) { |
895 | + qDebug()<<"Parts in yaml"<<partsFromYaml; |
896 | + qDebug()<<"Currently known parts"<<existingParts; |
897 | + qDebug()<<"Parts now obsolete: "<<obsoleteParts; |
898 | + } |
899 | + |
900 | for (const auto &part : obsoleteParts) { |
901 | int idx = existingParts.indexOf(part); |
902 | if (idx >= 0) |
903 | @@ -158,7 +170,11 @@ |
904 | removeFolderNodes(nodesToRemove); |
905 | addFolderNodes(nodesToAdd); |
906 | } catch (const YAML::Exception &e) { |
907 | - qDebug()<<"ERRROR ERROR ERROR "<<e.what(); |
908 | + ProjectExplorer::TaskHub::addTask(ProjectExplorer::Task::Error, |
909 | + QString::fromLatin1("Error while parsing snapcraft.yaml: %1").arg(QString::fromLatin1(e.what())), |
910 | + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM, |
911 | + m_rootProject->projectFilePath(), |
912 | + e.mark.line); |
913 | return false; |
914 | } |
915 | |
916 | @@ -191,9 +207,9 @@ |
917 | setIcon(generateProjectIcon()); |
918 | |
919 | if (watcher->addPath(folderPath.toString())) { |
920 | - qDebug()<<"Added"<<folderPath.toString()<<"to watcher"; |
921 | + if(debug) qDebug()<<"Added"<<folderPath.toString()<<"to watcher"; |
922 | } else { |
923 | - qDebug()<<"Failed to add"<<folderPath.toString()<<"to watcher"; |
924 | + if(debug) qDebug()<<"Failed to add"<<folderPath.toString()<<"to watcher"; |
925 | } |
926 | m_watcherConnection = QObject::connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path){ |
927 | maybeScheduleProjectScan(path); |
928 | @@ -228,7 +244,7 @@ |
929 | if (m_scanning) |
930 | return; |
931 | |
932 | - qDebug()<<"Scheduling Project scan"; |
933 | + if(debug) qDebug()<<"Scheduling Project scan"; |
934 | |
935 | m_scanning = true; |
936 | |
937 | @@ -236,7 +252,7 @@ |
938 | rescanTimer->setSingleShot(true); |
939 | rescanTimer->start(0); |
940 | QObject::connect(rescanTimer, &QTimer::timeout, [this, rescanTimer](){ |
941 | - qDebug()<<"Starting Project scan"; |
942 | + if(debug) qDebug()<<"Starting Project scan"; |
943 | delete rescanTimer; |
944 | this->scanProjectDirectory(); |
945 | |
946 | @@ -335,10 +351,12 @@ |
947 | QList<Utils::FileName> dirsToRemove = (oldDirs - newDirs).toList(); |
948 | QSet<Utils::FileName> dirsToAdd = newDirs - oldDirs; |
949 | |
950 | - qDebug()<<"Removing dirs " <<dirsToRemove; |
951 | - qDebug()<<"Adding dirs " <<dirsToAdd; |
952 | - qDebug()<<"Removing files" <<filesToRemove; |
953 | - qDebug()<<"Adding files " <<filesToAdd; |
954 | + if(debug) { |
955 | + qDebug()<<"Removing dirs " <<dirsToRemove; |
956 | + qDebug()<<"Adding dirs " <<dirsToAdd; |
957 | + qDebug()<<"Removing files" <<filesToRemove; |
958 | + qDebug()<<"Adding files " <<filesToAdd; |
959 | + } |
960 | |
961 | removeFileNodes(filesToRemove.toList()); |
962 | removeFolderNodes(dirsToRemove); |
963 | @@ -401,7 +419,8 @@ |
964 | |
965 | watches << currentPath.toFileInfo().absoluteFilePath(); |
966 | } |
967 | - qDebug()<<"Failed to add watches: "<<m_watcher->addPaths(watches); |
968 | + |
969 | + m_watcher->addPaths(watches); |
970 | return currFolder; |
971 | } |
972 | |
973 | |
974 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp' |
975 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp 2016-10-18 07:45:16 +0000 |
976 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.cpp 2016-11-07 11:20:39 +0000 |
977 | @@ -3,25 +3,81 @@ |
978 | #include "snapcraftbuildconfiguration.h" |
979 | |
980 | #include <ubuntu/snap/settings/snapcraftkitinformation.h> |
981 | - |
982 | #include <ubuntu/ubuntuconstants.h> |
983 | +#include <ubuntu/clicktoolchain.h> |
984 | |
985 | #include <projectexplorer/target.h> |
986 | #include <utils/environment.h> |
987 | |
988 | +#include <QRegularExpression> |
989 | + |
990 | + |
991 | namespace Ubuntu { |
992 | namespace Internal { |
993 | |
994 | +static const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$"; |
995 | + |
996 | SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl) |
997 | : ProjectExplorer::AbstractProcessStep(bsl, Constants::SNAPCRAFT_BUILDSTEP_ID) |
998 | { |
999 | setDefaultDisplayName(tr("Snapcraft")); |
1000 | + |
1001 | + connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::snapVersionChanged, |
1002 | + this, &SnapcraftStep::packagePathChanged); |
1003 | + connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::displayNameChanged, |
1004 | + this, &SnapcraftStep::packagePathChanged); |
1005 | } |
1006 | |
1007 | SnapcraftStep::SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs) |
1008 | : ProjectExplorer::AbstractProcessStep(bsl, bs) |
1009 | { |
1010 | - |
1011 | + connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::snapVersionChanged, |
1012 | + this, &SnapcraftStep::packagePathChanged); |
1013 | + connect(qobject_cast<SnapcraftProject *>(target()->project()), &SnapcraftProject::displayNameChanged, |
1014 | + this, &SnapcraftStep::packagePathChanged); |
1015 | +} |
1016 | + |
1017 | +void SnapcraftStep::stdOutput(const QString &line) |
1018 | +{ |
1019 | + m_lastLine = line; |
1020 | + ProjectExplorer::AbstractProcessStep::stdOutput(line); |
1021 | +} |
1022 | + |
1023 | +void SnapcraftStep::processStarted() |
1024 | +{ |
1025 | + m_packagePath.clear(); |
1026 | + emit packagePathChanged(); |
1027 | + |
1028 | + ProjectExplorer::AbstractProcessStep::processStarted(); |
1029 | +} |
1030 | + |
1031 | +void SnapcraftStep::processFinished(int exitCode, QProcess::ExitStatus status) |
1032 | +{ |
1033 | + Utils::FileName newPackagePath; |
1034 | + |
1035 | + ProjectExplorer::AbstractProcessStep::processFinished(exitCode, status); |
1036 | + if (status == QProcess::NormalExit && exitCode == 0) { |
1037 | + QRegularExpression exp((QLatin1String(PACKAGE_NAME_REGEX))); |
1038 | + QRegularExpressionMatch m = exp.match(m_lastLine); |
1039 | + if(m.hasMatch()) { |
1040 | + ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration(); |
1041 | + if(bc) |
1042 | + newPackagePath = bc->buildDirectory().appendPath(m.captured(1)); |
1043 | + } |
1044 | + } |
1045 | + |
1046 | + if (m_packagePath != newPackagePath) { |
1047 | + m_packagePath = newPackagePath; |
1048 | + emit packagePathChanged(); |
1049 | + } |
1050 | +} |
1051 | + |
1052 | +bool SnapcraftStep::processSucceeded(int exitCode, QProcess::ExitStatus status) |
1053 | +{ |
1054 | + if (!ProjectExplorer::AbstractProcessStep::processSucceeded(exitCode, status)) |
1055 | + return false; |
1056 | + |
1057 | + return m_packagePath.toFileInfo().exists(); |
1058 | } |
1059 | |
1060 | bool SnapcraftStep::init(QList<const ProjectExplorer::BuildStep *> &) |
1061 | @@ -63,5 +119,21 @@ |
1062 | return bin; |
1063 | } |
1064 | |
1065 | +Utils::FileName SnapcraftStep::packagePath() const |
1066 | +{ |
1067 | + if (!m_packagePath.isEmpty()) |
1068 | + return m_packagePath; |
1069 | + |
1070 | + ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration(); |
1071 | + SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(target()->project()); |
1072 | + ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit()); |
1073 | + if(bc && pro && tc && !pro->displayName().isEmpty() && !pro->snapVersion().isEmpty()) |
1074 | + return bc->buildDirectory().appendPath(QStringLiteral("%1_%2_%3.snap") |
1075 | + .arg(pro->displayName()) |
1076 | + .arg(pro->snapVersion()) |
1077 | + .arg(ClickToolChain::abiToArchitectureName(tc->targetAbi()))); |
1078 | + return Utils::FileName(); |
1079 | +} |
1080 | + |
1081 | } // namespace Internal |
1082 | } // namespace Ubuntu |
1083 | |
1084 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h' |
1085 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h 2016-10-18 07:45:16 +0000 |
1086 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snapcraftstep.h 2016-11-07 11:20:39 +0000 |
1087 | @@ -2,6 +2,7 @@ |
1088 | #define UBUNTU_INTERNAL_SNAPCRAFTSTEP_H |
1089 | |
1090 | #include <projectexplorer/abstractprocessstep.h> |
1091 | +#include <utils/fileutils.h> |
1092 | |
1093 | namespace Ubuntu { |
1094 | namespace Internal { |
1095 | @@ -21,10 +22,26 @@ |
1096 | virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; |
1097 | |
1098 | Utils::FileName snapcraftCommand () const; |
1099 | + Utils::FileName packagePath () const; |
1100 | + |
1101 | +signals: |
1102 | + void packagePathChanged (); |
1103 | |
1104 | protected: |
1105 | SnapcraftStep(ProjectExplorer::BuildStepList *bsl); |
1106 | SnapcraftStep(ProjectExplorer::BuildStepList *bsl, SnapcraftStep *bs); |
1107 | + |
1108 | + // AbstractProcessStep interface |
1109 | + virtual void stdOutput(const QString &line); |
1110 | + virtual void processStarted() override; |
1111 | + virtual void processFinished(int exitCode, QProcess::ExitStatus status) override; |
1112 | + virtual bool processSucceeded(int exitCode, QProcess::ExitStatus status) override; |
1113 | + |
1114 | + |
1115 | + |
1116 | +private: |
1117 | + QString m_lastLine; |
1118 | + Utils::FileName m_packagePath; |
1119 | }; |
1120 | |
1121 | } // namespace Internal |
1122 | |
1123 | === added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp' |
1124 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp 1970-01-01 00:00:00 +0000 |
1125 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.cpp 2016-11-07 11:20:39 +0000 |
1126 | @@ -0,0 +1,241 @@ |
1127 | +#include "snaprunconfiguration.h" |
1128 | +#include "snapcraftstep.h" |
1129 | +#include "snapcraftproject.h" |
1130 | + |
1131 | +#include <ubuntu/ubuntuconstants.h> |
1132 | + |
1133 | +#include <projectexplorer/runnables.h> |
1134 | +#include <projectexplorer/target.h> |
1135 | +#include <projectexplorer/buildconfiguration.h> |
1136 | +#include <projectexplorer/buildstep.h> |
1137 | +#include <projectexplorer/buildsteplist.h> |
1138 | +#include <projectexplorer/projectexplorerconstants.h> |
1139 | +#include <projectexplorer/localenvironmentaspect.h> |
1140 | +#include <projectexplorer/runconfigurationaspects.h> |
1141 | +#include <utils/qtcprocess.h> |
1142 | +#include <utils/pathchooser.h> |
1143 | + |
1144 | +#include <QFileInfo> |
1145 | +#include <QFormLayout> |
1146 | +#include <QComboBox> |
1147 | + |
1148 | +namespace Ubuntu { |
1149 | +namespace Internal { |
1150 | + |
1151 | +const QString COMMAND_KEY = QStringLiteral("SnapProjectManager.SnapRunConfiguration.SnapCommand"); |
1152 | +const QString WORKINGDIRECTORYASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.WorkingDirectoryAspect"); |
1153 | +const QString ARGUMENTASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.ArgumentAspect"); |
1154 | +const QString TERMINALASPECT_ID = QStringLiteral("SnapProjectManager.SnapRunConfiguration.TerminalAspect"); |
1155 | + |
1156 | +SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent) |
1157 | + : ProjectExplorer::RunConfiguration(parent, Constants::SNAP_RUNCONFIGURATION_ID) |
1158 | + , m_workingDirectoryAspect(new ProjectExplorer::WorkingDirectoryAspect(this, WORKINGDIRECTORYASPECT_ID)) |
1159 | + , m_argumentAspect(new ProjectExplorer::ArgumentsAspect(this, ARGUMENTASPECT_ID)) |
1160 | + , m_terminalAspect(new ProjectExplorer::TerminalAspect(this, TERMINALASPECT_ID)) |
1161 | + , m_localEnvironmentAspect(new ProjectExplorer::LocalEnvironmentAspect(this, ProjectExplorer::LocalEnvironmentAspect::BaseEnvironmentModifier())) |
1162 | +{ |
1163 | + m_terminalAspect->setRunMode(ProjectExplorer::ApplicationLauncher::Gui); |
1164 | + |
1165 | + addExtraAspect(m_argumentAspect); |
1166 | + addExtraAspect(m_terminalAspect); |
1167 | + addExtraAspect(m_localEnvironmentAspect); |
1168 | + addExtraAspect(m_workingDirectoryAspect); |
1169 | + |
1170 | + if(parent) { |
1171 | + SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(parent->project()); |
1172 | + if (pro) { |
1173 | + setDisplayName(pro->displayName()); |
1174 | + QStringList comms = pro->commands(); |
1175 | + if (comms.size()) |
1176 | + m_command = comms.first(); |
1177 | + } |
1178 | + m_workingDirectoryAspect->setDefaultWorkingDirectory(Utils::FileName::fromString(pro->projectDir().absolutePath())); |
1179 | + } |
1180 | + |
1181 | + // Connect target signals |
1182 | + connect(this->target(), &ProjectExplorer::Target::activeBuildConfigurationChanged, |
1183 | + this, &SnapRunConfiguration::updateConfiguration); |
1184 | + updateConfiguration(); |
1185 | +} |
1186 | + |
1187 | +SnapRunConfiguration::SnapRunConfiguration(ProjectExplorer::Target *parent, SnapRunConfiguration *source) |
1188 | + : ProjectExplorer::RunConfiguration(parent, source), |
1189 | + m_command(source->m_command) |
1190 | +{ |
1191 | + // Connect target signals |
1192 | + connect(this->target(), &ProjectExplorer::Target::activeBuildConfigurationChanged, |
1193 | + this, &SnapRunConfiguration::updateConfiguration); |
1194 | + updateConfiguration(); |
1195 | +} |
1196 | + |
1197 | +QString SnapRunConfiguration::command() const |
1198 | +{ |
1199 | + return m_command; |
1200 | +} |
1201 | + |
1202 | +void SnapRunConfiguration::setCommand(const QString &command) |
1203 | +{ |
1204 | + if (command != m_command) { |
1205 | + m_command = command; |
1206 | + emit enabledChanged(); |
1207 | + } |
1208 | +} |
1209 | + |
1210 | +bool SnapRunConfiguration::fromMap(const QVariantMap &map) |
1211 | +{ |
1212 | + if (!ProjectExplorer::RunConfiguration::fromMap(map)) |
1213 | + return false; |
1214 | + |
1215 | + m_command = map.value(COMMAND_KEY, QString()).toString(); |
1216 | + return true; |
1217 | +} |
1218 | + |
1219 | +QVariantMap SnapRunConfiguration::toMap() const |
1220 | +{ |
1221 | + QVariantMap map = ProjectExplorer::RunConfiguration::toMap(); |
1222 | + map.insert(COMMAND_KEY, m_command); |
1223 | + return map; |
1224 | +} |
1225 | + |
1226 | +bool SnapRunConfiguration::isEnabled() const |
1227 | +{ |
1228 | + return !m_command.isEmpty(); |
1229 | +} |
1230 | + |
1231 | +QString SnapRunConfiguration::disabledReason() const |
1232 | +{ |
1233 | + return tr("Please select a command to run in the runconfiguration."); |
1234 | +} |
1235 | + |
1236 | +QWidget *SnapRunConfiguration::createConfigurationWidget() |
1237 | +{ |
1238 | + return new SnapRunConfigurationWidget(this); |
1239 | +} |
1240 | + |
1241 | +ProjectExplorer::Runnable SnapRunConfiguration::runnable() const |
1242 | +{ |
1243 | + SnapcraftStep *pckStep = activeSnapcraftStep(); |
1244 | + if (!pckStep) { |
1245 | + return ProjectExplorer::Runnable(); |
1246 | + } |
1247 | + |
1248 | + Utils::FileName packagePath = pckStep->packagePath(); |
1249 | + if(packagePath.isEmpty()) { |
1250 | + return ProjectExplorer::Runnable(); |
1251 | + } |
1252 | + |
1253 | + qDebug()<<"Going to run "<<packagePath.toUserOutput(); |
1254 | + |
1255 | + QStringList args{ |
1256 | + packagePath.toUserOutput(), |
1257 | + m_command |
1258 | + }; |
1259 | + |
1260 | + ProjectExplorer::StandardRunnable r; |
1261 | + r.executable = Utils::FileName::fromString(Constants::UBUNTU_SCRIPTPATH).appendPath(QStringLiteral("qtc_desktop_snaprunner.py")).toString();; |
1262 | + r.workingDirectory = m_workingDirectoryAspect->workingDirectory().toString(); |
1263 | + r.environment = m_localEnvironmentAspect->environment(); |
1264 | + r.commandLineArguments = Utils::QtcProcess::joinArgs(args); |
1265 | + if (!m_argumentAspect->arguments().isEmpty()) { |
1266 | + r.commandLineArguments.append(QStringLiteral(" -- %1").arg(m_argumentAspect->arguments())); |
1267 | + } |
1268 | + return r; |
1269 | +} |
1270 | + |
1271 | +SnapcraftStep *SnapRunConfiguration::activeSnapcraftStep() const |
1272 | +{ |
1273 | + ProjectExplorer::BuildConfiguration *buildConf = activeBuildConfiguration(); |
1274 | + if(!buildConf) |
1275 | + return nullptr; |
1276 | + |
1277 | + ProjectExplorer::BuildStepList *bsList = buildConf->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD); |
1278 | + for(ProjectExplorer::BuildStep *currStep : bsList->steps()) { |
1279 | + SnapcraftStep *pckStep = qobject_cast<SnapcraftStep*>(currStep); |
1280 | + if(pckStep) |
1281 | + return pckStep; |
1282 | + } |
1283 | + return nullptr; |
1284 | +} |
1285 | + |
1286 | +void SnapRunConfiguration::updateConfiguration() |
1287 | +{ |
1288 | + if(m_currBuildConfConn) |
1289 | + disconnect(m_currBuildConfConn); |
1290 | + |
1291 | + m_currBuildConfConn = connect(activeSnapcraftStep(), &SnapcraftStep::packagePathChanged, |
1292 | + this, &ProjectExplorer::RunConfiguration::requestRunActionsUpdate); |
1293 | + |
1294 | +} |
1295 | + |
1296 | +SnapRunConfigurationWidget::SnapRunConfigurationWidget(SnapRunConfiguration *config) |
1297 | + : QWidget (nullptr), |
1298 | + m_rc(config), |
1299 | + m_updating(false) |
1300 | +{ |
1301 | + QFormLayout *layout = new QFormLayout(this); |
1302 | + layout->setMargin(0); |
1303 | + layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); |
1304 | + |
1305 | + setLayout(layout); |
1306 | + |
1307 | + m_commandsBox = new QComboBox(this); |
1308 | + updateComboBox(); |
1309 | + |
1310 | + connect(m_commandsBox, SIGNAL(currentIndexChanged(int)), |
1311 | + this, SLOT(commandSelected(int))); |
1312 | + |
1313 | + int idx = m_commandsBox->findText(config->command()); |
1314 | + if (idx >= 0) |
1315 | + m_commandsBox->setCurrentIndex(idx); |
1316 | + |
1317 | + layout->addRow(tr("Command:"), m_commandsBox); |
1318 | + config->extraAspect<ProjectExplorer::ArgumentsAspect>()->addToMainConfigurationWidget(this, layout); |
1319 | + config->extraAspect<ProjectExplorer::WorkingDirectoryAspect>()->addToMainConfigurationWidget(this,layout); |
1320 | + config->extraAspect<ProjectExplorer::TerminalAspect>()->addToMainConfigurationWidget(this,layout); |
1321 | + |
1322 | + if(config->target()) { |
1323 | + connect(qobject_cast<SnapcraftProject*>(config->target()->project()), &SnapcraftProject::commandListChanged, |
1324 | + this, &SnapRunConfigurationWidget::updateComboBox); |
1325 | + } |
1326 | +} |
1327 | + |
1328 | +void SnapRunConfigurationWidget::updateComboBox() |
1329 | +{ |
1330 | + QString currItem = m_rc->command(); |
1331 | + |
1332 | + //TODO check if project is still loading, so we do not override something we need |
1333 | + |
1334 | + m_updating = true; |
1335 | + m_commandsBox->clear(); |
1336 | + m_commandsBox->addItem(QString()); |
1337 | + if(m_rc && m_rc->target()) { |
1338 | + SnapcraftProject *pro = qobject_cast<SnapcraftProject *>(m_rc->target()->project()); |
1339 | + if (pro) { |
1340 | + QStringList comms = pro->commands(); |
1341 | + m_commandsBox->addItems(comms); |
1342 | + } |
1343 | + } |
1344 | + m_updating = false; |
1345 | + |
1346 | + int idx = m_commandsBox->findText(currItem); |
1347 | + if (idx <= 0 && m_commandsBox->count() > 1) |
1348 | + m_commandsBox->setCurrentIndex(1); |
1349 | + else if (idx > 0) |
1350 | + m_commandsBox->setCurrentIndex(idx); |
1351 | + else |
1352 | + m_commandsBox->setCurrentIndex(0); |
1353 | +} |
1354 | + |
1355 | +void SnapRunConfigurationWidget::commandSelected(const int index) |
1356 | +{ |
1357 | + if(m_updating) |
1358 | + return; |
1359 | + |
1360 | + if(index == 0) |
1361 | + m_rc->setCommand(QString()); |
1362 | + else |
1363 | + m_rc->setCommand(m_commandsBox->itemText(index)); |
1364 | +} |
1365 | + |
1366 | +} // namespace Internal |
1367 | +} // namespace Ubuntu |
1368 | |
1369 | === added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h' |
1370 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h 1970-01-01 00:00:00 +0000 |
1371 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfiguration.h 2016-11-07 11:20:39 +0000 |
1372 | @@ -0,0 +1,87 @@ |
1373 | +#ifndef UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H |
1374 | +#define UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H |
1375 | + |
1376 | +#include "snaprunconfigurationfactory.h" |
1377 | + |
1378 | +#include <projectexplorer/runconfiguration.h> |
1379 | +#include <utils/fileutils.h> |
1380 | + |
1381 | +#include <QStringList> |
1382 | + |
1383 | +class QComboBox; |
1384 | + |
1385 | +namespace Utils { |
1386 | + class PathChooser; |
1387 | +} |
1388 | + |
1389 | +namespace ProjectExplorer { |
1390 | + class WorkingDirectoryAspect; |
1391 | + class ArgumentsAspect; |
1392 | + class TerminalAspect; |
1393 | + class LocalEnvironmentAspect; |
1394 | +} |
1395 | + |
1396 | +namespace Ubuntu { |
1397 | +namespace Internal { |
1398 | + |
1399 | +class SnapcraftStep; |
1400 | + |
1401 | +class SnapRunConfiguration : public ProjectExplorer::RunConfiguration |
1402 | +{ |
1403 | + Q_OBJECT |
1404 | + friend class SnapRunConfigurationFactory; |
1405 | +protected: |
1406 | + SnapRunConfiguration(ProjectExplorer::Target *parent); |
1407 | + SnapRunConfiguration(ProjectExplorer::Target *parent, SnapRunConfiguration *source); |
1408 | + |
1409 | +public: |
1410 | + |
1411 | + QString command () const; |
1412 | + void setCommand (const QString &command); |
1413 | + |
1414 | + // ProjectConfiguration interface |
1415 | + virtual bool fromMap(const QVariantMap &map) override; |
1416 | + virtual QVariantMap toMap() const override; |
1417 | + |
1418 | + // RunConfiguration interface |
1419 | + virtual bool isEnabled() const override; |
1420 | + virtual QString disabledReason() const override; |
1421 | + virtual QWidget *createConfigurationWidget() override; |
1422 | + virtual ProjectExplorer::Runnable runnable() const override; |
1423 | + |
1424 | +private: |
1425 | + SnapcraftStep *activeSnapcraftStep() const; |
1426 | + void updateCommandList(const QStringList &commands); |
1427 | + void updateConfiguration(); |
1428 | + |
1429 | +private: |
1430 | + QString m_command; |
1431 | + QMetaObject::Connection m_currBuildConfConn; |
1432 | + ProjectExplorer::WorkingDirectoryAspect* m_workingDirectoryAspect; |
1433 | + ProjectExplorer::ArgumentsAspect* m_argumentAspect; |
1434 | + ProjectExplorer::TerminalAspect* m_terminalAspect; |
1435 | + ProjectExplorer::LocalEnvironmentAspect* m_localEnvironmentAspect; |
1436 | +}; |
1437 | + |
1438 | +class SnapRunConfigurationWidget : public QWidget |
1439 | +{ |
1440 | + Q_OBJECT |
1441 | +public: |
1442 | + SnapRunConfigurationWidget(SnapRunConfiguration *config); |
1443 | + |
1444 | +protected: |
1445 | + void updateComboBox (); |
1446 | + |
1447 | +protected slots: |
1448 | + void commandSelected (const int index); |
1449 | + |
1450 | +private: |
1451 | + SnapRunConfiguration *m_rc; |
1452 | + QComboBox *m_commandsBox; |
1453 | + bool m_updating; |
1454 | +}; |
1455 | + |
1456 | +} // namespace Internal |
1457 | +} // namespace Ubuntu |
1458 | + |
1459 | +#endif // UBUNTU_INTERNAL_SNAPRUNCONFIGURATION_H |
1460 | |
1461 | === added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp' |
1462 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp 1970-01-01 00:00:00 +0000 |
1463 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.cpp 2016-11-07 11:20:39 +0000 |
1464 | @@ -0,0 +1,85 @@ |
1465 | +#include "snaprunconfigurationfactory.h" |
1466 | +#include "snaprunconfiguration.h" |
1467 | +#include "snapcraftproject.h" |
1468 | + |
1469 | +#include <ubuntu/ubuntuconstants.h> |
1470 | +#include <projectexplorer/target.h> |
1471 | + |
1472 | +#include <utils/qtcassert.h> |
1473 | + |
1474 | +namespace Ubuntu { |
1475 | +namespace Internal { |
1476 | + |
1477 | +SnapRunConfigurationFactory::SnapRunConfigurationFactory() |
1478 | +{ |
1479 | + setObjectName(QStringLiteral("SnapRunConfigurationFactory")); |
1480 | +} |
1481 | + |
1482 | +QList<Core::Id> SnapRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent, |
1483 | + ProjectExplorer::IRunConfigurationFactory::CreationMode mode) const |
1484 | +{ |
1485 | + Q_UNUSED(mode); |
1486 | + |
1487 | + if (!parent) |
1488 | + return {}; |
1489 | + if (!qobject_cast<SnapcraftProject *>(parent->project())) |
1490 | + return {}; |
1491 | + |
1492 | + return { |
1493 | + Constants::SNAP_RUNCONFIGURATION_ID |
1494 | + }; |
1495 | +} |
1496 | + |
1497 | +QString SnapRunConfigurationFactory::displayNameForId(Core::Id id) const |
1498 | +{ |
1499 | + if (id == Constants::SNAP_RUNCONFIGURATION_ID) |
1500 | + return tr("Snapcraft Runconfiguration"); |
1501 | + |
1502 | + return QString(); |
1503 | +} |
1504 | + |
1505 | +bool SnapRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, Core::Id id) const |
1506 | +{ |
1507 | + return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(id); |
1508 | +} |
1509 | + |
1510 | +bool SnapRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const |
1511 | +{ |
1512 | + return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(ProjectExplorer::idFromMap(map)); |
1513 | +} |
1514 | + |
1515 | +bool SnapRunConfigurationFactory::canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const |
1516 | +{ |
1517 | + return availableCreationIds(parent, ProjectExplorer::IRunConfigurationFactory::AutoCreate).contains(product->id()); |
1518 | +} |
1519 | + |
1520 | +ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) |
1521 | +{ |
1522 | + QTC_ASSERT(canClone(parent, product), return nullptr); |
1523 | + return new SnapRunConfiguration(parent, static_cast<SnapRunConfiguration *>(product)); |
1524 | +} |
1525 | + |
1526 | +ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::doCreate(ProjectExplorer::Target *parent, Core::Id id) |
1527 | +{ |
1528 | + QTC_ASSERT(canCreate(parent, id), return nullptr); |
1529 | + if (id == Constants::SNAP_RUNCONFIGURATION_ID) |
1530 | + return new SnapRunConfiguration(parent); |
1531 | + return nullptr; |
1532 | +} |
1533 | + |
1534 | +ProjectExplorer::RunConfiguration *SnapRunConfigurationFactory::doRestore(ProjectExplorer::Target *parent, const QVariantMap &map) |
1535 | +{ |
1536 | + QTC_ASSERT(canRestore(parent, map), return nullptr); |
1537 | + |
1538 | + SnapRunConfiguration *conf = new SnapRunConfiguration(parent); |
1539 | + if (conf->fromMap(map)) |
1540 | + return conf; |
1541 | + |
1542 | + //something went wrong |
1543 | + delete conf; |
1544 | + return nullptr; |
1545 | + |
1546 | +} |
1547 | + |
1548 | +} // namespace Internal |
1549 | +} // namespace Ubuntu |
1550 | |
1551 | === added file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h' |
1552 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h 1970-01-01 00:00:00 +0000 |
1553 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/project/snaprunconfigurationfactory.h 2016-11-07 11:20:39 +0000 |
1554 | @@ -0,0 +1,31 @@ |
1555 | +#ifndef UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H |
1556 | +#define UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H |
1557 | + |
1558 | +#include <projectexplorer/runconfiguration.h> |
1559 | + |
1560 | +namespace Ubuntu { |
1561 | +namespace Internal { |
1562 | + |
1563 | +class SnapRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory |
1564 | +{ |
1565 | +public: |
1566 | + |
1567 | + SnapRunConfigurationFactory(); |
1568 | + |
1569 | + // IRunConfigurationFactory interface |
1570 | + virtual QList<Core::Id> availableCreationIds(ProjectExplorer::Target *parent, CreationMode mode) const override; |
1571 | + virtual QString displayNameForId(Core::Id id) const override; |
1572 | + virtual bool canCreate(ProjectExplorer::Target *parent, Core::Id id) const override; |
1573 | + virtual bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const override; |
1574 | + virtual bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) const override; |
1575 | + virtual ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *product) override; |
1576 | + |
1577 | +private: |
1578 | + virtual ProjectExplorer::RunConfiguration *doCreate(ProjectExplorer::Target *parent, Core::Id id) override; |
1579 | + virtual ProjectExplorer::RunConfiguration *doRestore(ProjectExplorer::Target *parent, const QVariantMap &map) override; |
1580 | +}; |
1581 | + |
1582 | +} // namespace Internal |
1583 | +} // namespace Ubuntu |
1584 | + |
1585 | +#endif // UBUNTU_INTERNAL_SNAPRUNCONFIGURATIONFACTORY_H |
1586 | |
1587 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri' |
1588 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri 2016-10-18 07:45:16 +0000 |
1589 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snap.pri 2016-11-07 11:20:39 +0000 |
1590 | @@ -11,7 +11,9 @@ |
1591 | $$PWD/project/snapcraftrsyncstep.cpp \ |
1592 | $$PWD/project/snapcraftstep.cpp \ |
1593 | $$PWD/project/snapcraftbuildstepfactory.cpp \ |
1594 | - $$PWD/settings/snapcraftkitinformation.cpp |
1595 | + $$PWD/settings/snapcraftkitinformation.cpp \ |
1596 | + $$PWD/project/snaprunconfiguration.cpp \ |
1597 | + $$PWD/project/snaprunconfigurationfactory.cpp |
1598 | |
1599 | HEADERS += \ |
1600 | $$PWD/project/snapcraftproject.h \ |
1601 | @@ -23,5 +25,7 @@ |
1602 | $$PWD/project/snapcraftrsyncstep.h \ |
1603 | $$PWD/project/snapcraftstep.h \ |
1604 | $$PWD/project/snapcraftbuildstepfactory.h \ |
1605 | - $$PWD/settings/snapcraftkitinformation.h |
1606 | + $$PWD/settings/snapcraftkitinformation.h \ |
1607 | + $$PWD/project/snaprunconfiguration.h \ |
1608 | + $$PWD/project/snaprunconfigurationfactory.h |
1609 | |
1610 | |
1611 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp' |
1612 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 2016-09-22 16:11:03 +0000 |
1613 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/snap/snapcraftpackagestep.cpp 2016-11-07 11:20:39 +0000 |
1614 | @@ -37,7 +37,7 @@ |
1615 | namespace Ubuntu { |
1616 | namespace Internal { |
1617 | |
1618 | -const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$"; |
1619 | +static const char * PACKAGE_NAME_REGEX = "^Snapped ([\\S]+\\.snap)$"; |
1620 | |
1621 | SnapcraftPackageStep::SnapcraftPackageStep(ProjectExplorer::BuildStepList *bsl) |
1622 | : ProjectExplorer::BuildStep (bsl, Constants::UBUNTU_SNAP_PACKAGESTEP_ID) |
1623 | |
1624 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h' |
1625 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-10-18 07:45:16 +0000 |
1626 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuconstants.h 2016-11-07 11:20:39 +0000 |
1627 | @@ -260,23 +260,21 @@ |
1628 | const char FEATURE_UBUNTU_TRUSTY[] = "Ubuntu.Wizards.FeatureUbuntuTrusty"; |
1629 | const char FEATURE_UBUNTU_UTOPIC[] = "Ubuntu.Wizards.FeatureUbuntuUtopic"; |
1630 | |
1631 | -const char DISTRIB_ID[] = "DISTRIB_ID="; |
1632 | -const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME="; |
1633 | -const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE="; |
1634 | -const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION="; |
1635 | -const char LSB_RELEASE[] = "/etc/lsb-release"; |
1636 | - |
1637 | -const char PRECISE[] = "precise"; |
1638 | -const char QUANTAL[] = "quantal"; |
1639 | -const char RARING[] = "raring"; |
1640 | -const char SAUCY[] = "saucy"; |
1641 | -const char TRUSTY[] = "trusty"; |
1642 | -const char UTOPIC[] = "utopic"; |
1643 | - |
1644 | const char PLATFORM_DESKTOP[] = "Desktop"; |
1645 | const char PLATFORM_DESKTOP_DISPLAYNAME[] = "Ubuntu %0"; |
1646 | + |
1647 | +const QString PRECISE (QStringLiteral("precise")); |
1648 | +const QString QUANTAL (QStringLiteral("quantal")); |
1649 | +const QString RARING (QStringLiteral("raring")); |
1650 | +const QString SAUCY (QStringLiteral("saucy")); |
1651 | +const QString TRUSTY (QStringLiteral("trusty")); |
1652 | +const QString UTOPIC (QStringLiteral("utopic")); |
1653 | +const QString VIVID (QStringLiteral("vivid")); |
1654 | +const QString WILY (QStringLiteral("wily")); |
1655 | */ |
1656 | |
1657 | +const QString XENIAL (QStringLiteral("xenial")); |
1658 | + |
1659 | const char TASK_DEVICE_SCRIPT[] = "Ubuntu.Task.DeviceScript"; |
1660 | |
1661 | const char UBUNTU_SETTINGS_ICON[] = ":/ubuntu/images/ubuntu-32.png"; |
1662 | @@ -400,6 +398,7 @@ |
1663 | const char SNAPCRAFT_BUILDCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapcraftBuildconfiguration.Id"; |
1664 | const char SNAPCRAFT_RSYNCBUILSSTEP_ID[] = "SnapcraftProjectManager.SnapcraftRsyncStep.Id"; |
1665 | const char SNAPCRAFT_BUILDSTEP_ID[] = "SnapcraftProjectManager.SnapcraftStep.Id"; |
1666 | +const char SNAP_RUNCONFIGURATION_ID[] = "SnapcraftProjectManager.SnapRunConfiguration.Id"; |
1667 | |
1668 | |
1669 | |
1670 | |
1671 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp' |
1672 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 2016-09-22 16:11:03 +0000 |
1673 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.cpp 2016-11-07 11:20:39 +0000 |
1674 | @@ -15,8 +15,11 @@ |
1675 | * |
1676 | * Author: Benjamin Zeller <benjamin.zeller@canonical.com> |
1677 | */ |
1678 | + |
1679 | #include "ubuntujsextension.h" |
1680 | #include <ubuntu/ubuntubzr.h> |
1681 | +#include <ubuntu/ubuntuversion.h> |
1682 | +#include <ubuntu/ubuntuconstants.h> |
1683 | |
1684 | namespace Ubuntu { |
1685 | namespace Internal { |
1686 | @@ -43,4 +46,12 @@ |
1687 | return maintainer; |
1688 | } |
1689 | |
1690 | +bool UbuntuJsExtension::supportsSnappy() const |
1691 | +{ |
1692 | + UbuntuVersion *v = UbuntuVersion::instance(); |
1693 | + if (v->isValid()) |
1694 | + return v->supportsSnappy(); |
1695 | + return false; |
1696 | +} |
1697 | + |
1698 | }} |
1699 | |
1700 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h' |
1701 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 2016-09-22 16:11:03 +0000 |
1702 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntujsextension.h 2016-11-07 11:20:39 +0000 |
1703 | @@ -30,6 +30,7 @@ |
1704 | explicit UbuntuJsExtension(QObject *parent = 0); |
1705 | |
1706 | Q_INVOKABLE QString developerId() const; |
1707 | + Q_INVOKABLE bool supportsSnappy() const; |
1708 | }; |
1709 | |
1710 | }} |
1711 | |
1712 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp' |
1713 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-10-18 07:45:16 +0000 |
1714 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuplugin.cpp 2016-11-07 11:20:39 +0000 |
1715 | @@ -52,11 +52,13 @@ |
1716 | #include <ubuntu/wizards/ubuntuprojectapplicationwizard.h> |
1717 | #include <ubuntu/wizards/ubuntufirstrunwizard.h> |
1718 | #include <ubuntu/wizards/ubuntuprojectmigrationwizard.h> |
1719 | +#include <ubuntu/ubuntuversion.h> |
1720 | |
1721 | #include <ubuntu/snap/project/snapcraftprojectmanager.h> |
1722 | #include <ubuntu/snap/project/snapcraftbuildconfigurationfactory.h> |
1723 | #include <ubuntu/snap/project/snapcraftbuildstepfactory.h> |
1724 | #include <ubuntu/snap/settings/snapcraftkitinformation.h> |
1725 | +#include <ubuntu/snap/project/snaprunconfiguration.h> |
1726 | |
1727 | #include "ubuntujsextension.h" |
1728 | |
1729 | @@ -181,11 +183,14 @@ |
1730 | addAutoReleasedObject(new UbuntuLocalRunControlFactory); |
1731 | |
1732 | |
1733 | - addAutoReleasedObject(new SnapcraftProjectManager); |
1734 | - addAutoReleasedObject(new SnapcraftBuildConfigurationFactory); |
1735 | - addAutoReleasedObject(new SnapcraftBuildStepFactory); |
1736 | + if (UbuntuVersion::instance()->supportsSnappy()) { |
1737 | + addAutoReleasedObject(new SnapcraftProjectManager); |
1738 | + addAutoReleasedObject(new SnapcraftBuildConfigurationFactory); |
1739 | + addAutoReleasedObject(new SnapcraftBuildStepFactory); |
1740 | + addAutoReleasedObject(new SnapRunConfigurationFactory); |
1741 | |
1742 | - ProjectExplorer::KitManager::registerKitInformation(new SnapcraftKitInformation); |
1743 | + ProjectExplorer::KitManager::registerKitInformation(new SnapcraftKitInformation); |
1744 | + } |
1745 | |
1746 | // Build support |
1747 | addAutoReleasedObject(new ClickToolChainFactory); |
1748 | |
1749 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp' |
1750 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp 2016-06-09 08:47:42 +0000 |
1751 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.cpp 2016-11-07 11:20:39 +0000 |
1752 | @@ -21,61 +21,59 @@ |
1753 | #include <QFile> |
1754 | #include <QStringList> |
1755 | |
1756 | -using namespace Ubuntu::Internal; |
1757 | +namespace Ubuntu { |
1758 | +namespace Internal { |
1759 | + |
1760 | +Q_GLOBAL_STATIC(UbuntuVersion, g_instance); |
1761 | + |
1762 | +const char DISTRIB_ID[] = "DISTRIB_ID="; |
1763 | +const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME="; |
1764 | +const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE="; |
1765 | +const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION="; |
1766 | +const char LSB_RELEASE[] = "/etc/lsb-release"; |
1767 | |
1768 | UbuntuVersion::UbuntuVersion() |
1769 | { |
1770 | - |
1771 | -} |
1772 | - |
1773 | -Core::FeatureSet UbuntuVersion::features() { |
1774 | - Core::FeatureSet retval; |
1775 | - |
1776 | - QString cName = codename(); |
1777 | - if (cName==QLatin1String(Constants::PRECISE)) { |
1778 | - retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_PRECISE); |
1779 | - } else if (cName==QLatin1String(Constants::QUANTAL)) { |
1780 | - retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_QUANTAL); |
1781 | - } else if (cName==QLatin1String(Constants::RARING)) { |
1782 | - retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_RARING); |
1783 | - } else if (cName==QLatin1String(Constants::SAUCY)) { |
1784 | - retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_SAUCY); |
1785 | - retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE); |
1786 | - } else if (cName==QLatin1String(Constants::TRUSTY)) { |
1787 | - retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_TRUSTY); |
1788 | - retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE); |
1789 | - } else if (cName==QLatin1String(Constants::UTOPIC)) { |
1790 | - retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_UTOPIC); |
1791 | - retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE); |
1792 | - } |
1793 | - return retval; |
1794 | -} |
1795 | - |
1796 | -UbuntuVersion *UbuntuVersion::fromLsbFile(const QString &fileName) |
1797 | -{ |
1798 | - QFile lsbRelease(fileName); |
1799 | + initFromLsbFile(); |
1800 | +} |
1801 | + |
1802 | +bool UbuntuVersion::supportsSnappy() const |
1803 | +{ |
1804 | + if (m_valid) |
1805 | + return codename() == Constants::XENIAL; |
1806 | + return false; |
1807 | +} |
1808 | + |
1809 | +UbuntuVersion *UbuntuVersion::instance() |
1810 | +{ |
1811 | + return g_instance(); |
1812 | +} |
1813 | + |
1814 | +void UbuntuVersion::initFromLsbFile() |
1815 | +{ |
1816 | + QFile lsbRelease(QString::fromLatin1(LSB_RELEASE)); |
1817 | if (lsbRelease.open(QIODevice::ReadOnly)) { |
1818 | QByteArray data = lsbRelease.readAll(); |
1819 | lsbRelease.close(); |
1820 | |
1821 | - UbuntuVersion *ver = new UbuntuVersion; |
1822 | - |
1823 | foreach(QString line, QString::fromLatin1(data).split(QLatin1String("\n"))) { |
1824 | - if (line.startsWith(QLatin1String(Constants::DISTRIB_ID))) { |
1825 | - ver->m_id = line.replace(QLatin1String(Constants::DISTRIB_ID),QLatin1String("")); |
1826 | - |
1827 | - } else if (line.startsWith(QLatin1String(Constants::DISTRIB_RELEASE))) { |
1828 | - ver->m_release = line.replace(QLatin1String(Constants::DISTRIB_RELEASE),QLatin1String("")); |
1829 | - |
1830 | - } else if (line.startsWith(QLatin1String(Constants::DISTRIB_CODENAME))) { |
1831 | - ver->m_codename = line.replace(QLatin1String(Constants::DISTRIB_CODENAME),QLatin1String("")); |
1832 | - |
1833 | - } else if (line.startsWith(QLatin1String(Constants::DISTRIB_DESCRIPTION))) { |
1834 | - ver->m_description = line.replace(QLatin1String(Constants::DISTRIB_DESCRIPTION),QLatin1String("")); |
1835 | + if (line.startsWith(QLatin1String(DISTRIB_ID))) { |
1836 | + m_id = line.replace(QLatin1String(DISTRIB_ID),QLatin1String("")); |
1837 | + |
1838 | + } else if (line.startsWith(QLatin1String(DISTRIB_RELEASE))) { |
1839 | + m_release = line.replace(QLatin1String(DISTRIB_RELEASE),QLatin1String("")); |
1840 | + |
1841 | + } else if (line.startsWith(QLatin1String(DISTRIB_CODENAME))) { |
1842 | + m_codename = line.replace(QLatin1String(DISTRIB_CODENAME),QLatin1String("")); |
1843 | + |
1844 | + } else if (line.startsWith(QLatin1String(DISTRIB_DESCRIPTION))) { |
1845 | + m_description = line.replace(QLatin1String(DISTRIB_DESCRIPTION),QLatin1String("")); |
1846 | } |
1847 | } |
1848 | |
1849 | - return ver; |
1850 | + m_valid = true; |
1851 | } |
1852 | - return 0; |
1853 | } |
1854 | + |
1855 | +}} |
1856 | + |
1857 | |
1858 | === modified file 'dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h' |
1859 | --- dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h 2016-06-09 08:47:42 +0000 |
1860 | +++ dist/qtcreator/src/plugins/ubuntu/src/ubuntu/ubuntuversion.h 2016-11-07 11:20:39 +0000 |
1861 | @@ -27,28 +27,30 @@ |
1862 | namespace Internal { |
1863 | |
1864 | |
1865 | -class UbuntuVersion : public QObject |
1866 | +class UbuntuVersion |
1867 | { |
1868 | - Q_OBJECT |
1869 | - |
1870 | public: |
1871 | explicit UbuntuVersion(); |
1872 | |
1873 | public slots: |
1874 | - QString id() { return m_id; } |
1875 | - QString release() { return m_release; } |
1876 | - QString codename() { return m_codename; } |
1877 | - QString description() { return m_description; } |
1878 | - |
1879 | - Core::FeatureSet features(); |
1880 | - |
1881 | - static UbuntuVersion *fromLsbFile( const QString &fileName ); |
1882 | + bool isValid () const { return m_valid; } |
1883 | + QString id() const { return m_id; } |
1884 | + QString release() const { return m_release; } |
1885 | + QString codename() const { return m_codename; } |
1886 | + QString description() const { return m_description; } |
1887 | + bool supportsSnappy () const; |
1888 | + |
1889 | + static UbuntuVersion *instance( ); |
1890 | + |
1891 | +protected: |
1892 | + void initFromLsbFile( ); |
1893 | |
1894 | protected: |
1895 | QString m_id; |
1896 | QString m_release; |
1897 | QString m_codename; |
1898 | QString m_description; |
1899 | + bool m_valid = false; |
1900 | }; |
1901 | } |
1902 | } |
PASSED: Continuous integration, rev:167 /jenkins. ubuntu. com/ubuntu- sdk/job/ qtcreator- ide-ci- amd64/359/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/7182/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ qtcreator- ide-ci- amd64/359/ rebuild
https:/