Closed Bug 948917 Opened 11 years ago Closed 10 years ago

Add support for packaged app deployment automation from command-line.

Categories

(Firefox OS Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jujjyl, Unassigned)

Details

(Whiteboard: [games])

In the emscripten developer community, a lot of games developers have existing toolchains that target Android. There it is possible to do the following:

1. Install (and replace older installation) an application from the command line:

  adb install -r MyGame.apk

2. Run an application from the command line:

  adb shell am start -n com.app.name/android.app.activityname

  (found this also at https://bugzilla.mozilla.org/show_bug.cgi?id=917568 )

3. Get stdout and stderr while the app is running:

  adb logcat

4. Detect if application is running from the command line:

  adb shell ps com.app.name

5. Stop an application from the command line:

  adb shell am force-stop com.app.name

6. Uninstall an application from the command line:

  adb uninstall com.app.name

It would be very useful to add support for these operation for Firefox OS as well, in a manner that can be bundled with Emscripten SDK ( https://github.com/kripken/emscripten/wiki/Emscripten-SDK ), so that developers get the "Android feature parity" with the development workflow when targeting Firefox OS.

Can any of these steps be automated yet? I hear there are some test automation frameworks (marionette?) that does similar things, but I am not sure if these are ready solutions, since we would need to ship these utilities to the end-user alongside emsdk (user should see no extra manual installation steps), and would need something that works on windows, osx and linux.
Whiteboard: [games]
Deployment via Firefox App Manager can do many of these things (about:app-manager in recent versions of Firefox), but having these features as command-line utility would be nice, as this will improve the "hack, deploy, test" cycle and not having to switch between editor and Firefox App Manager just to deploy/test the new version on a device. Connection to the phone happens via adb and a forwarded socket:

adb forward tcp:6000 localfilesystem:/data/local/debugger-socket

https://developer.mozilla.org/en-US/Firefox_OS/Using_the_App_Manager

The JS source for Firefox App Manager can be found here:

http://mxr.mozilla.org/mozilla-central/source/browser/devtools/app-manager/

Trying to netcat/telnet to the forwarded port 6000 brings up a debugging confirmation dialog on the FxOS phone, and the first response is some json-like data stream.

What's possible with the UI in Firefox App Manager, and what therefore could be reproduce with a command line tool speaking that protocol over the forwarded port 6000:

 1. Installation / update of existing packaged apps
 2. Listing of installed apps, starting and stopping them
 3. Taking a screenshot of the device (that's also important
    to have as a command line tool, so screenshots for e.g.
    Firefox Marketplace can be obtained easily)

The most important part for a "hack, deploy, test" cycle would be the "install packaged app from .zip, stop existing running instance (if any) and start the new instance on the device". If we can also get console.log() output from the device to show up on the command line, that'd be a very good start for having a nice game development setup (both for Emscripten-based apps and apps/games written directly in JS).
I've now implemented this tool, called "ffdb.py" to automate the abovementioned tasks. It is available here:

https://github.com/kripken/emscripten/blob/85c15a40f96d3e14416bcbef1fd76537080798b5/tools/ffdb.py#L156

Let me close this issue as resolved.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.