Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 Mojo | 1 Mojo |
| 2 ==== | 2 ==== |
| 3 | 3 |
| 4 Mojo is an effort to extract a common platform out of Chrome's renderer and | 4 Mojo is an effort to extract a common platform out of Chrome's renderer and |
| 5 plugin processes that can support multiple types of sandboxed content, such as | 5 plugin processes that can support multiple types of sandboxed content, such as |
| 6 HTML, Pepper, or NaCl. | 6 HTML, Pepper, or NaCl. |
| 7 | 7 |
| 8 ## Set up your environment | 8 ## Set-up and code check-out |
| 9 | 9 |
| 10 The instructions below only need to be done once. Note that a simple "git clone" | 10 The instructions below only need to be done once. Note that a simple "git clone" |
| 11 command is not sufficient to build the source code because this repo uses the | 11 command is not sufficient to build the source code because this repo uses the |
| 12 gclient command from depot_tools to manage most third party dependencies. | 12 gclient command from depot_tools to manage most third party dependencies. |
| 13 | 13 |
| 14 1. [Download | 14 1. [Download |
| 15 depot_tools](http://www.chromium.org/developers/how-tos/install-depot-tools) | 15 depot_tools](http://www.chromium.org/developers/how-tos/install-depot-tools) |
| 16 and make sure it is in your path. | 16 and make sure it is in your path. |
| 17 2. [Googlers only] Install Goma in ~/goma. | 17 2. [Googlers only] Install Goma in ~/goma. |
| 18 3. Create a directory somewhere for your checkout (preferably on an SSD), cd | 18 3. Create a directory somewhere for your checkout (preferably on an SSD), cd |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 34 - clones the repository using git clone | 34 - clones the repository using git clone |
| 35 - clones dependencies with gclient sync | 35 - clones dependencies with gclient sync |
| 36 | 36 |
| 37 `install-build-deps.sh` installs any packages needed to build, then | 37 `install-build-deps.sh` installs any packages needed to build, then |
| 38 `mojo/tools/mojob.py gn` runs `gn args` and configures the build directory, | 38 `mojo/tools/mojob.py gn` runs `gn args` and configures the build directory, |
| 39 out/Debug. | 39 out/Debug. |
| 40 | 40 |
| 41 If the fetch command fails, you will need to delete the src directory and start | 41 If the fetch command fails, you will need to delete the src directory and start |
| 42 over. | 42 over. |
| 43 | 43 |
| 44 ### <a name="configure-android"></a>Adding Android bits in an existing checkout | |
| 45 | |
| 46 If you configured your set-up for Linux and now wish to build for Android, edit | |
| 47 the file .gclient in your root Mojo directory (the parent directory to src.) | |
|
tonyg
2015/06/08 15:56:09
Add back-tics around `.gclient`?
ppi
2015/06/08 16:00:30
Done.
| |
| 48 and add this line at the end of the file: | |
| 49 | |
| 50 ``` | |
| 51 target_os = [u'android',u'linux'] | |
| 52 ``` | |
| 53 | |
| 54 Bring in Android-specific build dependencies: | |
| 55 ``` | |
| 56 $ build/install-build-deps-android.sh | |
| 57 ``` | |
| 58 | |
| 59 Pull down all of the packages with this command: | |
| 60 ``` | |
| 61 $ gclient sync | |
| 62 ``` | |
| 63 | |
| 44 ## <a name="buildmojo"></a>Build Mojo | 64 ## <a name="buildmojo"></a>Build Mojo |
| 45 | 65 |
| 66 ### Linux | |
| 67 | |
| 46 Build Mojo for Linux by running: | 68 Build Mojo for Linux by running: |
| 47 | 69 |
| 48 ``` | 70 ``` |
| 49 $ ninja -C out/Debug -j 10 | 71 $ ninja -C out/Debug -j 10 |
| 50 ``` | 72 ``` |
| 51 | 73 |
| 52 (If you are a Googler, see the section at the end of this document for faster | 74 (If you are a Googler, see the section at the end of this document for faster |
| 53 builds.) | 75 builds.) |
| 54 | 76 |
| 55 You can also use the mojob.py script for building. This script automatically | 77 You can also use the mojob.py script for building. This script automatically |
| 56 calls ninja and sets -j to an appropriate value based on whether Goma is | 78 calls ninja and sets -j to an appropriate value based on whether Goma is |
| 57 present. You cannot specify a target name with this script. | 79 present. You cannot specify a target name with this script. |
| 58 ``` | 80 ``` |
| 81 mojo/tools/mojob.py gn | |
| 59 mojo/tools/mojob.py build | 82 mojo/tools/mojob.py build |
| 60 ``` | 83 ``` |
| 61 | 84 |
| 62 Run a demo: | 85 Run a demo: |
| 63 ``` | 86 ``` |
| 64 out/Debug//mojo_shell mojo:spinning_cube | 87 out/Debug/mojo_shell mojo:spinning_cube |
| 65 ``` | 88 ``` |
| 66 | 89 |
| 67 Run the tests: | 90 Run the tests: |
| 68 ``` | 91 ``` |
| 69 mojo/tools/mojob.py test | 92 mojo/tools/mojob.py test |
| 70 ``` | 93 ``` |
| 71 | 94 |
| 72 Create a release build: | 95 Create a release build: |
| 73 ``` | 96 ``` |
| 74 mojo/tools/mojob.py gn --release | 97 mojo/tools/mojob.py gn --release |
| 75 mojo/tools/mojob.py build --release | 98 mojo/tools/mojob.py build --release |
| 76 mojo/tools/mojob.py test --release | 99 mojo/tools/mojob.py test --release |
| 77 ``` | 100 ``` |
| 78 | 101 |
| 79 ## Update your repo | 102 ### Android |
| 80 | 103 |
| 81 You can update your repo like this. The order is important. You must do the `git | 104 To build for Android, first make sure that your checkout is [configured](#config ure-android) to build |
| 82 pull` first because `gclient sync` is dependent on the current revision. | 105 for Android. After that you can use the mojob script as follows: |
| 106 | |
| 107 ``` | |
| 108 $ mojo/tools/mojob.py gn --android | |
| 109 $ mojo/tools/mojob.py build --android | |
| 110 ``` | |
| 111 | |
| 112 The result will be in out/android_Debug. If you see javac compile errors, | |
| 113 [make sure you have an up-to-date JDK](https://code.google.com/p/chromium/wiki/A ndroidBuildInstructions#Install_Java_JDK) | |
| 114 | |
| 115 ## Update your checkout | |
| 116 | |
| 117 You can update your checkout like this. The order is important. You must do the | |
| 118 `git pull` first because `gclient sync` is dependent on the current revision. | |
| 83 ``` | 119 ``` |
| 84 # Fetch changes from upstream and rebase the current branch on top | 120 # Fetch changes from upstream and rebase the current branch on top |
| 85 $ git pull --rebase | 121 $ git pull --rebase |
| 86 # Update all modules as directed by the DEPS file | 122 # Update all modules as directed by the DEPS file |
| 87 $ gclient sync | 123 $ gclient sync |
| 88 ``` | 124 ``` |
| 89 | 125 |
| 90 You do not need to rerun `gn gen out/Debug` or `mojo/tools/mojob.py gn`. Ninja | 126 You do not need to rerun `gn gen out/Debug` or `mojo/tools/mojob.py gn`. Ninja |
| 91 will do so automatically as needed. | 127 will do so automatically as needed. |
| 92 | 128 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 101](http://dev.chromium.org/developers/cpp-in-chromium-101-codelab). | 165 101](http://dev.chromium.org/developers/cpp-in-chromium-101-codelab). |
| 130 | 166 |
| 131 To land a change after receiving LGTM: | 167 To land a change after receiving LGTM: |
| 132 ``` | 168 ``` |
| 133 $ git cl land | 169 $ git cl land |
| 134 ``` | 170 ``` |
| 135 | 171 |
| 136 Don't break the build! Waterfall is here: | 172 Don't break the build! Waterfall is here: |
| 137 http://build.chromium.org/p/client.mojo/waterfall | 173 http://build.chromium.org/p/client.mojo/waterfall |
| 138 | 174 |
| 139 ## Android Builds | |
| 140 | |
| 141 To build for Android, first make sure you've downloaded build support for | |
| 142 Android, which you would have done by adding `--target_os=android` when you ran | |
| 143 `fetch mojo`. If you didn't do that, there's an easy fix. Edit the file .gclient | |
| 144 in your root Mojo directory (the parent directory to src.) Add this line at the | |
| 145 end of the file: | |
| 146 | |
| 147 ``` | |
| 148 target_os = [u'android'] | |
| 149 ``` | |
| 150 | |
| 151 Bring in android specific build dependencies: | |
| 152 ``` | |
| 153 $ build/install-build-deps-android.sh | |
| 154 ``` | |
| 155 | |
| 156 Pull down all of the packages with this command: | |
| 157 | |
| 158 ``` | |
| 159 $ gclient sync | |
| 160 ``` | |
| 161 | |
| 162 Prepare the build directory for Android: | |
| 163 | |
| 164 ``` | |
| 165 $ mojo/tools/mojob.py gn --android | |
| 166 ``` | |
| 167 | |
| 168 Finally, perform the build. The result will be in out/android_Debug: | |
| 169 | |
| 170 ``` | |
| 171 $ mojo/tools/mojob.py build --android | |
| 172 ``` | |
| 173 | |
| 174 If you see javac compile errors, make sure you have an up-to-date JDK: | |
| 175 https://code.google.com/p/chromium/wiki/AndroidBuildInstructions#Install_Java_JD K | |
| 176 | |
| 177 ## Dart Code | 175 ## Dart Code |
| 178 | 176 |
| 179 Because the dart analyzer is a bit slow, we don't run it unless the user | 177 Because the dart analyzer is a bit slow, we don't run it unless the user |
| 180 specifically asks for it. To run the dart analyzer against the list of dart | 178 specifically asks for it. To run the dart analyzer against the list of dart |
| 181 targets in the toplevel BUILD.gn file, run: | 179 targets in the toplevel BUILD.gn file, run: |
| 182 | 180 |
| 183 ``` | 181 ``` |
| 184 $ mojo/tools/mojob.py dartcheck | 182 $ mojo/tools/mojob.py dartcheck |
| 185 ``` | 183 ``` |
| 186 | 184 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 ./out/Debug/mojo_shell mojo:spinning_cube | 266 ./out/Debug/mojo_shell mojo:spinning_cube |
| 269 ``` | 267 ``` |
| 270 | 268 |
| 271 3. Optional: Run Mojo Shell with an HTTP server | 269 3. Optional: Run Mojo Shell with an HTTP server |
| 272 | 270 |
| 273 ``` | 271 ``` |
| 274 cd out/Debug | 272 cd out/Debug |
| 275 python -m SimpleHTTPServer 4444 & | 273 python -m SimpleHTTPServer 4444 & |
| 276 ./mojo_shell --origin=http://127.0.0.1:4444 --disable-cache mojo:spinning_cube | 274 ./mojo_shell --origin=http://127.0.0.1:4444 --disable-cache mojo:spinning_cube |
| 277 ``` | 275 ``` |
| OLD | NEW |