From fcdbf1da2b6fd66bea89a3c5d4a3ad3d02a3cdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Francis=20Ratt=C3=A9-Boulianne?= <lfrb@collabora.com> Date: Sun, 11 Dec 2016 23:39:33 -0500 Subject: [PATCH] Add run command to start application MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Differential Revision: https://phabricator.apertis.org/D5233 --- doc/man/ade-run.1 | 49 ++++++++++++++++++++++++++++++++++++++++++++ doc/man/ade.1 | 8 ++++++++ tools/ade | 52 +++++++++++++++++++++++++++++++---------------- 3 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 doc/man/ade-run.1 diff --git a/doc/man/ade-run.1 b/doc/man/ade-run.1 new file mode 100644 index 0000000..27f4398 --- /dev/null +++ b/doc/man/ade-run.1 @@ -0,0 +1,49 @@ +.TH ADE\-RUN 1 09/12/2016 0.1612.0 Apertis\ Development\ Tools\ Manual + +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l + +.SH NAME + +ade-run \- Start an application + +.SH SYNOPSIS +.sp +.nf +\fIade run\fR --app=<app> --simulator +\fIade run\fR --app=<app> --device [<user>[:<pass>]@]<hostname>[:<port>] +.fi +.sp +.SH DESCRIPTION +.sp +Start an application in simulator or on given device\&. +.sp +.SH OPTIONS +.sp +.PP +\fI\-\-app\fR +.RS 4 +Absolute path to application to start\&. +.sp +.RE +.PP +\fI\-\-simulator\fR +.RS 4 +Use simulator as target\&. +.sp +.RE +.PP +\fI\-\-device\fR +.RS 4 +Use device as target (e.g. user@apertis)\&. +.sp +.RE +.SH SEE ALSO + +ade(1) + +.SH COPYRIGHT + +Copyright (c) 2016 Collabora Ltd. diff --git a/doc/man/ade.1 b/doc/man/ade.1 index b7f8b7d..95450c3 100644 --- a/doc/man/ade.1 +++ b/doc/man/ade.1 @@ -93,6 +93,14 @@ Uninstall application from simulator or device\&. See \fBade-uninstall(1)\fR .sp .RE +.PP +\fIrun\fR +.RS 4 +Start application in simulator or on device\&. +.sp +See \fBade-run(1)\fR +.sp +.RE .SH SEE ALSO ade-sysroot(1) diff --git a/tools/ade b/tools/ade index 528270d..7cda4e3 100755 --- a/tools/ade +++ b/tools/ade @@ -174,6 +174,9 @@ class Simulator: def uninstall(self, bundle_id): self._exec('ribchester-bundle', 'remove', bundle_id) + def run(self, app, *args): + self._exec('canterbury-exec', app, *args) + class Device: def __init__(self, host, port=22, user=None, password=None): @@ -248,6 +251,9 @@ class Device: def uninstall(self, bundle_id): self._exec('ribchester-bundle', 'remove', bundle_id) + def run(self, app, *args): + self._exec('canterbury-exec', app, *args) + class SysrootVersion: @@ -1127,34 +1133,34 @@ class Ade: if isinstance(obj, SDK): self.info("* SDK version is {0}{1}{2}" - .format(Colors.WARNING, self.obj.version, Colors.ENDC)) + .format(Colors.WARNING, obj.version, Colors.ENDC)) if self.format == 'parseable': - print("SDKVersion:{0}".format(self.obj.version.get_tag())) + print("SDKVersion:{0}".format(obj.version.get_tag())) if isinstance(obj, Sysroot): self.info("* Sysroot version {0}{1}{2} is installed at '{3}'" - .format(Colors.WARNING, self.obj.version, Colors.ENDC, self.obj.path)) + .format(Colors.WARNING, obj.version, Colors.ENDC, obj.path)) if self.format == 'parseable': - print("SysrootVersion:{0}".format(self.obj.version.get_tag())) - print("SysrootPath:{0}".format(self.obj.path)) + print("SysrootVersion:{0}".format(obj.version.get_tag())) + print("SysrootPath:{0}".format(obj.path)) elif isinstance(obj, Device): self.info("* Device has image version {0}{1}{2}" - .format(Colors.WARNING, self.obj.version, Colors.ENDC)) + .format(Colors.WARNING, obj.version, Colors.ENDC)) if self.format == 'parseable': - print("ImageVersion:{0}".format(self.obj.version.get_tag())) + print("ImageVersion:{0}".format(obj.version.get_tag())) elif isinstance(obj, Project): - self.info("* Project: {0}{1}{2}".format(Colors.WARNING, self.obj.name, Colors.ENDC)) - self.info("* BundleId: {0}".format(self.obj.bundle_id)) - self.info("* Version: {0}".format(self.obj.version)) + self.info("* Project: {0}{1}{2}".format(Colors.WARNING, obj.name, Colors.ENDC)) + self.info("* BundleId: {0}".format(obj.bundle_id)) + self.info("* Version: {0}".format(obj.version)) if self.format == 'parseable': - print("ProjectName:{0}".format(self.obj.name)) - print("BundleId:{0}".format(self.obj.bundle_id)) - print("AppVersion:{0}".format(self.obj.version)) + print("ProjectName:{0}".format(obj.name)) + print("BundleId:{0}".format(obj.bundle_id)) + print("AppVersion:{0}".format(obj.version)) elif isinstance(obj, Bundle): - self.info("* BundleId: {0}".format(self.obj.id)) - self.info("* Version: {0}".format(self.obj.version)) + self.info("* BundleId: {0}".format(obj.id)) + self.info("* Version: {0}".format(obj.version)) if self.format == 'parseable': - print("BundleId:{0}".format(self.obj.id)) - print("AppVersion:{0}".format(self.obj.version)) + print("BundleId:{0}".format(obj.id)) + print("AppVersion:{0}".format(obj.version)) def do_configure(self): target = self.get_target() @@ -1225,6 +1231,10 @@ class Ade: except Exception as e: self.die("Couldn't uninstall application: {0}".format(e)) + def do_run(self): + target = self.get_target() + target.run(self.app, self.args) + def info(self, message): if self.format == 'friendly': print(message) @@ -1333,6 +1343,14 @@ if __name__ == '__main__': group.add_argument('--simulator', help="Use simulator as target", action='store_true') group.add_argument('--device', help="Use device as target (e.g. user@apertis)") + # Run parser + run_parser = subparsers.add_parser('run', help="Run application") + run_parser.add_argument('--app', help="Remote path to application to run") + group = run_parser.add_mutually_exclusive_group() + group.add_argument('--simulator', help="Use simulator as target", action='store_true') + group.add_argument('--device', help="Use device as target (e.g. user@apertis)") + run_parser.add_argument('args', help="Configure options", nargs=argparse.REMAINDER) + argcomplete.autocomplete(root_parser) obj = Ade() -- GitLab