Merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/runhtml into lp:qtcreator-plugin-ubuntu

Proposed by Benjamin Zeller
Status: Merged
Approved by: Zoltan Balogh
Approved revision: 214
Merged at revision: 212
Proposed branch: lp:~zeller-benjamin/qtcreator-plugin-ubuntu/runhtml
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 2667 lines (+1248/-571)
35 files modified
debian/control (+1/-0)
share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml (+1/-1)
share/qtcreator/ubuntu/menu.json (+21/-17)
src/plugin.pri (+1/-0)
src/ubuntu/ubuntu.pro (+8/-2)
src/ubuntu/ubuntuclickmanifest.cpp (+7/-4)
src/ubuntu/ubuntuclicktool.cpp (+139/-37)
src/ubuntu/ubuntuclicktool.h (+3/-2)
src/ubuntu/ubuntucmakemakestep.cpp (+3/-29)
src/ubuntu/ubuntuconstants.h (+2/-1)
src/ubuntu/ubuntudeploystepfactory.cpp (+138/-0)
src/ubuntu/ubuntudeploystepfactory.h (+29/-0)
src/ubuntu/ubuntudirectuploadstep.cpp (+134/-0)
src/ubuntu/ubuntudirectuploadstep.h (+46/-0)
src/ubuntu/ubuntuhtmlbuildconfiguration.cpp (+202/-0)
src/ubuntu/ubuntuhtmlbuildconfiguration.h (+71/-0)
src/ubuntu/ubuntulocalrunconfiguration.cpp (+17/-1)
src/ubuntu/ubuntulocalrunconfigurationfactory.cpp (+45/-67)
src/ubuntu/ubuntupackagestep.cpp (+126/-47)
src/ubuntu/ubuntupackagestep.h (+1/-0)
src/ubuntu/ubuntupackagingwidget.cpp (+88/-37)
src/ubuntu/ubuntupackagingwidget.h (+9/-2)
src/ubuntu/ubuntuplugin.cpp (+9/-3)
src/ubuntu/ubuntuproject.cpp (+67/-13)
src/ubuntu/ubuntuproject.h (+16/-1)
src/ubuntu/ubuntuprojectapplicationwizard.cpp (+14/-1)
src/ubuntu/ubuntuprojectapplicationwizard.h (+2/-1)
src/ubuntu/ubunturemotedeployconfiguration.cpp (+13/-240)
src/ubuntu/ubunturemotedeployconfiguration.h (+0/-54)
src/ubuntu/ubunturemoterunconfiguration.cpp (+29/-8)
src/ubuntu/ubunturemoterunconfiguration.h (+2/-0)
tests/manifest/manifest.pro (+1/-0)
To merge this branch: bzr merge lp:~zeller-benjamin/qtcreator-plugin-ubuntu/runhtml
Reviewer Review Type Date Requested Status
Zoltan Balogh Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+226821@code.launchpad.net

Commit message

- Adding run support for HTML and webcontainer projects
- Refactored some code to make the project easier to maintain
- Remove MenuItems for HTML projects
- Fix packaging widget to work correctly for the new HTML configurations
- Adding UbuntuHtmlBuildConfiguration
- Add TargetSetupPage to the new htmlproject wizard
- Make sure trusty users get a list of available frameworks based on the
Toolchain they use
- Hardcode list of frameworks for now since click chroots are broken

Description of the change

- Adding run support for HTML and webcontainer projects
- Refactored some code to make the project easier to maintain
- Remove MenuItems for HTML projects
- Fix packaging widget to work correctly for the new HTML configurations
- Adding UbuntuHtmlBuildConfiguration
- Add TargetSetupPage to the new htmlproject wizard

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

OK

review: Approve
215. By Benjamin Zeller

Merge branch: https://code.launchpad.net/~zeller-benjamin/qtcreator-plugin-ubuntu/fixfwlist/+merge/227518

216. By Benjamin Zeller

