OLD | NEW |
1 # Devtools | 1 # Devtools |
2 | 2 |
3 Unopinionated tools for **running**, **debugging** and **testing** Mojo apps. | 3 Unopinionated tools for **running**, **debugging** and **testing** Mojo apps. |
4 | 4 |
5 ## Install | 5 ## Install |
6 | 6 |
7 ``` | 7 ``` |
8 git clone https://github.com/domokit/devtools.git | 8 git clone https://github.com/domokit/devtools.git |
9 ``` | 9 ``` |
10 | 10 |
11 ## Contents | 11 ## Contents |
12 | 12 |
13 Devtools offers the following tools: | 13 Devtools offers the following tools: |
14 | 14 |
15 - `mojo_run` - shell runner | 15 - `mojo_run` - shell runner |
16 - `mojo_test` - apptest runner | 16 - `mojo_test` - apptest runner |
17 - `mojo_debug` - debugger supporting interactive tracing and debugging of a | 17 - `mojo_debug` - debugger supporting interactive tracing and debugging of a |
18 running mojo shell | 18 running mojo shell |
19 | 19 |
20 Additionally, `remote_adb_setup` script helps to configure adb on a remote | 20 Additionally, `remote_adb_setup` script helps to configure adb on a remote |
21 machine to communicate with a device attached to a local machine, forwarding the | 21 machine to communicate with a device attached to a local machine, forwarding the |
22 ports used by `mojo_run`. | 22 ports used by `mojo_run`. |
23 | 23 |
| 24 ### Runner |
| 25 |
| 26 `mojo_run` allows you to run a Mojo shell either on the host, or on an attached |
| 27 Android device. |
| 28 |
| 29 ```sh |
| 30 mojo_run APP_URL # Run on the host. |
| 31 mojo_run APP_URL --android # Run on Android device. |
| 32 ``` |
| 33 |
| 34 Unless running within a Mojo checkout, we need to indicate the path to the shell |
| 35 binary: |
| 36 |
| 37 ```sh |
| 38 mojo_run --shell-path path/to/shell/binary APP_URL |
| 39 ``` |
| 40 |
| 41 #### Sky apps |
| 42 |
| 43 To run a [Sky](https://github.com/domokit/sky_engine) app, you need to build |
| 44 `sky_viewer.mojo` in a Sky checkout, and indicate the path to the binary using |
| 45 the `--map-url` parameter: |
| 46 |
| 47 ```sh |
| 48 mojo_run --map-url mojo:sky_viewer=/path/to/sky/viewer APP_URL |
| 49 ``` |
| 50 |
| 51 If the app does not declare a shebang indicating that it needs to be run in |
| 52 `sky_viewer`, pass `--sky` to map `sky_viewer` as a default content handler for |
| 53 dart apps: |
| 54 |
| 55 ```sh |
| 56 mojo_run --map-url mojo:sky_viewer=/path/to/sky/viewer APP_URL --sky |
| 57 ``` |
| 58 |
| 59 Note that Sky apps will need the --use-osmesa flag to run |
| 60 over [chromoting](https://support.google.com/chrome/answer/1649523?hl=en): |
| 61 |
24 ### Debugger | 62 ### Debugger |
25 | 63 |
26 The `mojo_debug` script allows you to interactively inspect a running shell, | 64 `mojo_debug` allows you to interactively inspect a running shell, collect |
27 collect performance traces and attach a gdb debugger. | 65 performance traces and attach a gdb debugger. |
28 | 66 |
29 #### Tracing | 67 #### Tracing |
30 To collect [performance | 68 To collect [performance |
31 traces](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) | 69 traces](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) |
32 and retrieve the result: | 70 and retrieve the result: |
33 | 71 |
34 ```sh | 72 ```sh |
35 mojo_debug tracing start | 73 mojo_debug tracing start |
36 mojo_debug tracing stop [result.json] | 74 mojo_debug tracing stop [result.json] |
37 ``` | 75 ``` |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 Linux and support for apptest frameworks. The executable scripts in devtools are | 119 Linux and support for apptest frameworks. The executable scripts in devtools are |
82 based on this module. One can also choose to embed the functionality provided by | 120 based on this module. One can also choose to embed the functionality provided by |
83 **devtoolslib** in their own wrapper. | 121 **devtoolslib** in their own wrapper. |
84 | 122 |
85 ## Development | 123 ## Development |
86 | 124 |
87 The library is canonically developed [in the mojo | 125 The library is canonically developed [in the mojo |
88 repository](https://github.com/domokit/mojo/tree/master/mojo/devtools/common), | 126 repository](https://github.com/domokit/mojo/tree/master/mojo/devtools/common), |
89 https://github.com/domokit/devtools is a mirror allowing to consume it | 127 https://github.com/domokit/devtools is a mirror allowing to consume it |
90 separately. | 128 separately. |
OLD | NEW |