OLD | NEW |
1 # mojo_run | 1 # mojo_run |
2 | 2 |
3 `mojo_run` allows you to run a Mojo shell either on the host, or on an attached | 3 `mojo_run` allows you to run a Mojo shell either on the host, or on an attached |
4 Android device. | 4 Android device. |
5 | 5 |
6 ```sh | 6 ```sh |
7 mojo_run APP_URL # Run on the host. | 7 mojo_run APP_URL # Run on the host. |
8 mojo_run APP_URL --android # Run on Android device. | 8 mojo_run APP_URL --android # Run on Android device. |
9 mojo_run "APP_URL APP_ARGUMENTS" # Run an app with startup arguments | 9 mojo_run "APP_URL APP_ARGUMENTS" # Run an app with startup arguments |
10 ``` | 10 ``` |
11 | 11 |
12 Unless running within a Mojo checkout, we need to indicate the path to the shell | 12 Unless running within a Mojo checkout, we need to indicate the path to the shell |
13 binary: | 13 binary: |
14 | 14 |
15 ```sh | 15 ```sh |
16 mojo_run --shell-path path/to/shell/binary APP_URL | 16 mojo_run --shell-path path/to/shell/binary APP_URL |
17 ``` | 17 ``` |
18 | 18 |
19 Some applications are meant to be run embedded in a **window manager**. To run | 19 Some applications are meant to be run embedded in a **window manager**. To run |
20 these, you can pass the app url using the `--embed` flag. This will run the | 20 these, you can pass the app url using the `--embed` flag. This will run the |
21 window manager and pass the given url to it: | 21 window manager and pass the given url to it: |
22 | 22 |
23 ```sh | 23 ```sh |
24 mojo_run --embed APP_URL [--android] | 24 mojo_run --embed APP_URL [--android] |
25 ``` | 25 ``` |
26 | 26 |
27 By default, `mojo_run` uses mojo:kiosk_wm as the window manager. You can pass a | 27 By default, `mojo_run` uses mojo:kiosk_wm as the window manager. You can pass a |
28 different window manager url using the `--window-manager` flag to override this. | 28 different window manager url using the `--window-manager` flag to override this. |
29 | 29 |
30 ## Running on multiple Android devices | 30 ## Running multiple instances simultaneously |
31 | 31 |
32 Two or more instances of `mojo_run` can simultaneously run on separate Android | 32 `mojo_run` sets up development servers on fixed ports to facilitate caching |
33 devices. For that, run in individual shells: | 33 between runs and allow the script to work remotely using `adb_remote_setup`. |
| 34 This would normally prevent two or more instances of `mojo_run` from running |
| 35 simulatenously as the development servers cannot be spawned twice on the same |
| 36 ports. |
| 37 |
| 38 In order to run the same set of binaries simultaneously one can use the |
| 39 `--reuse-servers` switch for second and further instances. This will make the |
| 40 second and further instances assume that development servers are already |
| 41 spawned. |
| 42 |
| 43 On **Android** one needs to indicate the id of the device to be targeted in each |
| 44 run. For example, we could run the following in one shell: |
34 | 45 |
35 ```sh | 46 ```sh |
36 mojo_run APP_URL --android --target-device DEVICE_ID --free-host-ports | 47 mojo_run APP_URL --android --target-device DEVICE_ID |
37 ``` | 48 ``` |
38 | 49 |
| 50 and the following in another: |
| 51 |
39 ```sh | 52 ```sh |
40 mojo_run APP_URL --android --target-device ANOTHER_DEVICE_ID --free-host-ports | 53 mojo_run APP_URL --android --target-device ANOTHER_DEVICE_ID --reuse-servers |
41 ``` | 54 ``` |
42 | 55 |
43 `--free-host-ports` makes `mojo_run` spawn the development servers on | 56 Device id can be obtained from `adb devices`. |
44 system-allocated ports on the server (so that multiple instances can run in | |
45 parallel) while still forwarding them to fixed ports on the device (so that | |
46 caching still works). This breaks the remote workflow over `adb_remote_setup`. | |
47 | 57 |
48 DEVICE_ID can be obtained from `adb devices`. | 58 On **Linux** one needs to use a different $HOME directory for each run, to avoid |
| 59 collision of the cache storage. For example, we could run the following in one |
| 60 shell: |
| 61 |
| 62 ```sh |
| 63 mojo_run APP_URL |
| 64 ``` |
| 65 |
| 66 and the following in another: |
| 67 |
| 68 ```sh |
| 69 mkdir ~/another_home |
| 70 HOME=~/another_home mojo_run APP_URL --reuse-servers |
| 71 ``` |
OLD | NEW |