Make sure the correct value is selected when the target is switched

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/control'
--- debian/control 2014-07-04 14:22:41 +0000
+++ debian/control 2014-07-23 14:19:54 +0000
@@ -43,6 +43,7 @@
43 qtcreator-plugin-cmake (>= 3.1.1~),43 qtcreator-plugin-cmake (>= 3.1.1~),
44 qtcreator-plugin-remotelinux (>= 3.1.1~),44 qtcreator-plugin-remotelinux (>= 3.1.1~),
45 qtdeclarative5-controls-plugin,45 qtdeclarative5-controls-plugin,
46 webapp-container,
46# Only for unity8-supported archs47# Only for unity8-supported archs
47 unity-scope-tool [i386 amd64 armhf],48 unity-scope-tool [i386 amd64 armhf],
48 ${shlibs:Depends},49 ${shlibs:Depends},
4950
=== modified file 'share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml 2014-07-10 13:20:17 +0000
+++ share/qtcreator/templates/wizards/ubuntu/html5-simple/wizard.xml 2014-07-23 14:19:54 +0000
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="UbuntuAppSimpleHtml5'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="UbuntuAppSimpleHtml5'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-plain"4 class="ubuntu-project-plain-html"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
88
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml 2014-07-11 10:10:16 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple/wizard.xml 2014-07-23 14:19:54 +0000
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="UbuntuAppSimple'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="UbuntuAppSimple'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-plain"4 class="ubuntu-project-plain-qml"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
88
=== modified file 'share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml 2014-07-10 13:20:17 +0000
+++ share/qtcreator/templates/wizards/ubuntu/tabs/wizard.xml 2014-07-23 14:19:54 +0000
@@ -1,7 +1,7 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="UbuntuAppTabs'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="UbuntuAppTabs'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-plain"4 class="ubuntu-project-plain-qml"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
88
=== modified file 'share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml 2014-07-11 09:55:15 +0000
+++ share/qtcreator/templates/wizards/ubuntu/webapp/wizard.xml 2014-07-23 14:19:54 +0000
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="UbuntuWebApp" category="A.UbuntuProject" platformIndependent="true" class="ubuntu-project-plain" featuresRequired="">2<wizard version="1" kind="project" firstpage="10" id="UbuntuWebApp" category="A.UbuntuProject" platformIndependent="true" class="ubuntu-project-plain-html" featuresRequired="">
3 <icon>../share/ubuntu.png</icon>3 <icon>../share/ubuntu.png</icon>
4 <description>Web App template, for converting a web site into a standalone application. Web Apps are restricted to using available W3C APIs only, unlike HTML5 Apps which have full platform access.</description>4 <description>Web App template, for converting a web site into a standalone application. Web Apps are restricted to using available W3C APIs only, unlike HTML5 Apps which have full platform access.</description>
5 <displayname>Web App</displayname>5 <displayname>Web App</displayname>
66
=== modified file 'share/qtcreator/ubuntu/menu.json'
--- share/qtcreator/ubuntu/menu.json 2014-05-21 15:37:37 +0000
+++ share/qtcreator/ubuntu/menu.json 2014-07-23 14:19:54 +0000
@@ -74,20 +74,6 @@
74 ]74 ]
75 },75 },
76 {76 {
77 "name": "Run Application on Device",
78 "id": "Ubuntu.Build.RunHtml5",
79 "workingDirectory": "%0/..",
80 "projectRequired": true,
81 "keysequence": "Ctrl+F12",
82 "deviceRequired": true,
83 "ubuntuHtmlProjectRequired": true,
84 "saveRequired": true,
85 "context" : ["UbuntuProject.ProjectContext"],
86 "actions": [
87 "%SCRIPTDIRECTORY%/qtc_device_run_app_click %SERIALNUMBER% %FOLDERNAME% %USERNAME%@%IP% %PORT% /home/%USERNAME%/dev_tmp"
88 ]
89 },
90 {
91 "name": "Close Application on Device",77 "name": "Close Application on Device",
92 "id": "Ubuntu.Build.CancelRun",78 "id": "Ubuntu.Build.CancelRun",
93 "keysequence": "Ctrl+Shift+F12",79 "keysequence": "Ctrl+Shift+F12",
@@ -116,7 +102,7 @@
116 "workingDirectory": "%0/..",102 "workingDirectory": "%0/..",
117 "projectRequired": true,103 "projectRequired": true,
118 "deviceRequired": true,104 "deviceRequired": true,
119 "context": ["QmlProject.ProjectContext","UbuntuProject.ProjectContext"],105 "context": ["QmlProject.ProjectContext"],
120 "saveRequired": true,106 "saveRequired": true,
121 "actions": [107 "actions": [
122 "%SCRIPTDIRECTORY%/qtc_project_click_createanddeploy %SERIALNUMBER% %FOLDERNAME% %USERNAME%@%IP% %PORT% /home/%USERNAME%/dev_tmp %USERNAME%"108 "%SCRIPTDIRECTORY%/qtc_project_click_createanddeploy %SERIALNUMBER% %FOLDERNAME% %USERNAME%@%IP% %PORT% /home/%USERNAME%/dev_tmp %USERNAME%"
@@ -124,6 +110,24 @@
124 },110 },
125 {111 {
126 "name": "Install Application on Device",112 "name": "Install Application on Device",
113 "id": "Ubuntu.Build.PackageInstall.Html",
114 "workingDirectory": "%0/..",
115 "projectRequired": true,
116 "deviceRequired": true,
117 "context": ["UbuntuProject.ProjectContext"],
118 "saveRequired": true,
119 "actions": [
120 {
121 "metacall": {
122 "method":"requestBuildAndInstallProject",
123 "args":[]
124 }
125 }
126 ]
127 },
128
129 {
130 "name": "Install Application on Device",
127 "id": "Ubuntu.Build.PackageInstall.CMake",131 "id": "Ubuntu.Build.PackageInstall.CMake",
128 "workingDirectory": "%0/..",132 "workingDirectory": "%0/..",
129 "projectRequired": true,133 "projectRequired": true,
@@ -138,8 +142,8 @@
138 }142 }
139 }143 }
140 ]144 ]
141 },145 },
142 {146 {
143 "name": "Install Application on Device",147 "name": "Install Application on Device",
144 "id": "Ubuntu.Build.PackageInstall.Go",148 "id": "Ubuntu.Build.PackageInstall.Go",
145 "workingDirectory": "%0/..",149 "workingDirectory": "%0/..",
146150
=== modified file 'src/plugin.pri'
--- src/plugin.pri 2014-07-01 10:09:49 +0000
+++ src/plugin.pri 2014-07-23 14:19:54 +0000
@@ -17,6 +17,7 @@
17 DEFINES += UBUNTU_RESOURCE_PATH_LOCAL=\"$${PATHSTR}\" UBUNTU_BUILD_LOCAL17 DEFINES += UBUNTU_RESOURCE_PATH_LOCAL=\"$${PATHSTR}\" UBUNTU_BUILD_LOCAL
1818
19 #create a link so we get our wizards in the new project wizard19 #create a link so we get our wizards in the new project wizard
20 system("rm '$$(HOME)/.config/QtProject/qtcreator/templates'")
20 system("ln -s '$${PWD}/../share/qtcreator/templates' '$$(HOME)/.config/QtProject/qtcreator/templates'")21 system("ln -s '$${PWD}/../share/qtcreator/templates' '$$(HOME)/.config/QtProject/qtcreator/templates'")
21}22}
2223
2324
=== modified file 'src/ubuntu/ubuntu.pro'
--- src/ubuntu/ubuntu.pro 2014-07-07 06:33:37 +0000
+++ src/ubuntu/ubuntu.pro 2014-07-23 14:19:54 +0000
@@ -116,7 +116,10 @@
116 ubunturemoterunner.cpp \116 ubunturemoterunner.cpp \
117 abstractremoterunsupport.cpp\117 abstractremoterunsupport.cpp\
118 ubuntushared.cpp \118 ubuntushared.cpp \
119 ubuntupackagestep.cpp119 ubuntupackagestep.cpp \
120 ubuntudeploystepfactory.cpp \
121 ubuntudirectuploadstep.cpp \
122 ubuntuhtmlbuildconfiguration.cpp
120123
121HEADERS += \124HEADERS += \
122 ubuntuplugin.h \125 ubuntuplugin.h \
@@ -182,5 +185,8 @@
182 ubuntudevicesignaloperation.h \185 ubuntudevicesignaloperation.h \
183 ubunturemoterunner.h \186 ubunturemoterunner.h \
184 abstractremoterunsupport.h \187 abstractremoterunsupport.h \
185 ubuntupackagestep.h188 ubuntupackagestep.h \
189 ubuntudeploystepfactory.h \
190 ubuntudirectuploadstep.h \
191 ubuntuhtmlbuildconfiguration.h
186192
187193
=== modified file 'src/ubuntu/ubuntuclickmanifest.cpp'
--- src/ubuntu/ubuntuclickmanifest.cpp 2014-06-17 10:21:20 +0000
+++ src/ubuntu/ubuntuclickmanifest.cpp 2014-07-23 14:19:54 +0000
@@ -34,6 +34,7 @@
34#include <projectexplorer/session.h>34#include <projectexplorer/session.h>
35#include <projectexplorer/project.h>35#include <projectexplorer/project.h>
36#include <projectexplorer/iprojectmanager.h>36#include <projectexplorer/iprojectmanager.h>
37#include <projectexplorer/target.h>
3738
38using namespace Ubuntu::Internal;39using namespace Ubuntu::Internal;
3940
@@ -287,20 +288,22 @@
287288
288 if (fileName == QLatin1String(":/ubuntu/manifest.json.template")) {289 if (fileName == QLatin1String(":/ubuntu/manifest.json.template")) {
289290
290 QString mimeType = ProjectExplorer::SessionManager::startupProject()->projectManager()->mimeType();291
291 QString proName = ProjectExplorer::SessionManager::startupProject()->projectFilePath();292 ProjectExplorer::Project *proj = ProjectExplorer::SessionManager::startupProject();
293 QString mimeType = proj->projectManager()->mimeType();
294 QString proName = proj->projectFilePath();
292295
293 bool isUbuntuProject = (mimeType == QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE));296 bool isUbuntuProject = (mimeType == QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE));
294 bool isUbuntuHtmlProject = proName.endsWith(QLatin1String(Constants::UBUNTUHTMLPROJECT_SUFFIX));297 bool isUbuntuHtmlProject = proName.endsWith(QLatin1String(Constants::UBUNTUHTMLPROJECT_SUFFIX));
295298
296 QString defFramework;299 QString defFramework;
297 if(isUbuntuProject && isUbuntuHtmlProject) {300 if(isUbuntuProject && isUbuntuHtmlProject) {
298 defFramework = UbuntuClickTool::getMostRecentFramework(QLatin1String("html"));301 defFramework = UbuntuClickTool::getMostRecentFramework(QLatin1String("html"),UbuntuClickTool::clickTargetFromTarget(proj->activeTarget()));
299302
300 if(defFramework.isEmpty())303 if(defFramework.isEmpty())
301 defFramework = QLatin1String(Constants::UBUNTU_DEFAULT_HTML_FRAMEWORK);304 defFramework = QLatin1String(Constants::UBUNTU_DEFAULT_HTML_FRAMEWORK);
302 } else {305 } else {
303 defFramework = UbuntuClickTool::getMostRecentFramework(QLatin1String("qml"));306 defFramework = UbuntuClickTool::getMostRecentFramework(QLatin1String("qml"),UbuntuClickTool::clickTargetFromTarget(proj->activeTarget()));
304307
305 if(defFramework.isEmpty())308 if(defFramework.isEmpty())
306 defFramework = QLatin1String(Constants::UBUNTU_DEFAULT_QML_FRAMEWORK);309 defFramework = QLatin1String(Constants::UBUNTU_DEFAULT_QML_FRAMEWORK);
307310
=== modified file 'src/ubuntu/ubuntuclicktool.cpp'
--- src/ubuntu/ubuntuclicktool.cpp 2014-07-07 06:56:31 +0000
+++ src/ubuntu/ubuntuclicktool.cpp 2014-07-23 14:19:54 +0000
@@ -20,6 +20,7 @@
20#include "ubuntuclickmanifest.h"20#include "ubuntuclickmanifest.h"
21#include "ubuntuconstants.h"21#include "ubuntuconstants.h"
22#include "ubuntushared.h"22#include "ubuntushared.h"
23#include "clicktoolchain.h"
2324
24#include <QRegularExpression>25#include <QRegularExpression>
25#include <QDir>26#include <QDir>
@@ -44,6 +45,7 @@
44#include <projectexplorer/target.h>45#include <projectexplorer/target.h>
45#include <projectexplorer/project.h>46#include <projectexplorer/project.h>
46#include <projectexplorer/buildconfiguration.h>47#include <projectexplorer/buildconfiguration.h>
48#include <projectexplorer/kitinformation.h>
47#include <utils/qtcprocess.h>49#include <utils/qtcprocess.h>
48#include <utils/environment.h>50#include <utils/environment.h>
49#include <utils/consoleprocess.h>51#include <utils/consoleprocess.h>
@@ -96,21 +98,21 @@
96{98{
97 QString arguments;99 QString arguments;
98 switch (mode) {100 switch (mode) {
99 case Upgrade:101 case Upgrade:
100 params->setCommand(QLatin1String(Constants::UBUNTU_CLICK_BINARY));102 params->setCommand(QLatin1String(Constants::UBUNTU_CLICK_BINARY));
101 arguments = QString::fromLatin1(Constants::UBUNTU_CLICK_CHROOT_UPGRADE_ARGS)103 arguments = QString::fromLatin1(Constants::UBUNTU_CLICK_CHROOT_UPGRADE_ARGS)
102 .arg(target.architecture)104 .arg(target.architecture)
103 .arg(target.framework)105 .arg(target.framework)
104 .arg(target.series);106 .arg(target.series);
105 break;107 break;
106 case Delete:108 case Delete:
107 params->setCommand(QLatin1String(Constants::UBUNTU_SUDO_BINARY));109 params->setCommand(QLatin1String(Constants::UBUNTU_SUDO_BINARY));
108 arguments = QString::fromLatin1(Constants::UBUNTU_CLICK_CHROOT_DESTROY_ARGS)110 arguments = QString::fromLatin1(Constants::UBUNTU_CLICK_CHROOT_DESTROY_ARGS)
109 .arg(Constants::UBUNTU_SCRIPTPATH)111 .arg(Constants::UBUNTU_SCRIPTPATH)
110 .arg(target.architecture)112 .arg(target.architecture)
111 .arg(target.framework)113 .arg(target.framework)
112 .arg(target.series);114 .arg(target.series);
113 break;115 break;
114 }116 }
115117
116118
@@ -190,27 +192,101 @@
190 * \brief UbuntuClickTool::getSupportedFrameworks192 * \brief UbuntuClickTool::getSupportedFrameworks
191 * returns all available frameworks on the host system193 * returns all available frameworks on the host system
192 */194 */
193QStringList UbuntuClickTool::getSupportedFrameworks()195QStringList UbuntuClickTool::getSupportedFrameworks(const UbuntuClickTool::Target *target)
194{196{
195 QStringList items;197#if 0
196 QDir frameworksDir(QLatin1String(Constants::UBUNTU_CLICK_FRAMEWORKS_BASEPATH));198 QProcess proc;
197199 proc.setProgram(QStringLiteral("click"));
198 if(!frameworksDir.exists())200
199 return items;201 QStringList args;
200202 if (target) {
201 QStringList availableFrameworkFiles = frameworksDir.entryList(QStringList()<<QLatin1String("*.framework"),203 args << QStringLiteral("chroot")
202 QDir::Files | QDir::NoDotAndDotDot,204 << QStringLiteral("-a")
203 QDir::Name | QDir::Reversed);205 << target->architecture
204206 << QStringLiteral("-f")
205 QStringList availableFrameworks;207 << target->framework
206 foreach(QString fw, availableFrameworkFiles) {208 << QStringLiteral("run")
207 fw.replace(QLatin1String(".framework"),QString());209 << QStringLiteral("click");
208 availableFrameworks.append(fw);210 }
209 }211 args << QStringLiteral("framework")
210212 << QStringLiteral("list");
211 if(debug) qDebug()<<"Available Frameworks on the host"<<availableFrameworks;213
212 return availableFrameworks;214 if(debug) qDebug()<<"click"<<Utils::QtcProcess::joinArgs(args);
213215 proc.setArguments(args);
216 proc.start();
217 if (!proc.waitForFinished()) {
218 proc.kill();
219 return QStringList();
220 }
221
222 if(proc.exitCode() != 0 || proc.exitStatus() != QProcess::NormalExit)
223 return QStringList();
224
225 QStringList allFws = QString::fromLocal8Bit(proc.readAllStandardOutput()).split(QStringLiteral("\n"),QString::SkipEmptyParts);
226
227 //reverse the list
228 QStringList result;
229 result.reserve( allFws.size() );
230 std::reverse_copy( allFws.begin(), allFws.end(), std::back_inserter( result ) );
231
232 return result;
233#endif
234
235 if (!target) {
236 QStringList items;
237 QDir frameworksDir(QLatin1String(Constants::UBUNTU_CLICK_FRAMEWORKS_BASEPATH));
238
239 if(!frameworksDir.exists())
240 return items;
241
242 QStringList availableFrameworkFiles = frameworksDir.entryList(QStringList()<<QLatin1String("*.framework"),
243 QDir::Files | QDir::NoDotAndDotDot,
244 QDir::Name | QDir::Reversed);
245
246 QStringList availableFrameworks;
247 foreach(QString fw, availableFrameworkFiles) {
248 fw.replace(QLatin1String(".framework"),QString());
249 availableFrameworks.append(fw);
250 }
251
252 if(debug) qDebug()<<"Available Frameworks on the host"<<availableFrameworks;
253 return availableFrameworks;
254 } else {
255 //hardcode for now, click chroots are broken, click is not installed and even if its installed
256 //it does not show any valid informations
257 if(target->majorVersion == 14 && target->minorVersion == 10) {
258 return QStringList() << QStringLiteral("ubuntu-sdk-14.10-qml-dev3")
259 << QStringLiteral("ubuntu-sdk-14.10-qml-dev2")
260 << QStringLiteral("ubuntu-sdk-14.10-qml-dev1")
261 << QStringLiteral("ubuntu-sdk-14.10-papi-dev2")
262 << QStringLiteral("ubuntu-sdk-14.10-papi-dev1")
263 << QStringLiteral("ubuntu-sdk-14.10-html-dev2")
264 << QStringLiteral("ubuntu-sdk-14.10-html-dev1")
265 << QStringLiteral("ubuntu-sdk-14.10-dev2")
266 << QStringLiteral("ubuntu-sdk-14.10-dev1")
267 << QStringLiteral("ubuntu-sdk-14.04")
268 << QStringLiteral("ubuntu-sdk-14.04-qml")
269 << QStringLiteral("ubuntu-sdk-14.04-qml-dev1")
270 << QStringLiteral("ubuntu-sdk-14.04-papi")
271 << QStringLiteral("ubuntu-sdk-14.04-papi-dev1")
272 << QStringLiteral("ubuntu-sdk-14.04-html")
273 << QStringLiteral("ubuntu-sdk-14.04-html-dev1")
274 << QStringLiteral("ubuntu-sdk-14.04-dev1")
275 << QStringLiteral("ubuntu-sdk-13.10");
276 } else if (target->majorVersion == 14 && target->minorVersion == 4){
277 return QStringList() << QStringLiteral("ubuntu-sdk-14.04")
278 << QStringLiteral("ubuntu-sdk-14.04-qml")
279 << QStringLiteral("ubuntu-sdk-14.04-qml-dev1")
280 << QStringLiteral("ubuntu-sdk-14.04-papi")
281 << QStringLiteral("ubuntu-sdk-14.04-papi-dev1")
282 << QStringLiteral("ubuntu-sdk-14.04-html")
283 << QStringLiteral("ubuntu-sdk-14.04-html-dev1")
284 << QStringLiteral("ubuntu-sdk-14.04-dev1")
285 << QStringLiteral("ubuntu-sdk-13.10");
286 } else {
287 return QStringList() << QStringLiteral("ubuntu-sdk-13.10");
288 }
289 }
214}290}
215291
216/*!292/*!
@@ -231,10 +307,10 @@
231 * returns the framework with the highest number supporting the subFramework307 * returns the framework with the highest number supporting the subFramework
232 * or a empty string of no framework with the given \a subFramework was found308 * or a empty string of no framework with the given \a subFramework was found
233 */309 */
234QString UbuntuClickTool::getMostRecentFramework(const QString &subFramework)310QString UbuntuClickTool::getMostRecentFramework(const QString &subFramework, const Target *target)
235{311{
236 //returned list is ordered from newest -> oldest framework312 //returned list is ordered from newest -> oldest framework
237 QStringList allFws = getSupportedFrameworks();313 QStringList allFws = getSupportedFrameworks(target);
238314
239 QString currFw;315 QString currFw;
240 foreach(const QString &framework, allFws) {316 foreach(const QString &framework, allFws) {
@@ -421,6 +497,32 @@
421 return true;497 return true;
422}498}
423499
500/*!
501 * \brief UbuntuClickTool::clickTargetFromTarget
502 * Tries to get the Click target from a projectconfiguration,
503 * \returns 0 if nothing was found
504 */
505const UbuntuClickTool::Target *UbuntuClickTool::clickTargetFromTarget(ProjectExplorer::Target *t)
506{
507#ifndef IN_TEST_PROJECT
508 if(!t)
509 return 0;
510
511 ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(t->kit());
512 if(!tc || (tc->type() != QLatin1String(Constants::UBUNTU_CLICK_TOOLCHAIN_ID)))
513 return 0;
514
515 ClickToolChain *clickTc = static_cast<ClickToolChain*>(tc);
516 if(!clickTc)
517 return 0;
518
519 return &clickTc->clickTarget();
520#else
521 Q_UNUSED(t);
522 return 0;
523#endif
524}
525
424QDebug operator<<(QDebug dbg, const UbuntuClickTool::Target& t)526QDebug operator<<(QDebug dbg, const UbuntuClickTool::Target& t)
425{527{
426 dbg.nospace() << "("<<"series: "<<t.series<<" "528 dbg.nospace() << "("<<"series: "<<t.series<<" "
427529
=== modified file 'src/ubuntu/ubuntuclicktool.h'
--- src/ubuntu/ubuntuclicktool.h 2014-06-02 09:15:55 +0000
+++ src/ubuntu/ubuntuclicktool.h 2014-07-23 14:19:54 +0000
@@ -71,13 +71,14 @@
7171
72 static QString targetBasePath (const Target& target);72 static QString targetBasePath (const Target& target);
73 static bool getTargetFromUser (Target* target, const QString &framework=QString());73 static bool getTargetFromUser (Target* target, const QString &framework=QString());
74 static QStringList getSupportedFrameworks ();74 static QStringList getSupportedFrameworks (const Target *target);
75 static QString getMostRecentFramework ( const QString &subFramework );75 static QString getMostRecentFramework ( const QString &subFramework, const Target *target );
7676
77 static bool targetExists (const Target& target);77 static bool targetExists (const Target& target);
78 static QList<Target> listAvailableTargets (const QString &framework=QString());78 static QList<Target> listAvailableTargets (const QString &framework=QString());
79 static QPair<int,int> targetVersion (const Target& target);79 static QPair<int,int> targetVersion (const Target& target);
80 static bool targetFromPath(const QString& targetPath, Target* tg);80 static bool targetFromPath(const QString& targetPath, Target* tg);
81 static const Target *clickTargetFromTarget(ProjectExplorer::Target *t);
81};82};
8283
83QDebug operator<<(QDebug dbg, const UbuntuClickTool::Target& t);84QDebug operator<<(QDebug dbg, const UbuntuClickTool::Target& t);
8485
=== modified file 'src/ubuntu/ubuntucmakemakestep.cpp'
--- src/ubuntu/ubuntucmakemakestep.cpp 2014-06-17 09:25:03 +0000
+++ src/ubuntu/ubuntucmakemakestep.cpp 2014-07-23 14:19:54 +0000
@@ -50,11 +50,6 @@
50 if(!canHandle(parent->target()))50 if(!canHandle(parent->target()))
51 return QList<Core::Id>();51 return QList<Core::Id>();
5252
53 if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY) {
54 return QList<Core::Id>()
55 << Core::Id(Constants::UBUNTU_CLICK_PACKAGESTEP_ID);
56 }
57
58 return QList<Core::Id>() << Core::Id(Constants::UBUNTU_CLICK_CMAKE_MAKESTEP_ID);53 return QList<Core::Id>() << Core::Id(Constants::UBUNTU_CLICK_CMAKE_MAKESTEP_ID);
59}54}
6055
@@ -83,8 +78,6 @@
83{78{
84 if (id == Constants::UBUNTU_CLICK_CMAKE_MAKESTEP_ID)79 if (id == Constants::UBUNTU_CLICK_CMAKE_MAKESTEP_ID)
85 return tr("UbuntuSDK-Make", "Display name for UbuntuCMakeMakeStep id.");80 return tr("UbuntuSDK-Make", "Display name for UbuntuCMakeMakeStep id.");
86 if (id == Constants::UBUNTU_CLICK_PACKAGESTEP_ID)
87 return tr("UbuntuSDK create click package", "Display name for UbuntuPackageStep id.");
88 return QString();81 return QString();
89}82}
9083
@@ -100,11 +93,6 @@
100 if (!canCreate(parent, id))93 if (!canCreate(parent, id))
101 return 0;94 return 0;
10295
103 if (id == Constants::UBUNTU_CLICK_PACKAGESTEP_ID) {
104 UbuntuPackageStep *step = new UbuntuPackageStep(parent);
105 return step;
106 }
107
108 UbuntuCMakeMakeStep *step = new UbuntuCMakeMakeStep(parent);96 UbuntuCMakeMakeStep *step = new UbuntuCMakeMakeStep(parent);
109 if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {97 if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN) {
110 step->setUseNinja(false);98 step->setUseNinja(false);
@@ -117,11 +105,6 @@
117bool UbuntuCMakeMakeStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const105bool UbuntuCMakeMakeStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
118{106{
119 Core::Id toRestore = ProjectExplorer::idFromMap(map);107 Core::Id toRestore = ProjectExplorer::idFromMap(map);
120
121 //backwards compatibility to older projects
122 if( toRestore == Constants::UBUNTU_DEPLOY_MAKESTEP_ID )
123 return canHandle(parent->target());
124
125 return canCreate(parent, toRestore);108 return canCreate(parent, toRestore);
126}109}
127110
@@ -131,18 +114,11 @@
131 return 0;114 return 0;
132115
133 Core::Id toRestore = ProjectExplorer::idFromMap(map);116 Core::Id toRestore = ProjectExplorer::idFromMap(map);
134117 ProjectExplorer::BuildStep* step = create(parent,toRestore);
135 //backwards compatibility to older projects118 if(step->fromMap(map))
136 if( toRestore == Constants::UBUNTU_DEPLOY_MAKESTEP_ID ) {
137 UbuntuPackageStep *step = new UbuntuPackageStep(parent);
138 return step;119 return step;
139 } else {
140 ProjectExplorer::BuildStep* step = create(parent,toRestore);
141 if(step->fromMap(map))
142 return step;
143120
144 delete step;121 delete step;
145 }
146 return 0;122 return 0;
147}123}
148124
@@ -158,8 +134,6 @@
158134
159 if(product->id() == Core::Id(Constants::UBUNTU_CLICK_CMAKE_MAKESTEP_ID))135 if(product->id() == Core::Id(Constants::UBUNTU_CLICK_CMAKE_MAKESTEP_ID))
160 return new UbuntuCMakeMakeStep(parent, static_cast<UbuntuCMakeMakeStep *>(product));136 return new UbuntuCMakeMakeStep(parent, static_cast<UbuntuCMakeMakeStep *>(product));
161 else if(product->id() == Core::Id(Constants::UBUNTU_CLICK_PACKAGESTEP_ID))
162 return new UbuntuPackageStep(parent, static_cast<UbuntuPackageStep *>(product));
163137
164 QTC_ASSERT(false,return 0);138 QTC_ASSERT(false,return 0);
165}139}
166140
=== modified file 'src/ubuntu/ubuntuconstants.h'
--- src/ubuntu/ubuntuconstants.h 2014-06-11 13:50:09 +0000
+++ src/ubuntu/ubuntuconstants.h 2014-07-23 14:19:54 +0000
@@ -151,6 +151,7 @@
151const char UBUNTUPROJECT_RUNCONTROL_ID[] = "UbuntuProjectManager.UbuntuRunConfiguration";151const char UBUNTUPROJECT_RUNCONTROL_ID[] = "UbuntuProjectManager.UbuntuRunConfiguration";
152152
153const char UBUNTUHTML_PROJECT_LAUNCHER_EXE[] = "ubuntu-html5-app-launcher";153const char UBUNTUHTML_PROJECT_LAUNCHER_EXE[] = "ubuntu-html5-app-launcher";
154const char UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE[] = "webapp-container";
154const char UBUNTUSCOPES_PROJECT_LAUNCHER_EXE[] = "unity-scope-tool";155const char UBUNTUSCOPES_PROJECT_LAUNCHER_EXE[] = "unity-scope-tool";
155156
156const char UBUNTU_PROJECT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer", "Ubuntu");157const char UBUNTU_PROJECT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer", "Ubuntu");
@@ -508,7 +509,7 @@
508const char UBUNTU_CLICK_CMAKE_WRAPPER[] = "%0/qtc_chroot_cmake2";509const char UBUNTU_CLICK_CMAKE_WRAPPER[] = "%0/qtc_chroot_cmake2";
509const char UBUNTU_CLICK_MAKE_WRAPPER[] = "%0/qtc_chroot_make2";510const char UBUNTU_CLICK_MAKE_WRAPPER[] = "%0/qtc_chroot_make2";
510const char UBUNTU_CLICK_GCC_WRAPPER[] = "%0/qtc_chroot_gcc";511const char UBUNTU_CLICK_GCC_WRAPPER[] = "%0/qtc_chroot_gcc";
511512const char UBUNTU_CLICK_HTML_BC_ID[] = "UbuntuProjectManager.UbuntuHTML5.BuildConfiguration";
512//Devicesupport513//Devicesupport
513const char UBUNTU_DEVICE_TYPE_ID[] = "UbuntuProjectManager.DeviceTypeId";514const char UBUNTU_DEVICE_TYPE_ID[] = "UbuntuProjectManager.DeviceTypeId";
514const char UBUNTU_DEVICE_SSHIDENTITY[] = "%0/.config/ubuntu-sdk/ubuntudevice_id_rsa";515const char UBUNTU_DEVICE_SSHIDENTITY[] = "%0/.config/ubuntu-sdk/ubuntudevice_id_rsa";
515516
=== added file 'src/ubuntu/ubuntudeploystepfactory.cpp'
--- src/ubuntu/ubuntudeploystepfactory.cpp 1970-01-01 00:00:00 +0000
+++ src/ubuntu/ubuntudeploystepfactory.cpp 2014-07-23 14:19:54 +0000
@@ -0,0 +1,138 @@
1#include "ubuntudeploystepfactory.h"
2#include "ubuntuprojectguesser.h"
3#include "ubuntuconstants.h"
4#include "ubuntudirectuploadstep.h"
5#include "ubuntupackagestep.h"
6
7#include <utils/qtcassert.h>
8
9#include <projectexplorer/buildstep.h>
10#include <projectexplorer/buildsteplist.h>
11#include <projectexplorer/kitinformation.h>
12#include <projectexplorer/target.h>
13#include <projectexplorer/project.h>
14#include <projectexplorer/toolchain.h>
15#include <projectexplorer/projectexplorerconstants.h>
16
17#include <qmlprojectmanager/qmlprojectconstants.h>
18
19#include <cmakeprojectmanager/cmakeprojectconstants.h>
20
21namespace Ubuntu {
22namespace Internal {
23
24QList<Core::Id> UbuntuDeployStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
25{
26 QList<Core::Id> types;
27
28 if (parent->id() != ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
29 return types;
30
31 Core::Id targetDevice = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->target()->kit());
32 if(targetDevice != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE && targetDevice != Ubuntu::Constants::UBUNTU_DEVICE_TYPE_ID)
33 return types;
34
35 bool isRemote = targetDevice == Ubuntu::Constants::UBUNTU_DEVICE_TYPE_ID;
36 bool isCMake = parent->target()->project()->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID;
37 bool isHTML = parent->target()->project()->id() == Ubuntu::Constants::UBUNTUPROJECT_ID;
38 //bool isQML = parent->target()->project()->id() == "QmlProjectManager.QmlProject";
39
40 if (isRemote) {
41 //IF we have a remote device we just support a ubuntu toolchain
42 ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(parent->target()->kit());
43 if(tc && tc->type() != QLatin1String(Ubuntu::Constants::UBUNTU_CLICK_TOOLCHAIN_ID))
44 return types;
45 }
46
47 if(isRemote && isCMake && !UbuntuProjectGuesser::isScopesProject(parent->target()->project()))
48 types << Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID
49 << Constants::UBUNTU_CLICK_PACKAGESTEP_ID;
50 else if(isRemote && isHTML)
51 types << Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID
52 << Constants::UBUNTU_CLICK_PACKAGESTEP_ID;
53
54 return types;
55}
56
57QString UbuntuDeployStepFactory::displayNameForId(const Core::Id id) const
58{
59 if (id == Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID)
60 return UbuntuDirectUploadStep::displayName();
61 else if (id == Constants::UBUNTU_CLICK_PACKAGESTEP_ID)
62 return tr("UbuntuSDK create click package", "Display name for UbuntuPackageStep id.");
63 return QString();
64}
65
66bool UbuntuDeployStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
67{
68 return availableCreationIds(parent).contains(id);
69}
70
71ProjectExplorer::BuildStep *UbuntuDeployStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
72{
73 if (!canCreate(parent, id))
74 return 0;
75
76 if(id == Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID)
77 return new UbuntuDirectUploadStep(parent);
78 else if (id == Constants::UBUNTU_CLICK_PACKAGESTEP_ID) {
79 UbuntuPackageStep *step = new UbuntuPackageStep(parent);
80 return step;
81 }
82
83 return 0;
84}
85
86bool UbuntuDeployStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
87{
88 Core::Id toRestore = ProjectExplorer::idFromMap(map);
89
90 //backwards compatibility to older projects
91 if( toRestore == Constants::UBUNTU_DEPLOY_MAKESTEP_ID )
92 return canCreate(parent,Core::Id(Constants::UBUNTU_CLICK_PACKAGESTEP_ID));
93
94 return canCreate(parent,toRestore);
95}
96
97ProjectExplorer::BuildStep *UbuntuDeployStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
98{
99 Core::Id id = ProjectExplorer::idFromMap(map);
100 if(!canCreate(parent,id))
101 return 0;
102
103 //backwards compatibility to older projects
104 if( id == Constants::UBUNTU_DEPLOY_MAKESTEP_ID ) {
105 UbuntuPackageStep *step = new UbuntuPackageStep(parent);
106 return step;
107 }
108
109 ProjectExplorer::BuildStep* step = create(parent,id);
110 if (!step->fromMap(map)) {
111 delete step;
112 return 0;
113 }
114
115 return step;
116}
117
118bool UbuntuDeployStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
119{
120 return canCreate(parent,product->id());
121}
122
123ProjectExplorer::BuildStep *UbuntuDeployStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
124{
125 if (!canClone(parent, product))
126 return 0;
127
128 const Core::Id id = product->id();
129 if(id == Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID)
130 return new UbuntuDirectUploadStep(parent, static_cast<UbuntuDirectUploadStep *>(product));
131 else if(id == Core::Id(Constants::UBUNTU_CLICK_PACKAGESTEP_ID))
132 return new UbuntuPackageStep(parent, static_cast<UbuntuPackageStep *>(product));
133
134 return 0;
135}
136
137} // namespace Internal
138} // namespace Ubuntu
0139
=== added file 'src/ubuntu/ubuntudeploystepfactory.h'
--- src/ubuntu/ubuntudeploystepfactory.h 1970-01-01 00:00:00 +0000
+++ src/ubuntu/ubuntudeploystepfactory.h 2014-07-23 14:19:54 +0000
@@ -0,0 +1,29 @@
1#ifndef UBUNTU_INTERNAL_UBUNTUDEPLOYSTEPFACTORY_H
2#define UBUNTU_INTERNAL_UBUNTUDEPLOYSTEPFACTORY_H
3
4#include <projectexplorer/buildstep.h>
5#include <projectexplorer/abstractprocessstep.h>
6
7namespace Ubuntu {
8namespace Internal {
9
10class UbuntuDeployStepFactory : public ProjectExplorer::IBuildStepFactory
11{
12 Q_OBJECT
13
14public:
15 // IBuildStepFactory interface
16 virtual QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const override;
17 virtual QString displayNameForId(const Core::Id id) const override;
18 virtual bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const override;
19 virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id) override;
20 virtual bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const override;
21 virtual ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) override;
22 virtual bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const override;
23 virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
24};
25
26} // namespace Internal
27} // namespace Ubuntu
28
29#endif // UBUNTU_INTERNAL_UBUNTUDEPLOYSTEPFACTORY_H
030
=== added file 'src/ubuntu/ubuntudirectuploadstep.cpp'
--- src/ubuntu/ubuntudirectuploadstep.cpp 1970-01-01 00:00:00 +0000
+++ src/ubuntu/ubuntudirectuploadstep.cpp 2014-07-23 14:19:54 +0000
@@ -0,0 +1,134 @@
1#include "ubuntudirectuploadstep.h"
2#include "ubuntupackagestep.h"
3#include "ubuntuconstants.h"
4
5#include <utils/qtcassert.h>
6#include <projectexplorer/deployablefile.h>
7#include <projectexplorer/target.h>
8#include <projectexplorer/project.h>
9
10#include <remotelinux/genericdirectuploadservice.h>
11#include <remotelinux/remotelinuxdeployconfiguration.h>
12
13#include <QFileInfo>
14
15namespace Ubuntu {
16namespace Internal {
17
18enum {
19 debug = 0
20};
21
22UbuntuDirectUploadStep::UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl)
23 : AbstractRemoteLinuxDeployStep(bsl, UbuntuDirectUploadStep::stepId())
24 , m_deployService(new RemoteLinux::GenericDirectUploadService(this))
25{
26 setDefaultDisplayName(displayName());
27}
28
29UbuntuDirectUploadStep::UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl, UbuntuDirectUploadStep *other)
30 : AbstractRemoteLinuxDeployStep(bsl, other)
31 , m_deployService(new RemoteLinux::GenericDirectUploadService(this))
32{
33 setDefaultDisplayName(displayName());
34
35 connect(target()->project(),SIGNAL(displayNameChanged()),this,SLOT(projectNameChanged()));
36 connect(target(),SIGNAL(applicationTargetsChanged()),this,SLOT(projectNameChanged()));
37}
38
39UbuntuDirectUploadStep::~UbuntuDirectUploadStep()
40{
41}
42
43void UbuntuDirectUploadStep::run(QFutureInterface<bool> &fi)
44{
45 m_foundClickPackage = false;
46 projectNameChanged();
47 if(!m_foundClickPackage) {
48 emit addOutput(tr("Deploy step failed. No click package was created"), ErrorMessageOutput);
49 fi.reportResult(false);
50 emit finished();
51 return;
52 }
53
54
55 m_deployService->setIncrementalDeployment(false);
56 m_deployService->setIgnoreMissingFiles(false);
57
58 QString whyNot;
59 if(!deployService()->isDeploymentPossible(&whyNot)) {
60 emit addOutput(tr("Deploy step failed. %1").arg(whyNot), ErrorMessageOutput);
61 fi.reportResult(false);
62 emit finished();
63 return;
64 }
65
66 AbstractRemoteLinuxDeployStep::run(fi);
67}
68
69ProjectExplorer::BuildStepConfigWidget *UbuntuDirectUploadStep::createConfigWidget()
70{
71 return new ProjectExplorer::SimpleBuildStepConfigWidget(this);
72}
73
74bool UbuntuDirectUploadStep::initInternal(QString *error)
75{
76 Q_UNUSED(error)
77 return true;
78}
79
80RemoteLinux::AbstractRemoteLinuxDeployService *UbuntuDirectUploadStep::deployService() const
81{
82 return m_deployService;
83}
84
85bool UbuntuDirectUploadStep::fromMap(const QVariantMap &map)
86{
87 if (!AbstractRemoteLinuxDeployStep::fromMap(map))
88 return false;
89 return true;
90}
91
92QVariantMap UbuntuDirectUploadStep::toMap() const
93{
94 return AbstractRemoteLinuxDeployStep::toMap();
95}
96
97
98Core::Id UbuntuDirectUploadStep::stepId()
99{
100 return Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID;
101}
102
103QString UbuntuDirectUploadStep::displayName()
104{
105 return tr("Upload files to Ubuntu Device");
106}
107
108void UbuntuDirectUploadStep::projectNameChanged()
109{
110 if(debug) qDebug()<<"------------------------ Updating DEPLOYLIST ---------------------------";
111
112 ProjectExplorer::BuildStepList *bsList = deployConfiguration()->stepList();
113
114 QList<ProjectExplorer::DeployableFile> list;
115 foreach(ProjectExplorer::BuildStep *currStep ,bsList->steps()) {
116 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(currStep);
117 if(!pckStep)
118 continue;
119
120 QFileInfo info(pckStep->packagePath());
121 if(info.exists()) {
122 list.append(ProjectExplorer::DeployableFile(info.filePath(),
123 QStringLiteral("/tmp")));
124
125 list.append(ProjectExplorer::DeployableFile(QStringLiteral("%1/qtc_device_applaunch.py").arg(Constants::UBUNTU_SCRIPTPATH),
126 QStringLiteral("/tmp")));
127 m_deployService->setDeployableFiles(list);
128 m_foundClickPackage = true;
129 break;
130 }
131 }
132}
133} // namespace Internal
134} // namespace Ubuntu
0135
=== added file 'src/ubuntu/ubuntudirectuploadstep.h'
--- src/ubuntu/ubuntudirectuploadstep.h 1970-01-01 00:00:00 +0000
+++ src/ubuntu/ubuntudirectuploadstep.h 2014-07-23 14:19:54 +0000
@@ -0,0 +1,46 @@
1#ifndef UBUNTU_INTERNAL_UBUNTUDIRECTUPLOADSTEP_H
2#define UBUNTU_INTERNAL_UBUNTUDIRECTUPLOADSTEP_H
3
4#include <remotelinux/abstractremotelinuxdeploystep.h>
5
6namespace RemoteLinux {
7class GenericDirectUploadService;
8}
9
10namespace Ubuntu {
11namespace Internal {
12
13class UbuntuDirectUploadStep : public RemoteLinux::AbstractRemoteLinuxDeployStep
14{
15 Q_OBJECT
16
17public:
18 UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl);
19 UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl, UbuntuDirectUploadStep *other);
20 ~UbuntuDirectUploadStep();
21
22 // BuildStep interface
23 virtual void run(QFutureInterface<bool> &fi) override;
24
25 ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
26 bool initInternal(QString *error = 0) override;
27
28 RemoteLinux::AbstractRemoteLinuxDeployService *deployService() const override;
29 bool fromMap(const QVariantMap &map) override;
30 QVariantMap toMap() const override;
31
32 static Core::Id stepId();
33 static QString displayName();
34
35private slots:
36 void projectNameChanged();
37
38private:
39 RemoteLinux::GenericDirectUploadService *m_deployService;
40 bool m_foundClickPackage;
41};
42
43} // namespace Internal
44} // namespace Ubuntu
45
46#endif // UBUNTU_INTERNAL_UBUNTUDIRECTUPLOADSTEP_H
047
=== added file 'src/ubuntu/ubuntuhtmlbuildconfiguration.cpp'
--- src/ubuntu/ubuntuhtmlbuildconfiguration.cpp 1970-01-01 00:00:00 +0000
+++ src/ubuntu/ubuntuhtmlbuildconfiguration.cpp 2014-07-23 14:19:54 +0000
@@ -0,0 +1,202 @@
1#include "ubuntuhtmlbuildconfiguration.h"
2#include "ubuntuconstants.h"
3#include "ubuntuproject.h"
4
5#include <coreplugin/mimedatabase.h>
6
7#include <projectexplorer/target.h>
8#include <projectexplorer/project.h>
9#include <projectexplorer/buildinfo.h>
10#include <projectexplorer/kit.h>
11#include <utils/fancylineedit.h>
12
13#include <QFormLayout>
14
15namespace Ubuntu {
16namespace Internal {
17
18/*!
19 * \class UbuntuHtmlBuildConfiguration
20 *
21 * Even though HTML projects don't need to be built, we need
22 * that BuildConfiguration to store the Builddirectory (where the click
23 * package goes) and to enable the Target page to show us some actual
24 * targets
25 */
26
27UbuntuHtmlBuildConfiguration::UbuntuHtmlBuildConfiguration(ProjectExplorer::Target *target)
28 : BuildConfiguration(target,Constants::UBUNTU_CLICK_HTML_BC_ID)
29{
30}
31
32UbuntuHtmlBuildConfiguration::UbuntuHtmlBuildConfiguration(ProjectExplorer::Target *target, UbuntuHtmlBuildConfiguration *source)
33 : BuildConfiguration(target,source)
34{
35
36}
37
38bool UbuntuHtmlBuildConfiguration::fromMap(const QVariantMap &map)
39{
40 return BuildConfiguration::fromMap(map);
41}
42
43QVariantMap UbuntuHtmlBuildConfiguration::toMap() const
44{
45 return BuildConfiguration::toMap();
46}
47
48ProjectExplorer::NamedWidget *UbuntuHtmlBuildConfiguration::createConfigWidget()
49{
50 return new UbuntuHtmlBuildSettingsWidget(this);
51}
52
53ProjectExplorer::BuildConfiguration::BuildType UbuntuHtmlBuildConfiguration::buildType() const
54{
55 return Release;
56}
57
58UbuntuHtmlBuildConfigurationFactory::UbuntuHtmlBuildConfigurationFactory(QObject *parent)
59 : IBuildConfigurationFactory(parent)
60{
61
62}
63
64UbuntuHtmlBuildConfigurationFactory::~UbuntuHtmlBuildConfigurationFactory()
65{
66
67}
68
69int UbuntuHtmlBuildConfigurationFactory::priority(const ProjectExplorer::Target *parent) const
70{
71 if (canHandle(parent))
72 return 100;
73 return -1;
74}
75
76QList<ProjectExplorer::BuildInfo *> UbuntuHtmlBuildConfigurationFactory::availableBuilds(const ProjectExplorer::Target *parent) const
77{
78 if(!canHandle(parent))
79 return QList<ProjectExplorer::BuildInfo *>();
80 return createBuildInfos(parent->kit(),parent->project()->projectFilePath());
81}
82
83int UbuntuHtmlBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
84{
85 return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
86 .matchesType(QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE))) ? 100 : -1;
87}
88
89QList<ProjectExplorer::BuildInfo *> UbuntuHtmlBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, const QString &projectPath) const
90{
91 UbuntuKitMatcher m;
92 if(priority(k,projectPath) < 0 || !m.matches(k))
93 return QList<ProjectExplorer::BuildInfo *>();
94
95 return createBuildInfos(k,projectPath);
96}
97
98UbuntuHtmlBuildConfiguration *UbuntuHtmlBuildConfigurationFactory::create(ProjectExplorer::Target *parent, const ProjectExplorer::BuildInfo *info) const
99{
100 QTC_ASSERT(info->factory() == this, return 0);
101 QTC_ASSERT(info->kitId == parent->kit()->id(), return 0);
102 QTC_ASSERT(!info->displayName.isEmpty(), return 0);
103
104 UbuntuHtmlBuildConfiguration *conf = new UbuntuHtmlBuildConfiguration(parent);
105 conf->setBuildDirectory(info->buildDirectory);
106 conf->setDefaultDisplayName(info->displayName);
107 conf->setDisplayName(info->displayName);
108
109 return conf;
110}
111
112bool UbuntuHtmlBuildConfigurationFactory::canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const
113{
114 if (!canHandle(parent))
115 return false;
116 return ProjectExplorer::idFromMap(map) == Constants::UBUNTU_CLICK_HTML_BC_ID;
117}
118
119UbuntuHtmlBuildConfiguration *UbuntuHtmlBuildConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map)
120{
121 if (!canRestore(parent,map) )
122 return 0;
123
124 UbuntuHtmlBuildConfiguration *conf = new UbuntuHtmlBuildConfiguration(parent);
125 if (conf->fromMap(map))
126 return conf;
127
128 delete conf;
129 return 0;
130}
131
132bool UbuntuHtmlBuildConfigurationFactory::canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *product) const
133{
134 if (!canHandle(parent))
135 return false;
136 if (product->id() != Constants::UBUNTU_CLICK_HTML_BC_ID )
137 return false;
138
139 return true;
140}
141
142UbuntuHtmlBuildConfiguration *UbuntuHtmlBuildConfigurationFactory::clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *product)
143{
144 if (!canClone(parent,product))
145 return 0;
146 return new UbuntuHtmlBuildConfiguration(parent,static_cast<UbuntuHtmlBuildConfiguration*>(product));
147}
148
149bool UbuntuHtmlBuildConfigurationFactory::canHandle(const ProjectExplorer::Target *t) const
150{
151 UbuntuKitMatcher m;
152 if(!m.matches(t->kit()))
153 return false;
154
155 if (t->project()->projectManager()->mimeType() != QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE))
156 return false;
157
158 return true;
159}
160
161QList<ProjectExplorer::BuildInfo *> UbuntuHtmlBuildConfigurationFactory::createBuildInfos(const ProjectExplorer::Kit *k, const QString &projectDir) const
162{
163 QList<ProjectExplorer::BuildInfo *> builds;
164
165 ProjectExplorer::BuildInfo *info = new ProjectExplorer::BuildInfo(this);
166 info->buildDirectory = Utils::FileName::fromString(UbuntuProject::shadowBuildDirectory(projectDir,k,QStringLiteral("default")));
167 info->typeName = tr("Html5");
168 info->kitId = k->id();
169 info->supportsShadowBuild = true;
170 info->displayName = tr("Default");
171
172 builds << info;
173 return builds;
174}
175
176UbuntuHtmlBuildSettingsWidget::UbuntuHtmlBuildSettingsWidget(UbuntuHtmlBuildConfiguration *conf, QWidget *parent)
177 : NamedWidget(parent) ,
178 m_buildConfiguration(conf)
179{
180 QFormLayout *fl = new QFormLayout(this);
181 fl->setContentsMargins(20, -1, 0, -1);
182 fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
183 setLayout(fl);
184
185 m_pathChooser = new Utils::PathChooser(this);
186 m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory().toString());
187 fl->addRow(tr("Build directory:"), m_pathChooser);
188
189 connect(m_pathChooser->lineEdit(),SIGNAL(editingFinished()),this,SLOT(onBuilddirChanged()));
190 connect(m_buildConfiguration,SIGNAL(buildDirectoryChanged()),this,SLOT(updateBuildDirectory()));
191}
192
193void UbuntuHtmlBuildSettingsWidget::updateBuildDirectory() const
194{
195 m_pathChooser->blockSignals(true);
196 m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory().toString());
197 m_pathChooser->blockSignals(false);
198}
199
200
201} // namespace Internal
202} // namespace Ubuntu
0203
=== added file 'src/ubuntu/ubuntuhtmlbuildconfiguration.h'
--- src/ubuntu/ubuntuhtmlbuildconfiguration.h 1970-01-01 00:00:00 +0000
+++ src/ubuntu/ubuntuhtmlbuildconfiguration.h 2014-07-23 14:19:54 +0000
@@ -0,0 +1,71 @@
1#ifndef UBUNTU_INTERNAL_UBUNTUHTMLBUILDCONFIGURATION_H
2#define UBUNTU_INTERNAL_UBUNTUHTMLBUILDCONFIGURATION_H
3
4#include <projectexplorer/buildconfiguration.h>
5#include <utils/pathchooser.h>
6#include <projectexplorer/namedwidget.h>
7
8namespace Ubuntu {
9namespace Internal {
10
11class UbuntuHtmlBuildConfiguration : public ProjectExplorer::BuildConfiguration
12{
13 Q_OBJECT
14
15public:
16 UbuntuHtmlBuildConfiguration(ProjectExplorer::Target *target);
17 UbuntuHtmlBuildConfiguration(ProjectExplorer::Target *target, UbuntuHtmlBuildConfiguration *source);
18
19 // ProjectConfiguration interface
20 virtual bool fromMap(const QVariantMap &map) override;
21 virtual QVariantMap toMap() const override;
22
23 // BuildConfiguration interface
24 virtual ProjectExplorer::NamedWidget *createConfigWidget() override;
25 virtual BuildType buildType() const override;
26
27private:
28 friend class UbuntuHtmlBuildConfigurationFactory;
29};
30
31class UbuntuHtmlBuildSettingsWidget : public ProjectExplorer::NamedWidget
32{
33 Q_OBJECT
34
35public:
36 explicit UbuntuHtmlBuildSettingsWidget(UbuntuHtmlBuildConfiguration *conf, QWidget *parent = 0);
37
38private slots:
39 void updateBuildDirectory () const;
40
41private:
42 Utils::PathChooser *m_pathChooser;
43 UbuntuHtmlBuildConfiguration *m_buildConfiguration;
44};
45
46class UbuntuHtmlBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
47{
48 Q_OBJECT
49public:
50 UbuntuHtmlBuildConfigurationFactory(QObject *parent = 0);
51 ~UbuntuHtmlBuildConfigurationFactory();
52
53 // IBuildConfigurationFactory interface
54 virtual int priority(const ProjectExplorer::Target *parent) const override;
55 virtual QList<ProjectExplorer::BuildInfo *> availableBuilds(const ProjectExplorer::Target *parent) const override;
56 virtual int priority(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
57 virtual QList<ProjectExplorer::BuildInfo *> availableSetups(const ProjectExplorer::Kit *k, const QString &projectPath) const override;
58 virtual UbuntuHtmlBuildConfiguration *create(ProjectExplorer::Target *parent, const ProjectExplorer::BuildInfo *info) const override;
59 virtual bool canRestore(const ProjectExplorer::Target *parent, const QVariantMap &map) const override;
60 virtual UbuntuHtmlBuildConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map) override;
61 virtual bool canClone(const ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *product) const override;
62 virtual UbuntuHtmlBuildConfiguration*clone(ProjectExplorer::Target *parent, ProjectExplorer::BuildConfiguration *product) override;
63private:
64 bool canHandle(const ProjectExplorer::Target *t) const;
65 QList<ProjectExplorer::BuildInfo *> createBuildInfos (const ProjectExplorer::Kit *k, const QString &projectDir) const;
66};
67
68} // namespace Internal
69} // namespace Ubuntu
70
71#endif // UBUNTU_INTERNAL_UBUNTUHTMLBUILDCONFIGURATION_H
072
=== modified file 'src/ubuntu/ubuntulocalrunconfiguration.cpp'
--- src/ubuntu/ubuntulocalrunconfiguration.cpp 2014-07-08 09:35:23 +0000
+++ src/ubuntu/ubuntulocalrunconfiguration.cpp 2014-07-23 14:19:54 +0000
@@ -20,6 +20,7 @@
20#include "ubuntuproject.h"20#include "ubuntuproject.h"
21#include "ubuntuprojectguesser.h"21#include "ubuntuprojectguesser.h"
22#include "ubuntuclickmanifest.h"22#include "ubuntuclickmanifest.h"
23#include "ubunturemoterunconfiguration.h"
2324
24#include <qtsupport/baseqtversion.h>25#include <qtsupport/baseqtversion.h>
25#include <qtsupport/qtkitinformation.h>26#include <qtsupport/qtkitinformation.h>
@@ -177,7 +178,15 @@
177 return desk;178 return desk;
178 }179 }
179180
180 QDir package_dir(config->target()->activeBuildConfiguration()->buildDirectory().toString()+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR));181
182 UbuntuRemoteRunConfiguration *remConf = qobject_cast<UbuntuRemoteRunConfiguration*>(config);
183 if (!remConf) {
184 if(errorMessage)
185 *errorMessage = tr("Invalid configuration type");
186 return QString();
187 }
188
189 QDir package_dir(remConf->packageDir());
181 if(!package_dir.exists()) {190 if(!package_dir.exists()) {
182 if(errorMessage)191 if(errorMessage)
183 *errorMessage = tr("No packaging directory available, please check if the deploy configuration is correct.");192 *errorMessage = tr("No packaging directory available, please check if the deploy configuration is correct.");
@@ -376,6 +385,13 @@
376 m_executable = env.searchInPath(QString::fromLatin1(Ubuntu::Constants::UBUNTUHTML_PROJECT_LAUNCHER_EXE));385 m_executable = env.searchInPath(QString::fromLatin1(Ubuntu::Constants::UBUNTUHTML_PROJECT_LAUNCHER_EXE));
377 m_args = QStringList()<<QString::fromLatin1("--www=%0/www").arg(ubuntuProject->projectDirectory())386 m_args = QStringList()<<QString::fromLatin1("--www=%0/www").arg(ubuntuProject->projectDirectory())
378 <<QString::fromLatin1("--inspector");387 <<QString::fromLatin1("--inspector");
388 } else if (ubuntuProject->mainFile().endsWith(QStringLiteral(".desktop"), Qt::CaseInsensitive)) {
389 Utils::Environment env = Utils::Environment::systemEnvironment();
390
391 if(!readDesktopFile(ubuntuProject->projectDirectory()+QDir::separator()+ubuntuProject->mainFile(),&m_executable,&m_args,errorMessage))
392 return false;
393
394 m_executable = env.searchInPath(QString::fromLatin1(Ubuntu::Constants::UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE));
379 } else {395 } else {
380 m_executable = QtSupport::QtKitInformation::qtVersion(target()->kit())->qmlsceneCommand();396 m_executable = QtSupport::QtKitInformation::qtVersion(target()->kit())->qmlsceneCommand();
381 m_args = QStringList()<<QString(QLatin1String("%0.qml")).arg(ubuntuProject->displayName());397 m_args = QStringList()<<QString(QLatin1String("%0.qml")).arg(ubuntuProject->displayName());
382398
=== modified file 'src/ubuntu/ubuntulocalrunconfigurationfactory.cpp'
--- src/ubuntu/ubuntulocalrunconfigurationfactory.cpp 2014-06-18 07:29:05 +0000
+++ src/ubuntu/ubuntulocalrunconfigurationfactory.cpp 2014-07-23 14:19:54 +0000
@@ -33,50 +33,59 @@
33using namespace Ubuntu;33using namespace Ubuntu;
34using namespace Ubuntu::Internal;34using namespace Ubuntu::Internal;
3535
36QList<Core::Id> UbuntuLocalRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const {36enum {
37 if (!canHandle(parent))37 debug = 1
38 return QList<Core::Id>();38};
3939
40 QList<Core::Id> list;40QList<Core::Id> UbuntuLocalRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const
41{
42 QList<Core::Id> types;
43
44 Core::Id targetDevice = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->kit());
45 if(targetDevice != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE && targetDevice != Ubuntu::Constants::UBUNTU_DEVICE_TYPE_ID) {
46 if(debug) qDebug()<<"Rejecting device type: "<<targetDevice.toString();
47 return types;
48 }
49
50 bool isRemote = targetDevice == Ubuntu::Constants::UBUNTU_DEVICE_TYPE_ID;
51 bool isCMake = parent->project()->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID;
52 bool isHTML = parent->project()->id() == Ubuntu::Constants::UBUNTUPROJECT_ID;
53 bool isApp = UbuntuProjectGuesser::isClickAppProject(parent->project());
54 //bool isQML = parent->target()->project()->id() == "QmlProjectManager.QmlProject";
55
56 if (!isCMake && !isHTML)
57 return types;
58
59 if (isRemote) {
60 //IF we have a remote device we just support a ubuntu toolchain
61 ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(parent->kit());
62 if(tc && tc->type() != QLatin1String(Ubuntu::Constants::UBUNTU_CLICK_TOOLCHAIN_ID))
63 return types;
64 }
4165
42 QString manifestPath = QStringLiteral("%1/manifest.json").arg(parent->project()->projectDirectory());66 QString manifestPath = QStringLiteral("%1/manifest.json").arg(parent->project()->projectDirectory());
43 UbuntuClickManifest manifest;67 UbuntuClickManifest manifest;
4468
45 //if we have no manifest, we can not query the app id's69 //if we have no manifest, we can not query the app id's
46 if(!manifest.load(manifestPath,parent->project()->displayName()))70 if(!manifest.load(manifestPath,parent->displayName()))
47 return list;71 return types;
4872
49 QList<UbuntuClickManifest::Hook> hooks = manifest.hooks();73 QList<UbuntuClickManifest::Hook> hooks = manifest.hooks();
5074 if (!isRemote) {
51
52 bool isDesktopDevice = ProjectExplorer::DeviceKitInformation::deviceId(parent->kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_ID;
53
54 ProjectExplorer::IDevice::ConstPtr devPtr = ProjectExplorer::DeviceKitInformation::device(parent->kit());
55 bool isUbuntuDevice = (devPtr.isNull() == false) && (devPtr->type() == Constants::UBUNTU_DEVICE_TYPE_ID);
56
57 if(parent->project()->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID) {
58
59 bool isScopes = UbuntuProjectGuesser::isScopesProject(parent->project());
60 bool isApp = UbuntuProjectGuesser::isClickAppProject(parent->project());
61
62 //the scopes project has no run on device yet, thats why finding a
63 //scopes project will block creating any runconfigurations for the device
64 if ( isScopes && !isDesktopDevice)
65 return list;
66
67 foreach (const UbuntuClickManifest::Hook &hook, hooks) {75 foreach (const UbuntuClickManifest::Hook &hook, hooks) {
68 if (isUbuntuDevice && isApp) {76 types << Core::Id(Constants::UBUNTUPROJECT_RUNCONTROL_ID).withSuffix(hook.appId);
69 list << UbuntuRemoteRunConfiguration::typeId().withSuffix(hook.appId);77 }
70 } else {78 }
71 list << Core::Id(Constants::UBUNTUPROJECT_RUNCONTROL_ID).withSuffix(hook.appId);79 else if (isRemote) {
80 //when CMake we only support App projects, scopes have no way to be controlled on the device atm
81 if ((isCMake && isApp) || isHTML) {
82 foreach (const UbuntuClickManifest::Hook &hook, hooks) {
83 types << UbuntuRemoteRunConfiguration::typeId().withSuffix(hook.appId);
72 }84 }
73 }85 }
74 } else {
75 foreach (const UbuntuClickManifest::Hook &hook, hooks) {
76 list << Core::Id(Constants::UBUNTUPROJECT_RUNCONTROL_ID).withSuffix(hook.appId);
77 }
78 }86 }
79 return list;87
88 return types;
80}89}
8190
82QString UbuntuLocalRunConfigurationFactory::displayNameForId(const Core::Id id) const91QString UbuntuLocalRunConfigurationFactory::displayNameForId(const Core::Id id) const
@@ -88,40 +97,9 @@
88 return QString();97 return QString();
89}98}
9099
91bool UbuntuLocalRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const {
92
93 if(qobject_cast<CMakeProjectManager::CMakeProject*>(parent->project())) {
94 if (!parent->project()->supportsKit(parent->kit()))
95 return false;
96
97 ProjectExplorer::ToolChain *tc
98 = ProjectExplorer::ToolChainKitInformation::toolChain(parent->kit());
99 if (!tc || tc->targetAbi().os() != ProjectExplorer::Abi::LinuxOS)
100 return false;
101
102 if(tc->type() == QString::fromLatin1(Constants::UBUNTU_CLICK_TOOLCHAIN_ID))
103 return true;
104
105 bool isDesktopDevice = ProjectExplorer::DeviceKitInformation::deviceId(parent->kit()) == ProjectExplorer::Constants::DESKTOP_DEVICE_ID;
106 if(UbuntuProjectGuesser::isScopesProject(parent->project())
107 && isDesktopDevice)
108 return true;
109 else if(isDesktopDevice && UbuntuProjectGuesser::isClickAppProject(parent->project()))
110 return true;
111
112 return false;
113 }
114
115 if (!qobject_cast<UbuntuProject *>(parent->project()))
116 return false;
117 return true;
118}
119
120bool UbuntuLocalRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,100bool UbuntuLocalRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent,
121 const Core::Id id) const {101 const Core::Id id) const
122 if (!canHandle(parent))102{
123 return false;
124
125 return availableCreationIds(parent).contains(id);103 return availableCreationIds(parent).contains(id);
126}104}
127105
@@ -160,7 +138,7 @@
160}138}
161139
162ProjectExplorer::RunConfiguration *UbuntuLocalRunConfigurationFactory::clone(ProjectExplorer::Target *parent,140ProjectExplorer::RunConfiguration *UbuntuLocalRunConfigurationFactory::clone(ProjectExplorer::Target *parent,
163 ProjectExplorer::RunConfiguration *source) {141 ProjectExplorer::RunConfiguration *source) {
164 if (!canClone(parent, source))142 if (!canClone(parent, source))
165 return NULL;143 return NULL;
166144
167145
=== modified file 'src/ubuntu/ubuntupackagestep.cpp'
--- src/ubuntu/ubuntupackagestep.cpp 2014-06-17 11:48:05 +0000
+++ src/ubuntu/ubuntupackagestep.cpp 2014-07-23 14:19:54 +0000
@@ -13,6 +13,7 @@
13#include <projectexplorer/deployconfiguration.h>13#include <projectexplorer/deployconfiguration.h>
14#include <projectexplorer/ioutputparser.h>14#include <projectexplorer/ioutputparser.h>
15#include <utils/qtcprocess.h>15#include <utils/qtcprocess.h>
16#include <cmakeprojectmanager/cmakeprojectconstants.h>
1617
17#include <QDir>18#include <QDir>
18#include <QTimer>19#include <QTimer>
@@ -67,42 +68,117 @@
67{68{
68 m_tasks.clear();69 m_tasks.clear();
6970
70 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();71 QString projectDir = target()->project()->projectDirectory();
71 if (!bc){72 QString deployDir;
72 ProjectExplorer::Task t(ProjectExplorer::Task::Error73 Utils::Environment env = Utils::Environment::systemEnvironment();
73 ,tr("No valid BuildConfiguration set for step: %1").arg(displayName())74 Utils::AbstractMacroExpander *mExp = 0;
74 ,Utils::FileName(),-175
75 ,ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);76 {
76 m_tasks.append(t);77 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
7778 if(bc) {
78 //UbuntuClickPackageStep::run will stop if tasks exist79 m_buildDir = bc->buildDirectory().toString();
79 return true;80 deployDir = bc->buildDirectory().toString()
8081 + QDir::separator()
82 + QString::fromLatin1(Constants::UBUNTU_DEPLOY_DESTDIR);
83 env = bc->environment();
84 mExp = bc->macroExpander();
85 } else {
86 //cmake projects NEED a buildconfiguration
87 if (target()->project()->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID) {
88 ProjectExplorer::Task t(ProjectExplorer::Task::Error
89 ,tr("No valid BuildConfiguration set for step: %1").arg(displayName())
90 ,Utils::FileName(),-1
91 ,ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
92 m_tasks.append(t);
93
94 //UbuntuClickPackageStep::run will stop if tasks exist
95 return true;
96 } else {
97 //backward compatibility, old HTML5 projects did not have a Buildconfiguration
98 //this would crash otherwise
99
100 //ubuntu + qml project types
101 QDir pDir(projectDir);
102 m_buildDir = QDir::cleanPath(target()->project()->projectDirectory()
103 +QDir::separator()+QStringLiteral("..")
104 +QDir::separator()+pDir.dirName()+QStringLiteral("_build"));
105 deployDir = m_buildDir+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR);
106
107 //clean up the old "build"
108 QDir bd(m_buildDir);
109 if(!bd.exists(m_buildDir))
110 bd.mkdir(m_buildDir);
111 }
112 }
81 }113 }
82114
83 //build the make process arguments115 //build the make process arguments
84 {116 {
85 QStringList arguments;117 if (target()->project()->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID) {
86 arguments << QStringLiteral("DESTDIR=%1").arg(QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR))118 QStringList arguments;
87 << QStringLiteral("install");119 arguments << QStringLiteral("DESTDIR=%1").arg(QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR))
88120 << QStringLiteral("install");
89 ProjectExplorer::ProcessParameters* params = &m_MakeParam;121
90 params->setMacroExpander(bc->macroExpander());122 ProjectExplorer::ProcessParameters* params = &m_MakeParam;
91123 params->setMacroExpander(mExp);
92 //setup process parameters124
93 params->setWorkingDirectory(bc->buildDirectory().toString());125 //setup process parameters
94 params->setCommand(126 params->setWorkingDirectory(m_buildDir);
95 makeCommand(ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit()),127 params->setCommand(
96 bc->environment()));128 makeCommand(ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit()),
97 params->setArguments(Utils::QtcProcess::joinArgs(arguments));129 env));
98130 params->setArguments(Utils::QtcProcess::joinArgs(arguments));
99 Utils::Environment env = bc->environment();131
100 // Force output to english for the parsers. Do this here and not in the toolchain's132 Utils::Environment tmpenv = env;
101 // addToEnvironment() to not screw up the users run environment.133 // Force output to english for the parsers. Do this here and not in the toolchain's
102 env.set(QLatin1String("LC_ALL"), QLatin1String("C"));134 // addToEnvironment() to not screw up the users run environment.
103 params->setEnvironment(env);135 tmpenv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
104136 params->setEnvironment(tmpenv);
105 params->resolveAll();137
138 params->resolveAll();
139 } else {
140 //QML and HTML projects are just rsynced for now
141 QStringList arguments;
142 arguments << QStringLiteral("-avh")
143 << QStringLiteral("--delete")
144 << QStringLiteral("--exclude")<<QStringLiteral(".bzr")
145 << QStringLiteral("--exclude")<<QStringLiteral(".git")
146 << QStringLiteral("--exclude")<<QStringLiteral(".hg")
147 << QStringLiteral("--exclude")<<QStringLiteral(".svn")
148 << QStringLiteral("--exclude")<<QStringLiteral("*.qmlproject")
149 << QStringLiteral("--exclude")<<QStringLiteral("*.user")
150 << QStringLiteral("--exclude")<<QStringLiteral("tests")
151 << QStringLiteral("--exclude")<<QStringLiteral("Makefile")
152 << QStringLiteral("--exclude")<<QStringLiteral(".excludes")
153 << QStringLiteral("--exclude")<<QStringLiteral("*.ubuntuhtmlproject");
154
155 QFile excludes (projectDir+QDir::separator()+QStringLiteral(".excludes"));
156 if (excludes.open(QIODevice::ReadOnly)) {
157 while (excludes.canReadLine()) {
158 arguments << QStringLiteral("--exclude") << QString::fromUtf8(excludes.readLine());
159 }
160 excludes.close();
161 }
162
163 arguments << projectDir+QDir::separator()
164 << deployDir;
165
166 ProjectExplorer::ProcessParameters* params = &m_MakeParam;
167 params->setMacroExpander(mExp);
168
169 //setup process parameters
170 params->setWorkingDirectory(m_buildDir);
171 params->setCommand(QStringLiteral("rsync"));
172 params->setArguments(Utils::QtcProcess::joinArgs(arguments));
173
174 Utils::Environment tmpenv = env;
175 // Force output to english for the parsers. Do this here and not in the toolchain's
176 // addToEnvironment() to not screw up the users run environment.
177 tmpenv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
178 params->setEnvironment(tmpenv);
179
180 params->resolveAll();
181 }
106 }182 }
107183
108184
@@ -110,23 +186,21 @@
110 {186 {
111 QStringList arguments;187 QStringList arguments;
112 arguments << QLatin1String("build")188 arguments << QLatin1String("build")
113 << bc->buildDirectory().toString()189 << deployDir;
114 + QDir::separator()
115 + QString::fromLatin1(Constants::UBUNTU_DEPLOY_DESTDIR);
116190
117 ProjectExplorer::ProcessParameters* params = &m_ClickParam;191 ProjectExplorer::ProcessParameters* params = &m_ClickParam;
118 params->setMacroExpander(bc->macroExpander());192 params->setMacroExpander(mExp);
119193
120 //setup process parameters194 //setup process parameters
121 params->setWorkingDirectory(bc->buildDirectory().toString());195 params->setWorkingDirectory(m_buildDir);
122 params->setCommand(QLatin1String("click"));196 params->setCommand(QLatin1String("click"));
123 params->setArguments(Utils::QtcProcess::joinArgs(arguments));197 params->setArguments(Utils::QtcProcess::joinArgs(arguments));
124198
125 Utils::Environment env = bc->environment();199 Utils::Environment tmpEnv = env;
126 // Force output to english for the parsers. Do this here and not in the toolchain's200 // Force output to english for the parsers. Do this here and not in the toolchain's
127 // addToEnvironment() to not screw up the users run environment.201 // addToEnvironment() to not screw up the users run environment.
128 env.set(QLatin1String("LC_ALL"), QLatin1String("C"));202 tmpEnv.set(QLatin1String("LC_ALL"), QLatin1String("C"));
129 params->setEnvironment(env);203 params->setEnvironment(tmpEnv);
130204
131 params->resolveAll();205 params->resolveAll();
132 }206 }
@@ -198,7 +272,7 @@
198{272{
199 if(m_clickPackageName.isEmpty())273 if(m_clickPackageName.isEmpty())
200 return QString();274 return QString();
201 return target()->activeBuildConfiguration()->buildDirectory().toString()275 return m_buildDir
202 + QDir::separator()276 + QDir::separator()
203 + m_clickPackageName;277 + m_clickPackageName;
204}278}
@@ -376,6 +450,11 @@
376{450{
377 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();451 ProjectExplorer::BuildConfiguration *bc = target()->activeBuildConfiguration();
378452
453 if(!bc) {
454 QTimer::singleShot(0,this,SLOT(doNextStep()));
455 return;
456 }
457
379 bool ubuntuDevice = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(bc->target()->kit()) == Constants::UBUNTU_DEVICE_TYPE_ID;458 bool ubuntuDevice = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(bc->target()->kit()) == Constants::UBUNTU_DEVICE_TYPE_ID;
380 bool injectDebugScript = (m_packageMode == EnableDebugScript) ||459 bool injectDebugScript = (m_packageMode == EnableDebugScript) ||
381 (m_packageMode == AutoEnableDebugScript && bc->buildType() == ProjectExplorer::BuildConfiguration::Debug);460 (m_packageMode == AutoEnableDebugScript && bc->buildType() == ProjectExplorer::BuildConfiguration::Debug);
@@ -400,10 +479,10 @@
400479
401 UbuntuClickManifest manifest;480 UbuntuClickManifest manifest;
402 if(!manifest.load(bc->buildDirectory()481 if(!manifest.load(bc->buildDirectory()
403 .appendPath(QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR))482 .appendPath(QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR))
404 .appendPath(QStringLiteral("manifest.json"))483 .appendPath(QStringLiteral("manifest.json"))
405 .toString(),484 .toString(),
406 projectName)) {485 projectName)) {
407486
408 emit addOutput(tr("Could not find the manifest.json file in %1.\nPlease check if it is added to the install targets in your project file")487 emit addOutput(tr("Could not find the manifest.json file in %1.\nPlease check if it is added to the install targets in your project file")
409 .arg(bc->buildDirectory()488 .arg(bc->buildDirectory()
@@ -514,7 +593,7 @@
514593
515 //return to MainLoop to update the progressBar594 //return to MainLoop to update the progressBar
516 QTimer::singleShot(0,this,SLOT(injectDebugHelperStep()));595 QTimer::singleShot(0,this,SLOT(injectDebugHelperStep()));
517 break;596 break;
518 }597 }
519 case PreparePackage: {598 case PreparePackage: {
520 m_futureInterface->setProgressValueAndText(2,tr("Building click package"));599 m_futureInterface->setProgressValueAndText(2,tr("Building click package"));
@@ -533,7 +612,7 @@
533 QRegularExpressionMatch m = exp.match(m_lastLine);612 QRegularExpressionMatch m = exp.match(m_lastLine);
534 if(m.hasMatch()) {613 if(m.hasMatch()) {
535 m_clickPackageName = m.captured(1);614 m_clickPackageName = m.captured(1);
536 emit addOutput(tr("The click package has been created in %1").arg(target()->activeBuildConfiguration()->buildDirectory().toString()) ,615 emit addOutput(tr("The click package has been created in %1").arg(m_buildDir) ,
537 ProjectExplorer::BuildStep::MessageOutput);616 ProjectExplorer::BuildStep::MessageOutput);
538 }617 }
539618
540619
=== modified file 'src/ubuntu/ubuntupackagestep.h'
--- src/ubuntu/ubuntupackagestep.h 2014-06-17 09:25:03 +0000
+++ src/ubuntu/ubuntupackagestep.h 2014-07-23 14:19:54 +0000
@@ -81,6 +81,7 @@
81 State m_state;81 State m_state;
82 QString m_lastLine;82 QString m_lastLine;
83 QString m_clickPackageName;83 QString m_clickPackageName;
84 QString m_buildDir;
84 QList<ProjectExplorer::Task> m_tasks;85 QList<ProjectExplorer::Task> m_tasks;
85 QFutureInterface<bool> *m_futureInterface;86 QFutureInterface<bool> *m_futureInterface;
8687
8788
=== modified file 'src/ubuntu/ubuntupackagingwidget.cpp'
--- src/ubuntu/ubuntupackagingwidget.cpp 2014-07-10 13:20:17 +0000
+++ src/ubuntu/ubuntupackagingwidget.cpp 2014-07-23 14:19:54 +0000
@@ -26,6 +26,7 @@
26#include "ubuntuvalidationresultmodel.h"26#include "ubuntuvalidationresultmodel.h"
27#include "ubuntudevice.h"27#include "ubuntudevice.h"
28#include "ubuntupackagestep.h"28#include "ubuntupackagestep.h"
29#include "ubuntushared.h"
2930
30#include <projectexplorer/projectexplorer.h>31#include <projectexplorer/projectexplorer.h>
31#include <projectexplorer/project.h>32#include <projectexplorer/project.h>
@@ -98,10 +99,9 @@
98 connect(m_validationModel,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(onNewValidationData()));99 connect(m_validationModel,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(onNewValidationData()));
99100
100 connect(UbuntuMenu::instance(),SIGNAL(requestBuildAndInstallProject()),this,SLOT(buildAndInstallPackageRequested()));101 connect(UbuntuMenu::instance(),SIGNAL(requestBuildAndInstallProject()),this,SLOT(buildAndInstallPackageRequested()));
102 connect(ProjectExplorer::SessionManager::instance(),SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),this,SLOT(onStartupProjectChanged()));
101103
102 ui->comboBoxFramework->blockSignals(true);104 updateFrameworkList();
103 ui->comboBoxFramework->addItems(UbuntuClickTool::getSupportedFrameworks());
104 ui->comboBoxFramework->blockSignals(false);
105105
106 m_reviewToolsInstalled = false;106 m_reviewToolsInstalled = false;
107 checkClickReviewerTool();107 checkClickReviewerTool();
@@ -112,7 +112,7 @@
112 autoSave();112 autoSave();
113 delete ui;113 delete ui;
114114
115 clearAdditionalBuildSteps();115 clearPackageBuildList();
116}116}
117117
118QString UbuntuPackagingWidget::createPackageName(const QString &userName, const QString &projectName)118QString UbuntuPackagingWidget::createPackageName(const QString &userName, const QString &projectName)
@@ -185,7 +185,9 @@
185 }185 }
186}186}
187187
188void UbuntuPackagingWidget::onMessage(QString msg) {188void UbuntuPackagingWidget::onMessage(QString msg)
189{
190 if(debug) printToOutputPane(msg);
189 m_reply.append(msg);191 m_reply.append(msg);
190 m_inputParser->addRecievedData(msg);192 m_inputParser->addRecievedData(msg);
191}193}
@@ -280,6 +282,26 @@
280 m_ubuntuProcess.start(QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE)).arg(clickPackage));282 m_ubuntuProcess.start(QString(QLatin1String(Constants::UBUNTUPACKAGINGWIDGET_CLICK_REVIEWER_TOOLS_AGAINST_PACKAGE)).arg(clickPackage));
281}283}
282284
285void UbuntuPackagingWidget::onStartupProjectChanged()
286{
287 ProjectExplorer::Project *currProject = ProjectExplorer::SessionManager::startupProject();
288 if (currProject == m_currentProject.data())
289 return;
290
291 if(m_currentProject)
292 m_currentProject->disconnect(this);
293
294 m_currentProject = currProject;
295 connect(currProject,SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),this,SLOT(onActiveTargetChanged()));
296 onActiveTargetChanged();
297}
298
299void UbuntuPackagingWidget::onActiveTargetChanged()
300{
301 if(this->isVisible())
302 reload();
303}
304
283void UbuntuPackagingWidget::autoSave() {305void UbuntuPackagingWidget::autoSave() {
284 save((ui->tabWidget->currentWidget() == ui->tabSimple));306 save((ui->tabWidget->currentWidget() == ui->tabSimple));
285}307}
@@ -289,6 +311,8 @@
289 ProjectExplorer::Project* startupProject = ProjectExplorer::SessionManager::startupProject();311 ProjectExplorer::Project* startupProject = ProjectExplorer::SessionManager::startupProject();
290312
291 if (startupProject) {313 if (startupProject) {
314 updateFrameworkList();
315
292 m_projectName = startupProject->displayName();316 m_projectName = startupProject->displayName();
293 m_projectDir = startupProject->projectDirectory();317 m_projectDir = startupProject->projectDirectory();
294318
@@ -511,7 +535,12 @@
511535
512 if(debug) qDebug()<<"Setting to "<<bzr->whoami();536 if(debug) qDebug()<<"Setting to "<<bzr->whoami();
513 } else if (i.key() == QStringLiteral("framework")) {537 } else if (i.key() == QStringLiteral("framework")) {
514 targetObject.insert(i.key(),UbuntuClickTool::getMostRecentFramework( QString() ));538 const UbuntuClickTool::Target *t = 0;
539 ProjectExplorer::Project *p = ProjectExplorer::SessionManager::startupProject();
540 if (p)
541 t = UbuntuClickTool::clickTargetFromTarget(p->activeTarget());
542
543 targetObject.insert(i.key(),UbuntuClickTool::getMostRecentFramework( QString(), t));
515 } else {544 } else {
516 targetObject.insert(i.key(),i.value());545 targetObject.insert(i.key(),i.value());
517546
@@ -597,6 +626,7 @@
597 ui->lineEdit_version->setText(m_manifest.version());626 ui->lineEdit_version->setText(m_manifest.version());
598 ui->lineEdit_description->setText(m_manifest.description());627 ui->lineEdit_description->setText(m_manifest.description());
599628
629 updateFrameworkList();
600 int idx = ui->comboBoxFramework->findText(m_manifest.frameworkName());630 int idx = ui->comboBoxFramework->findText(m_manifest.frameworkName());
601631
602 //disable the currentIndexChanged signal, reloading the files632 //disable the currentIndexChanged signal, reloading the files
@@ -668,7 +698,9 @@
668 if(!project)698 if(!project)
669 return;699 return;
670700
671 if(project->projectManager()->mimeType() == QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)) {701 QString mimeType = project->projectManager()->mimeType();
702 if(mimeType == QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)
703 || mimeType == QLatin1String(Ubuntu::Constants::UBUNTUPROJECT_MIMETYPE) ) {
672 if(m_reviewToolsInstalled)704 if(m_reviewToolsInstalled)
673 m_postPackageTask = Verify;705 m_postPackageTask = Verify;
674 else706 else
@@ -699,13 +731,13 @@
699{731{
700 disconnect(m_buildManagerConnection);732 disconnect(m_buildManagerConnection);
701 if (success) {733 if (success) {
702 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(m_additionalPackagingBuildSteps.last());734 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(m_packageBuildSteps->steps().last());
703 if (pckStep && !pckStep->packagePath().isEmpty()) {735 if (pckStep && !pckStep->packagePath().isEmpty()) {
704 m_ubuntuProcess.stop();736 m_ubuntuProcess.stop();
705737
706 QString sClickPackagePath = pckStep->packagePath();738 QString sClickPackagePath = pckStep->packagePath();
707 if (sClickPackagePath.isEmpty()) {739 if (sClickPackagePath.isEmpty()) {
708 clearAdditionalBuildSteps();740 clearPackageBuildList();
709 return;741 return;
710 }742 }
711743
@@ -744,7 +776,7 @@
744 }776 }
745 }777 }
746 }778 }
747 clearAdditionalBuildSteps();779 clearPackageBuildList();
748}780}
749781
750void UbuntuPackagingWidget::buildAndInstallPackageRequested()782void UbuntuPackagingWidget::buildAndInstallPackageRequested()
@@ -769,7 +801,11 @@
769 if(!project)801 if(!project)
770 return;802 return;
771803
772 if(project->projectManager()->mimeType() == QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE)) {804 QString mimeType = project->projectManager()->mimeType();
805 bool isCMake = mimeType == QLatin1String(CMakeProjectManager::Constants::CMAKEMIMETYPE);
806 bool isHtml = mimeType == QLatin1String(Ubuntu::Constants::UBUNTUPROJECT_MIMETYPE);
807
808 if(isCMake || isHtml) {
773 ProjectExplorer::Target* target = project->activeTarget();809 ProjectExplorer::Target* target = project->activeTarget();
774 if(!target)810 if(!target)
775 return;811 return;
@@ -783,9 +819,16 @@
783 return;819 return;
784 }820 }
785821
822 if(ProjectExplorer::BuildManager::isBuilding()) {
823 QMessageBox::information(this,tr("Build running"),tr("There is currently a build running, please wait for it to be finished"));
824 return;
825 }
826
786 ProjectExplorer::BuildConfiguration* bc = target->activeBuildConfiguration();827 ProjectExplorer::BuildConfiguration* bc = target->activeBuildConfiguration();
787 if(!bc)828 if(!bc) {
829 QMessageBox::information(this,tr("Error"),tr("Please add a valid buildconfiguration to your project"));
788 return;830 return;
831 }
789832
790 if(!bc->isEnabled()) {833 if(!bc->isEnabled()) {
791 QString disabledReason = bc->disabledReason();834 QString disabledReason = bc->disabledReason();
@@ -793,27 +836,22 @@
793 return;836 return;
794 }837 }
795838
796 if(ProjectExplorer::BuildManager::isBuilding()) {839 clearPackageBuildList();
797 QMessageBox::information(this,tr("Build running"),tr("There is currently a build running, please wait for it to be finished"));840
798 return;841 m_packageBuildSteps = QSharedPointer<ProjectExplorer::BuildStepList> (new ProjectExplorer::BuildStepList(bc,ProjectExplorer::Constants::BUILDSTEPS_BUILD));
842 if (isCMake) {
843 //add the normal buildsteps
844 m_packageBuildSteps->cloneSteps(bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD)));
799 }845 }
800846
801 clearAdditionalBuildSteps();847 //append the click packaging step
802848 UbuntuPackageStep* package = new UbuntuPackageStep(m_packageBuildSteps.data());
803 ProjectExplorer::BuildStepList* steps = bc->stepList(Core::Id(ProjectExplorer::Constants::BUILDSTEPS_BUILD));
804 if(!steps || steps->isEmpty())
805 return;
806
807 UbuntuPackageStep* package = new UbuntuPackageStep(steps);
808 package->setPackageMode(UbuntuPackageStep::DisableDebugScript);849 package->setPackageMode(UbuntuPackageStep::DisableDebugScript);
809850 m_packageBuildSteps->appendStep(package);
810 m_additionalPackagingBuildSteps.append(package);
811851
812 m_buildManagerConnection = connect(ProjectExplorer::BuildManager::instance(),SIGNAL(buildQueueFinished(bool)),this,SLOT(buildFinished(bool)));852 m_buildManagerConnection = connect(ProjectExplorer::BuildManager::instance(),SIGNAL(buildQueueFinished(bool)),this,SLOT(buildFinished(bool)));
813853
814 ProjectExplorer::BuildManager::buildList(steps,tr("Build Project"));854 ProjectExplorer::BuildManager::buildList(m_packageBuildSteps.data(),tr("Build Project"));
815 ProjectExplorer::BuildManager::appendStep(package ,tr("Creating Click package"));
816
817 }855 }
818}856}
819857
@@ -823,14 +861,27 @@
823 * \note This will cancel a current build if its building the ProjectConfiguration861 * \note This will cancel a current build if its building the ProjectConfiguration
824 * the BuildSteps belong to!862 * the BuildSteps belong to!
825 */863 */
826void UbuntuPackagingWidget::clearAdditionalBuildSteps()864void UbuntuPackagingWidget::clearPackageBuildList()
827{865{
828 foreach(QPointer<ProjectExplorer::BuildStep> step,m_additionalPackagingBuildSteps) {866 if (!m_packageBuildSteps)
829 if(step) {867 return;
830 if(ProjectExplorer::BuildManager::isBuilding(step->projectConfiguration()))868
831 ProjectExplorer::BuildManager::cancel();869 if(ProjectExplorer::BuildManager::isBuilding( static_cast<ProjectExplorer::ProjectConfiguration *>(m_packageBuildSteps->parent())))
832 delete step.data();870 ProjectExplorer::BuildManager::cancel();
833 }871
834 }872 m_packageBuildSteps->deleteLater();
835 m_additionalPackagingBuildSteps.clear();873 m_packageBuildSteps.clear();
874}
875
876void UbuntuPackagingWidget::updateFrameworkList()
877{
878 const UbuntuClickTool::Target *t = 0;
879 ProjectExplorer::Project* startupProject = ProjectExplorer::SessionManager::startupProject();
880 if (startupProject)
881 t = UbuntuClickTool::clickTargetFromTarget(startupProject->activeTarget());
882
883 ui->comboBoxFramework->blockSignals(true);
884 ui->comboBoxFramework->clear();
885 ui->comboBoxFramework->addItems(UbuntuClickTool::getSupportedFrameworks(t));
886 ui->comboBoxFramework->blockSignals(false);
836}887}
837888
=== modified file 'src/ubuntu/ubuntupackagingwidget.h'
--- src/ubuntu/ubuntupackagingwidget.h 2014-07-10 13:20:17 +0000
+++ src/ubuntu/ubuntupackagingwidget.h 2014-07-23 14:19:54 +0000
@@ -85,6 +85,8 @@
85 void on_pushButton_addpolicy_clicked();85 void on_pushButton_addpolicy_clicked();
86 void on_pushButtonClickPackage_clicked();86 void on_pushButtonClickPackage_clicked();
87 void on_pushButtonReviewersTools_clicked();87 void on_pushButtonReviewersTools_clicked();
88 void onStartupProjectChanged ();
89 void onActiveTargetChanged ();
8890
89 void on_pushButtonReload_clicked();91 void on_pushButtonReload_clicked();
9092
@@ -110,7 +112,8 @@
110112
111private:113private:
112 void buildClickPackage ();114 void buildClickPackage ();
113 void clearAdditionalBuildSteps ();115 void clearPackageBuildList ();
116 void updateFrameworkList ();
114117
115private:118private:
116 bool m_reviewToolsInstalled;119 bool m_reviewToolsInstalled;
@@ -130,8 +133,12 @@
130 ClickRunChecksParser* m_inputParser;133 ClickRunChecksParser* m_inputParser;
131134
132 //packaging support with buildsteps135 //packaging support with buildsteps
133 QList<QPointer<ProjectExplorer::BuildStep> > m_additionalPackagingBuildSteps;136 QSharedPointer<ProjectExplorer::BuildStepList> m_packageBuildSteps;
134 QMetaObject::Connection m_buildManagerConnection;137 QMetaObject::Connection m_buildManagerConnection;
135 ClickPackageTask m_postPackageTask;138 ClickPackageTask m_postPackageTask;
139
140 //current used startup project and target
141 QPointer<ProjectExplorer::Project> m_currentProject;
142 QPointer<ProjectExplorer::Target> m_currentTarget;
136};143};
137#endif // UBUNTUPACKAGINGWIDGET_H144#endif // UBUNTUPACKAGINGWIDGET_H
138145
=== modified file 'src/ubuntu/ubuntuplugin.cpp'
--- src/ubuntu/ubuntuplugin.cpp 2014-07-07 06:33:37 +0000
+++ src/ubuntu/ubuntuplugin.cpp 2014-07-23 14:19:54 +0000
@@ -29,12 +29,13 @@
29#include "ubuntudevicefactory.h"29#include "ubuntudevicefactory.h"
30#include "clicktoolchain.h"30#include "clicktoolchain.h"
31#include "ubuntucmakebuildconfiguration.h"31#include "ubuntucmakebuildconfiguration.h"
32#include "ubuntuhtmlbuildconfiguration.h"
32#include "ubunturemotedeployconfiguration.h"33#include "ubunturemotedeployconfiguration.h"
33#include "ubuntulocaldeployconfiguration.h"34#include "ubuntulocaldeployconfiguration.h"
34#include "ubuntudevicesmodel.h"35#include "ubuntudevicesmodel.h"
35#include "localportsmanager.h"36#include "localportsmanager.h"
36#include "ubuntubzr.h"37#include "ubuntubzr.h"
3738#include "ubuntudeploystepfactory.h"
38#include <coreplugin/modemanager.h>39#include <coreplugin/modemanager.h>
39#include <projectexplorer/kitmanager.h>40#include <projectexplorer/kitmanager.h>
40#include <coreplugin/featureprovider.h>41#include <coreplugin/featureprovider.h>
@@ -134,6 +135,7 @@
134 addAutoReleasedObject(new UbuntuCMakeToolFactory);135 addAutoReleasedObject(new UbuntuCMakeToolFactory);
135 addAutoReleasedObject(new UbuntuCMakeMakeStepFactory);136 addAutoReleasedObject(new UbuntuCMakeMakeStepFactory);
136 addAutoReleasedObject(new UbuntuCMakeBuildConfigurationFactory);137 addAutoReleasedObject(new UbuntuCMakeBuildConfigurationFactory);
138 addAutoReleasedObject(new UbuntuHtmlBuildConfigurationFactory);
137139
138 //ubuntu device support140 //ubuntu device support
139 addAutoReleasedObject(new UbuntuDeviceFactory);141 addAutoReleasedObject(new UbuntuDeviceFactory);
@@ -148,8 +150,12 @@
148 QStringLiteral("ubuntu-project-cmake"),150 QStringLiteral("ubuntu-project-cmake"),
149 Core::IWizard::ProjectWizard));151 Core::IWizard::ProjectWizard));
150 addAutoReleasedObject(152 addAutoReleasedObject(
151 new UbuntuWizardFactory<UbuntuProjectApplicationWizard,UbuntuProjectApplicationWizard::UbuntuProject>(153 new UbuntuWizardFactory<UbuntuProjectApplicationWizard,UbuntuProjectApplicationWizard::UbuntuHTMLProject>(
152 QStringLiteral("ubuntu-project-plain"),154 QStringLiteral("ubuntu-project-plain-html"),
155 Core::IWizard::ProjectWizard));
156 addAutoReleasedObject(
157 new UbuntuWizardFactory<UbuntuProjectApplicationWizard,UbuntuProjectApplicationWizard::UbuntuQMLProject>(
158 QStringLiteral("ubuntu-project-plain-qml"),
153 Core::IWizard::ProjectWizard));159 Core::IWizard::ProjectWizard));
154 addAutoReleasedObject(160 addAutoReleasedObject(
155 new UbuntuWizardFactory<UbuntuProjectApplicationWizard,UbuntuProjectApplicationWizard::GoProject>(161 new UbuntuWizardFactory<UbuntuProjectApplicationWizard,UbuntuProjectApplicationWizard::GoProject>(
156162
=== modified file 'src/ubuntu/ubuntuproject.cpp'
--- src/ubuntu/ubuntuproject.cpp 2014-07-03 13:03:47 +0000
+++ src/ubuntu/ubuntuproject.cpp 2014-07-23 14:19:54 +0000
@@ -20,7 +20,11 @@
20#include <coreplugin/modemanager.h>20#include <coreplugin/modemanager.h>
21#include <projectexplorer/projectexplorerconstants.h>21#include <projectexplorer/projectexplorerconstants.h>
22#include <projectexplorer/kitinformation.h>22#include <projectexplorer/kitinformation.h>
23#include <projectexplorer/toolchain.h>
24#include <projectexplorer/projectmacroexpander.h>
23#include <qmljs/qmljssimplereader.h>25#include <qmljs/qmljssimplereader.h>
26#include <qtsupport/qtkitinformation.h>
27#include <qtsupport/qtsupportconstants.h>
2428
2529
26using namespace Ubuntu;30using namespace Ubuntu;
@@ -44,19 +48,6 @@
44 m_rootNode = QSharedPointer<UbuntuProjectNode>(new UbuntuProjectNode(this, m_file.data()));48 m_rootNode = QSharedPointer<UbuntuProjectNode>(new UbuntuProjectNode(this, m_file.data()));
45 m_manager->registerProject(this);49 m_manager->registerProject(this);
4650
47 QList<ProjectExplorer::Kit *> kits = ProjectExplorer::KitManager::kits();
48 foreach (ProjectExplorer::Kit *kit, kits) {
49 //do not spawn invalid configurations
50 if(ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) != ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
51 continue;
52
53 addTarget(createTarget(kit));
54 }
55
56 if (needsConfiguration()) {
57 Core::ModeManager::activateMode(ProjectExplorer::Constants::MODE_SESSION);
58 }
59
60 extractProjectFileData(fileName);51 extractProjectFileData(fileName);
61}52}
6253
@@ -119,3 +110,66 @@
119 enumChild(projectDir(), files);110 enumChild(projectDir(), files);
120 return files;111 return files;
121}112}
113
114bool UbuntuProject::supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const
115{
116 UbuntuKitMatcher matcher;
117 if (!matcher.matches(k)) {
118 if(errorMessage)
119 *errorMessage = tr("Only Desktop and Ubuntu Kits are supported");
120 return false;
121 }
122
123 return true;
124}
125
126bool UbuntuProject::needsConfiguration() const
127{
128 return targets().size() == 0;
129}
130
131bool UbuntuProject::supportsNoTargetPanel() const
132{
133 return true;
134}
135
136ProjectExplorer::KitMatcher *UbuntuProject::createRequiredKitMatcher() const
137{
138 return new UbuntuKitMatcher();
139}
140
141ProjectExplorer::KitMatcher *UbuntuProject::createPreferredKitMatcher() const
142{
143 return new QtSupport::QtVersionKitMatcher(Core::FeatureSet(QtSupport::Constants::FEATURE_DESKTOP));
144}
145
146QString UbuntuProject::shadowBuildDirectory(const QString &proFilePath, const ProjectExplorer::Kit *k, const QString &suffix)
147{
148 if (proFilePath.isEmpty())
149 return QString();
150
151 QFileInfo info(proFilePath);
152
153 QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
154 if (version && !version->supportsShadowBuilds())
155 return info.absolutePath();
156
157 const QString projectName = QFileInfo(proFilePath).completeBaseName();
158 ProjectExplorer::ProjectMacroExpander expander(proFilePath, projectName, k, suffix);
159 QDir projectDir = QDir(projectDirectory(proFilePath));
160 QString buildPath = Utils::expandMacros(Core::DocumentManager::buildDirectory(), &expander);
161 return QDir::cleanPath(projectDir.absoluteFilePath(buildPath));
162}
163
164
165bool UbuntuKitMatcher::matches(const ProjectExplorer::Kit *k) const
166{
167 ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
168 if (tc->type() == QLatin1String(Ubuntu::Constants::UBUNTU_CLICK_TOOLCHAIN_ID))
169 return true;
170
171 if (ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(k) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
172 return true;
173
174 return false;
175}
122176
=== modified file 'src/ubuntu/ubuntuproject.h'
--- src/ubuntu/ubuntuproject.h 2014-06-03 12:04:26 +0000
+++ src/ubuntu/ubuntuproject.h 2014-07-23 14:19:54 +0000
@@ -50,6 +50,14 @@
50class UbuntuProjectManager;50class UbuntuProjectManager;
51class UbuntuProjectFile;51class UbuntuProjectFile;
52class UbuntuProjectNode;52class UbuntuProjectNode;
53
54class UbuntuKitMatcher : public ProjectExplorer::KitMatcher
55{
56public:
57 explicit UbuntuKitMatcher() { }
58 bool matches(const ProjectExplorer::Kit *k) const override;
59};
60
53class UbuntuProject : public ProjectExplorer::Project61class UbuntuProject : public ProjectExplorer::Project
54{62{
55 Q_OBJECT63 Q_OBJECT
@@ -76,6 +84,14 @@
76 return m_mainFile;84 return m_mainFile;
77 }85 }
7886
87 // Project interface
88 virtual bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage) const override;
89 virtual bool needsConfiguration() const override;
90 virtual bool supportsNoTargetPanel() const override;
91 virtual ProjectExplorer::KitMatcher *createRequiredKitMatcher() const override;
92 virtual ProjectExplorer::KitMatcher *createPreferredKitMatcher() const override;
93
94 static QString shadowBuildDirectory(const QString &proFilePath, const ProjectExplorer::Kit *k, const QString &suffix = QString());
79private:95private:
80 void extractProjectFileData(const QString& filename);96 void extractProjectFileData(const QString& filename);
8197
@@ -86,7 +102,6 @@
86102
87 QString m_fileName;103 QString m_fileName;
88 QSharedPointer<UbuntuProjectNode> m_rootNode;104 QSharedPointer<UbuntuProjectNode> m_rootNode;
89
90};105};
91}106}
92}107}
93108
=== modified file 'src/ubuntu/ubuntuprojectapplicationwizard.cpp'
--- src/ubuntu/ubuntuprojectapplicationwizard.cpp 2014-07-10 13:20:17 +0000
+++ src/ubuntu/ubuntuprojectapplicationwizard.cpp 2014-07-23 14:19:54 +0000
@@ -32,6 +32,9 @@
32#include <extensionsystem/pluginmanager.h>32#include <extensionsystem/pluginmanager.h>
33#include <cmakeprojectmanager/cmakekitinformation.h>33#include <cmakeprojectmanager/cmakekitinformation.h>
3434
35#include <projectexplorer/kitinformation.h>
36#include <projectexplorer/toolchain.h>
37
35#include <QDir>38#include <QDir>
3639
3740
@@ -41,6 +44,7 @@
41 debug = 044 debug = 0
42};45};
4346
47
44UbuntuProjectApplicationWizard::UbuntuProjectApplicationWizard(ProjectType type)48UbuntuProjectApplicationWizard::UbuntuProjectApplicationWizard(ProjectType type)
45 : m_type(type)49 : m_type(type)
46{50{
@@ -167,7 +171,7 @@
167void UbuntuProjectApplicationWizardDialog::addTargetSetupPage(int id)171void UbuntuProjectApplicationWizardDialog::addTargetSetupPage(int id)
168{172{
169 //no target setup page required for basic projects173 //no target setup page required for basic projects
170 if(m_type == UbuntuProjectApplicationWizard::UbuntuProject)174 if(m_type == UbuntuProjectApplicationWizard::UbuntuQMLProject)
171 return;175 return;
172176
173 m_targetSetupPage = new ProjectExplorer::TargetSetupPage;177 m_targetSetupPage = new ProjectExplorer::TargetSetupPage;
@@ -207,6 +211,10 @@
207 m_targetSetupPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(features));211 m_targetSetupPage->setRequiredKitMatcher(new QtSupport::QtVersionKitMatcher(features));
208 break;212 break;
209 }213 }
214 case UbuntuProjectApplicationWizard::UbuntuHTMLProject: {
215 m_targetSetupPage->setRequiredKitMatcher(new UbuntuKitMatcher());
216 break;
217 }
210 default:218 default:
211 break;219 break;
212 }220 }
@@ -237,6 +245,11 @@
237 +projectName245 +projectName
238 +QDir::separator()246 +QDir::separator()
239 +QString::fromLatin1("%1.goproject").arg(projectName));247 +QString::fromLatin1("%1.goproject").arg(projectName));
248 } else if (m_type == UbuntuProjectApplicationWizard::UbuntuHTMLProject) {
249 m_targetSetupPage->setProjectPath(path+QDir::separator()
250 +projectName
251 +QDir::separator()
252 +QString::fromLatin1("%1.ubuntuhtmlproject").arg(projectName));
240 } else {253 } else {
241 m_targetSetupPage->setProjectPath(path+QDir::separator()+projectName+QDir::separator()+QLatin1String("CMakeLists.txt"));254 m_targetSetupPage->setProjectPath(path+QDir::separator()+projectName+QDir::separator()+QLatin1String("CMakeLists.txt"));
242 }255 }
243256
=== modified file 'src/ubuntu/ubuntuprojectapplicationwizard.h'
--- src/ubuntu/ubuntuprojectapplicationwizard.h 2014-06-30 15:20:18 +0000
+++ src/ubuntu/ubuntuprojectapplicationwizard.h 2014-07-23 14:19:54 +0000
@@ -41,7 +41,8 @@
41public:41public:
4242
43 enum ProjectType{43 enum ProjectType{
44 UbuntuProject, //handles Qml, Html basic projects44 UbuntuHTMLProject,
45 UbuntuQMLProject,
45 CMakeProject,46 CMakeProject,
46 GoProject47 GoProject
47 };48 };
4849
=== modified file 'src/ubuntu/ubunturemotedeployconfiguration.cpp'
--- src/ubuntu/ubunturemotedeployconfiguration.cpp 2014-06-17 11:53:03 +0000
+++ src/ubuntu/ubunturemotedeployconfiguration.cpp 2014-07-23 14:19:54 +0000
@@ -18,8 +18,9 @@
18#include "ubunturemotedeployconfiguration.h"18#include "ubunturemotedeployconfiguration.h"
19#include "ubuntucmakebuildconfiguration.h"19#include "ubuntucmakebuildconfiguration.h"
20#include "ubuntucmakemakestep.h"20#include "ubuntucmakemakestep.h"
21#include "ubuntudirectuploadstep.h"
22#include "ubuntuprojectguesser.h"
21#include "ubuntuconstants.h"23#include "ubuntuconstants.h"
22#include "ubuntuprojectguesser.h"
23#include "ubuntupackagestep.h"24#include "ubuntupackagestep.h"
2425
25#include <utils/qtcassert.h>26#include <utils/qtcassert.h>
@@ -31,13 +32,10 @@
31#include <projectexplorer/kitinformation.h>32#include <projectexplorer/kitinformation.h>
32#include <projectexplorer/abi.h>33#include <projectexplorer/abi.h>
33#include <projectexplorer/buildstep.h>34#include <projectexplorer/buildstep.h>
34#include <projectexplorer/deployablefile.h>35
3536#include <cmakeprojectmanager/cmakeprojectconstants.h>
36#include <remotelinux/remotelinuxdeployconfiguration.h>37
37#include <remotelinux/remotelinuxcheckforfreediskspacestep.h>38#include <remotelinux/remotelinuxcheckforfreediskspacestep.h>
38#include <remotelinux/genericdirectuploadservice.h>
39
40#include <cmakeprojectmanager/cmakeprojectconstants.h>
4139
42#include <QDir>40#include <QDir>
4341
@@ -65,148 +63,6 @@
65 return new ProjectExplorer::NamedWidget();63 return new ProjectExplorer::NamedWidget();
66}64}
6765
68UbuntuDirectUploadStep::UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl)
69 : AbstractRemoteLinuxDeployStep(bsl, UbuntuDirectUploadStep::stepId())
70 , m_deployService(new RemoteLinux::GenericDirectUploadService(this))
71{
72 setDefaultDisplayName(displayName());
73}
74
75UbuntuDirectUploadStep::UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl, UbuntuDirectUploadStep *other)
76 : AbstractRemoteLinuxDeployStep(bsl, other)
77 , m_deployService(new RemoteLinux::GenericDirectUploadService(this))
78{
79 setDefaultDisplayName(displayName());
80
81 connect(target()->project(),SIGNAL(displayNameChanged()),this,SLOT(projectNameChanged()));
82 connect(target(),SIGNAL(applicationTargetsChanged()),this,SLOT(projectNameChanged()));
83}
84
85UbuntuDirectUploadStep::~UbuntuDirectUploadStep()
86{
87}
88
89void UbuntuDirectUploadStep::run(QFutureInterface<bool> &fi)
90{
91 m_foundClickPackage = false;
92 projectNameChanged();
93 if(!m_foundClickPackage) {
94 emit addOutput(tr("Deploy step failed. No click package was created"), ErrorMessageOutput);
95 fi.reportResult(false);
96 emit finished();
97 return;
98 }
99
100
101 m_deployService->setIncrementalDeployment(false);
102 m_deployService->setIgnoreMissingFiles(false);
103
104 QString whyNot;
105 if(!deployService()->isDeploymentPossible(&whyNot)) {
106 emit addOutput(tr("Deploy step failed. %1").arg(whyNot), ErrorMessageOutput);
107 fi.reportResult(false);
108 emit finished();
109 return;
110 }
111
112 AbstractRemoteLinuxDeployStep::run(fi);
113}
114
115ProjectExplorer::BuildStepConfigWidget *UbuntuDirectUploadStep::createConfigWidget()
116{
117 return new ProjectExplorer::SimpleBuildStepConfigWidget(this);
118}
119
120bool UbuntuDirectUploadStep::initInternal(QString *error)
121{
122 Q_UNUSED(error)
123 return true;
124}
125
126RemoteLinux::AbstractRemoteLinuxDeployService *UbuntuDirectUploadStep::deployService() const
127{
128 return m_deployService;
129}
130
131bool UbuntuDirectUploadStep::fromMap(const QVariantMap &map)
132{
133 if (!AbstractRemoteLinuxDeployStep::fromMap(map))
134 return false;
135 return true;
136}
137
138QVariantMap UbuntuDirectUploadStep::toMap() const
139{
140 return AbstractRemoteLinuxDeployStep::toMap();
141}
142
143
144Core::Id UbuntuDirectUploadStep::stepId()
145{
146 return Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID;
147}
148
149QString UbuntuDirectUploadStep::displayName()
150{
151 return tr("Upload files to Ubuntu Device");
152}
153
154static void createFileList(const QDir &rootDir
155 , const QString& subDir
156 , const QString& remoteRoot
157 , QList<ProjectExplorer::DeployableFile>* list)
158{
159 QDir currentDir(rootDir.absolutePath()+subDir);
160 if(!currentDir.exists())
161 return;
162
163 QFileInfoList entries = currentDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
164 foreach (const QFileInfo &entry, entries) {
165 if(entry.isDir()) {
166 QString newSub = (subDir.endsWith(QLatin1String("/"))) ? (QString)(subDir+entry.fileName()) : (QString)(subDir+(QLatin1String("/")+entry.fileName()));
167 createFileList(rootDir,newSub,remoteRoot,list);
168 } else {
169 QString targetPath = QDir::cleanPath(remoteRoot
170 + subDir
171 + QLatin1String("/"));
172
173 if(debug) qDebug()<<"Uploading: "<<entry.fileName();
174 if(debug) qDebug()<<" to "<<targetPath;
175 list->append(ProjectExplorer::DeployableFile(entry.absoluteFilePath()
176 , targetPath
177 , entry.isExecutable() ? ProjectExplorer::DeployableFile::TypeExecutable
178 : ProjectExplorer::DeployableFile::TypeNormal));
179 }
180 }
181}
182
183void UbuntuDirectUploadStep::projectNameChanged()
184{
185 if(debug) qDebug()<<"------------------------ Updating DEPLOYLIST ---------------------------";
186 //iterate over the .deploy dir and put all files in the list
187 QDir d(target()->activeBuildConfiguration()->buildDirectory().toString()+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR));
188 ProjectExplorer::BuildStepList *bsList = deployConfiguration()->stepList();
189
190 QList<ProjectExplorer::DeployableFile> list;
191 foreach(ProjectExplorer::BuildStep *currStep ,bsList->steps()) {
192 UbuntuPackageStep *pckStep = qobject_cast<UbuntuPackageStep*>(currStep);
193 if(!pckStep)
194 continue;
195
196 QFileInfo info(pckStep->packagePath());
197 if(info.exists()) {
198 list.append(ProjectExplorer::DeployableFile(info.filePath(),
199 QStringLiteral("/tmp")));
200
201 list.append(ProjectExplorer::DeployableFile(QStringLiteral("%1/qtc_device_applaunch.py").arg(Constants::UBUNTU_SCRIPTPATH),
202 QStringLiteral("/tmp")));
203 m_deployService->setDeployableFiles(list);
204 m_foundClickPackage = true;
205 break;
206 }
207 }
208}
209
21066
211UbuntuRemoteDeployConfigurationFactory::UbuntuRemoteDeployConfigurationFactory(QObject *parent)67UbuntuRemoteDeployConfigurationFactory::UbuntuRemoteDeployConfigurationFactory(QObject *parent)
212 : DeployConfigurationFactory(parent)68 : DeployConfigurationFactory(parent)
@@ -225,8 +81,11 @@
225 if (!tc || tc->targetAbi().os() != ProjectExplorer::Abi::LinuxOS)81 if (!tc || tc->targetAbi().os() != ProjectExplorer::Abi::LinuxOS)
226 return ids;82 return ids;
22783
228 //for now only support cmake projects84 Core::Id projectTypeId = parent->project()->id();
229 if(parent->project()->id() != CMakeProjectManager::Constants::CMAKEPROJECT_ID)85
86 //for now only support cmake and ubuntu projects
87 if(projectTypeId != CMakeProjectManager::Constants::CMAKEPROJECT_ID
88 && projectTypeId != Ubuntu::Constants::UBUNTUPROJECT_ID)
230 return ids;89 return ids;
23190
232 const Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->kit());91 const Core::Id devType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(parent->kit());
@@ -257,10 +116,9 @@
257 = new UbuntuRemoteDeployConfiguration(parent);116 = new UbuntuRemoteDeployConfiguration(parent);
258117
259 int step = 0;118 int step = 0;
260 if(parent->project()->id() == Core::Id(CMakeProjectManager::Constants::CMAKEPROJECT_ID)){119
261 UbuntuPackageStep *pckStep = new UbuntuPackageStep(dc->stepList());120 UbuntuPackageStep *pckStep = new UbuntuPackageStep(dc->stepList());
262 dc->stepList()->insertStep(0,pckStep);121 dc->stepList()->insertStep(0,pckStep);
263 }
264122
265 RemoteLinux::RemoteLinuxCheckForFreeDiskSpaceStep *checkSpace = new RemoteLinux::RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList());123 RemoteLinux::RemoteLinuxCheckForFreeDiskSpaceStep *checkSpace = new RemoteLinux::RemoteLinuxCheckForFreeDiskSpaceStep(dc->stepList());
266 checkSpace->setPathToCheck(QStringLiteral("/tmp"));124 checkSpace->setPathToCheck(QStringLiteral("/tmp"));
@@ -301,90 +159,5 @@
301 ,qobject_cast<RemoteLinux::RemoteLinuxDeployConfiguration *>(product));159 ,qobject_cast<RemoteLinux::RemoteLinuxDeployConfiguration *>(product));
302}160}
303161
304QList<Core::Id> UbuntuDeployStepFactory::availableCreationIds(ProjectExplorer::BuildStepList *parent) const
305{
306 if(!canHandle(parent->target()))
307 return QList<Core::Id>();
308
309 return QList<Core::Id>()
310 <<Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID;
311}
312
313QString UbuntuDeployStepFactory::displayNameForId(const Core::Id id) const
314{
315 if(id == Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID)
316 return UbuntuDirectUploadStep::displayName();
317 return QString();
318}
319
320bool UbuntuDeployStepFactory::canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const
321{
322 if(!canHandle(parent->target()))
323 return false;
324
325 return availableCreationIds(parent).contains(id);
326}
327
328ProjectExplorer::BuildStep *UbuntuDeployStepFactory::create(ProjectExplorer::BuildStepList *parent, const Core::Id id)
329{
330 if (!canCreate(parent, id))
331 return 0;
332
333 if(id == Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID)
334 return new UbuntuDirectUploadStep(parent);
335 return 0;
336}
337
338bool UbuntuDeployStepFactory::canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const
339{
340 return canCreate(parent,ProjectExplorer::idFromMap(map));
341}
342
343ProjectExplorer::BuildStep *UbuntuDeployStepFactory::restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map)
344{
345 Core::Id id = ProjectExplorer::idFromMap(map);
346 if(!canCreate(parent,id))
347 return 0;
348
349 ProjectExplorer::BuildStep* step = create(parent,id);
350 if (!step->fromMap(map)) {
351 delete step;
352 return 0;
353 }
354
355 return step;
356}
357
358bool UbuntuDeployStepFactory::canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const
359{
360 return canCreate(parent,product->id());
361}
362
363ProjectExplorer::BuildStep *UbuntuDeployStepFactory::clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product)
364{
365 if (!canClone(parent, product))
366 return 0;
367
368 const Core::Id id = product->id();
369 if(id == Constants::UBUNTU_DEPLOY_UPLOADSTEP_ID)
370 return new UbuntuDirectUploadStep(parent, static_cast<UbuntuDirectUploadStep *>(product));
371
372 return 0;
373}
374
375bool UbuntuDeployStepFactory::canHandle(const ProjectExplorer::Target *t) const
376{
377 QTC_ASSERT(t, return false);
378 if (!t->project()->supportsKit(t->kit()))
379 return false;
380
381 ProjectExplorer::ToolChain* tc = ProjectExplorer::ToolChainKitInformation::toolChain(t->kit());
382 if(!tc || tc->type() != QLatin1String(Constants::UBUNTU_CLICK_TOOLCHAIN_ID))
383 return false;
384
385 return (t->project()->id() == Core::Id(CMakeProjectManager::Constants::CMAKEPROJECT_ID)
386 && !UbuntuProjectGuesser::isScopesProject(t->project()));
387}
388
389} // namespace Internal162} // namespace Internal
390} // namespace Ubuntu163} // namespace Ubuntu
391164
=== modified file 'src/ubuntu/ubunturemotedeployconfiguration.h'
--- src/ubuntu/ubunturemotedeployconfiguration.h 2014-06-16 15:14:09 +0000
+++ src/ubuntu/ubunturemotedeployconfiguration.h 2014-07-23 14:19:54 +0000
@@ -20,13 +20,8 @@
20#define UBUNTU_INTERNAL_UBUNTUDEPLOYCONFIGURATION_H20#define UBUNTU_INTERNAL_UBUNTUDEPLOYCONFIGURATION_H
2121
22#include <projectexplorer/deployconfiguration.h>22#include <projectexplorer/deployconfiguration.h>
23#include <remotelinux/abstractremotelinuxdeploystep.h>
24#include <remotelinux/remotelinuxdeployconfiguration.h>23#include <remotelinux/remotelinuxdeployconfiguration.h>
2524
26namespace RemoteLinux {
27class GenericDirectUploadService;
28}
29
30namespace Ubuntu {25namespace Ubuntu {
31namespace Internal {26namespace Internal {
3227
@@ -44,55 +39,6 @@
4439
45};40};
4641
47class UbuntuDirectUploadStep : public RemoteLinux::AbstractRemoteLinuxDeployStep
48{
49 Q_OBJECT
50
51public:
52 UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl);
53 UbuntuDirectUploadStep(ProjectExplorer::BuildStepList *bsl, UbuntuDirectUploadStep *other);
54 ~UbuntuDirectUploadStep();
55
56 // BuildStep interface
57 virtual void run(QFutureInterface<bool> &fi) override;
58
59 ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
60 bool initInternal(QString *error = 0) override;
61
62 RemoteLinux::AbstractRemoteLinuxDeployService *deployService() const override;
63 bool fromMap(const QVariantMap &map) override;
64 QVariantMap toMap() const override;
65
66 static Core::Id stepId();
67 static QString displayName();
68
69private slots:
70 void projectNameChanged();
71
72private:
73 RemoteLinux::GenericDirectUploadService *m_deployService;
74 bool m_foundClickPackage;
75};
76
77class UbuntuDeployStepFactory : public ProjectExplorer::IBuildStepFactory
78{
79 Q_OBJECT
80
81public:
82 // IBuildStepFactory interface
83 virtual QList<Core::Id> availableCreationIds(ProjectExplorer::BuildStepList *parent) const override;
84 virtual QString displayNameForId(const Core::Id id) const override;
85 virtual bool canCreate(ProjectExplorer::BuildStepList *parent, const Core::Id id) const override;
86 virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildStepList *parent, const Core::Id id) override;
87 virtual bool canRestore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) const override;
88 virtual ProjectExplorer::BuildStep *restore(ProjectExplorer::BuildStepList *parent, const QVariantMap &map) override;
89 virtual bool canClone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) const override;
90 virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStepList *parent, ProjectExplorer::BuildStep *product) override;
91
92private:
93 bool canHandle(const ProjectExplorer::Target *t) const;
94};
95
96class UbuntuRemoteDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory42class UbuntuRemoteDeployConfigurationFactory : public ProjectExplorer::DeployConfigurationFactory
97{43{
98 Q_OBJECT44 Q_OBJECT
9945
=== modified file 'src/ubuntu/ubunturemoterunconfiguration.cpp'
--- src/ubuntu/ubunturemoterunconfiguration.cpp 2014-06-18 07:29:05 +0000
+++ src/ubuntu/ubunturemoterunconfiguration.cpp 2014-07-23 14:19:54 +0000
@@ -31,6 +31,7 @@
31#include <remotelinux/remotelinuxenvironmentaspect.h>31#include <remotelinux/remotelinuxenvironmentaspect.h>
32#include <utils/qtcprocess.h>32#include <utils/qtcprocess.h>
33#include <cmakeprojectmanager/cmakeproject.h>33#include <cmakeprojectmanager/cmakeproject.h>
34#include <cmakeprojectmanager/cmakeprojectconstants.h>
3435
35#include <QFile>36#include <QFile>
36#include <QTextStream>37#include <QTextStream>
@@ -141,7 +142,7 @@
141 m_appId.clear();142 m_appId.clear();
142 m_clickPackage.clear();143 m_clickPackage.clear();
143144
144 QDir package_dir(target()->activeBuildConfiguration()->buildDirectory().toString()+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR));145 QDir package_dir(packageDir());
145 if(!package_dir.exists()) {146 if(!package_dir.exists()) {
146 if(errorMessage)147 if(errorMessage)
147 *errorMessage = tr("No packaging directory available, please check if the deploy configuration is correct.");148 *errorMessage = tr("No packaging directory available, please check if the deploy configuration is correct.");
@@ -185,7 +186,8 @@
185 return false;186 return false;
186187
187 QFileInfo commInfo(command);188 QFileInfo commInfo(command);
188 if(commInfo.completeBaseName().startsWith(QLatin1String("qmlscene"))) {189 QString executor = commInfo.completeBaseName();
190 if(executor.startsWith(QStringLiteral("qmlscene"))) {
189 ProjectExplorer::ToolChain* tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());191 ProjectExplorer::ToolChain* tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
190 if(tc->type() != QString::fromLatin1(Constants::UBUNTU_CLICK_TOOLCHAIN_ID)) {192 if(tc->type() != QString::fromLatin1(Constants::UBUNTU_CLICK_TOOLCHAIN_ID)) {
191 if(errorMessage)193 if(errorMessage)
@@ -198,12 +200,12 @@
198 .arg(UbuntuClickTool::targetBasePath(clickTc->clickTarget()))200 .arg(UbuntuClickTool::targetBasePath(clickTc->clickTarget()))
199 .arg(clickTc->gnutriplet());201 .arg(clickTc->gnutriplet());
200202
201 m_remoteExecutable = QLatin1String("/usr/bin/qmlscene");203 m_remoteExecutable = QStringLiteral("/usr/bin/qmlscene");
202 m_arguments = args;204 m_arguments = args;
203 } else if(commInfo.completeBaseName().startsWith(QLatin1String("ubuntu-html5-app-launcher"))) {205 } else if(executor.startsWith(QStringLiteral("ubuntu-html5-app-launcher"))
204 if(errorMessage)206 || executor.startsWith(QStringLiteral("webapp-container"))) {
205 *errorMessage = tr("Run support for remote html projects not available");207 m_remoteExecutable = QStringLiteral("");
206 return false;208 m_arguments = args;
207 } else {209 } else {
208 //looks like a application without a launcher210 //looks like a application without a launcher
209 CMakeProjectManager::CMakeProject* pro = static_cast<CMakeProjectManager::CMakeProject*> (target()->project());211 CMakeProjectManager::CMakeProject* pro = static_cast<CMakeProjectManager::CMakeProject*> (target()->project());
@@ -261,5 +263,24 @@
261 m_arguments = args;263 m_arguments = args;
262}264}
263265
266QString UbuntuRemoteRunConfiguration::packageDir() const
267{
268 ProjectExplorer::Project *p = target()->project();
269 if (p->id() == CMakeProjectManager::Constants::CMAKEPROJECT_ID)
270 return target()->activeBuildConfiguration()->buildDirectory().toString()+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR);
271 else if (p->id() == Ubuntu::Constants::UBUNTUPROJECT_ID) {
272 if (!target()->activeBuildConfiguration()) {
273 //backwards compatibility, try to not crash QtC for old projects
274 //they did not create a buildconfiguration back then
275 QDir pDir(p->projectDirectory());
276 return p->projectDirectory()+QDir::separator()+
277 QStringLiteral("..")+QDir::separator()+
278 pDir.dirName()+QStringLiteral("_build")+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR);
279 } else
280 return target()->activeBuildConfiguration()->buildDirectory().toString()+QDir::separator()+QLatin1String(Constants::UBUNTU_DEPLOY_DESTDIR);
281 }
282 return QString();
283}
284
264} // namespace Internal285} // namespace Internal
265} // namespace Ubuntu286} // namespace Ubuntu
266287
=== modified file 'src/ubuntu/ubunturemoterunconfiguration.h'
--- src/ubuntu/ubunturemoterunconfiguration.h 2014-06-18 07:29:05 +0000
+++ src/ubuntu/ubunturemoterunconfiguration.h 2014-07-23 14:19:54 +0000
@@ -59,6 +59,8 @@
59 static Core::Id typeId ();59 static Core::Id typeId ();
60 void setArguments (const QStringList &args);60 void setArguments (const QStringList &args);
6161
62 QString packageDir () const;
63
62private:64private:
63 QString m_clickPackage;65 QString m_clickPackage;
64 QString m_appId;66 QString m_appId;
6567
=== modified file 'tests/manifest/manifest.pro'
--- tests/manifest/manifest.pro 2014-06-25 11:33:20 +0000
+++ tests/manifest/manifest.pro 2014-07-23 14:19:54 +0000
@@ -10,6 +10,7 @@
1010
11INCLUDEPATH += $${PLUGIN_SRC_ROOT}11INCLUDEPATH += $${PLUGIN_SRC_ROOT}
12DEFINES += SRCDIR=\\\"$$PWD/\\\"12DEFINES += SRCDIR=\\\"$$PWD/\\\"
13DEFINES += IN_TEST_PROJECT
1314
14SOURCES += \15SOURCES += \
15 tst_manifest.cpp \16 tst_manifest.cpp \

Subscribers

People subscribed via source and target branches