| commit | 05d7c0dc584f9bde9ea4135fcb1b17e7088ee671 | [log] [tgz] |
|---|---|---|
| author | Eric Seidel <eseidel@chromium.org> | Wed Jan 21 15:53:17 2015 -0800 |
| committer | Eric Seidel <eseidel@chromium.org> | Wed Jan 21 15:53:17 2015 -0800 |
| tree | aa58497a476bf368d90ed5d5a2aa977f865a51d5 | |
| parent | c0b1aa03f2de3618f927075555f9679a3bd53d4f [diff] |
Always use mojo_shell in over-http mode --origin tells mojo_shell to map all mojo: urls to to a new base-url instead of the build directory. This makes skydb's mojo_shell *always* use the network loading path, which is what Android mojo_shell does and is more like how mojo_shell will eventually be used. I also fixed the disk-space leak in the dynamic_application_loader's NetworkLoader path by having it immediately unlink the /tmp copy of the library after dlopen. In order to keep pprof working I had to teach the dynamic_application_loader to write out a map of /tmp/file -> url mappings so that we can fix the pprof file afterwords. This will "break" skydb --gdb on linux in exactly as much as it is already broken on Android, but I'm working on a build-id based solution for both so that gdb knows how to find symbols for non-existant randomly named /tmp libraries. R=abarth@chromium.org, viettrungluu@chromium.org BUG=450696 Review URL: https://codereview.chromium.org/829183005
Mojo is an effort to extract a common platform out of Chrome's renderer and plugin processes that can support multiple types of sandboxed content, such as HTML, Pepper, or NaCl.
The instructions below only need to be done once. Note that a simple “git clone” command is not sufficient to build the source code because this repo uses the gclient command from depot_tools to manage most third party dependencies.
Download depot_tools and make sure it is in your path:
http://www.chromium.org/developers/how-tos/install-depot-tools
[Googlers only] Install Goma in ~/goma.
Create a directory somewhere for your checkout (preferably on an SSD), cd into it, and run the following commands:
$ fetch mojo # append --target_os=android to include Android build support. $ cd src $ ./build/install-build-deps.sh $ mojo/tools/mojob.py gn
The “fetch mojo” command does the following:
install-build-deps.sh installs any packages needed to build, then mojo/tools/mojob.py gn runs gn args and configures the build directory, out/Debug.
If the fetch command fails, you will need to delete the src directory and start over.
Build Mojo by running:
$ ninja -C out/Debug -j 10
(If you are a Googler, see the section at the end of this document for faster builds.)
You can also use the mojob.py script for building. This script automatically calls ninja and sets -j to an appropriate value based on whether Goma is present. You cannot specify a target name with this script.
mojo/tools/mojob.py build
Run a demo:
mojo/tools/mojo_demo.py --browser
Run the tests:
mojo/tools/mojob.py test
You can update your repo like this:
$ gclient sync $ git pull --rebase
You do not need to rerun “gn gen out/Debug”. Ninja will do so automatically as needed.
With git you should make all your changes in a local branch. Once your change is committed, you can delete this branch.
Create a local branch named “mywork” and make changes to it.
cd src git new-branch mywork vi ...
Commit your change locally (this doesn't commit your change to the SVN or Git server)
git commit -a
Fix your source code formatting
$ git cl format
Upload your change for review
$ git cl upload
Respond to review comments
See Contributing code for more detailed git instructions, including how to update your CL when you get review comments. There's a short tutorial that might be helpful to try before your first change: C++ in Chromium 101.
To land a change after receiving LGTM:
$ git cl land
Don't break the build! Waterfall is here: http://build.chromium.org/p/client.mojo/waterfall
To build for Android, first make sure you‘ve downloaded build support for Android, which you would have done by adding --target_os=android when you ran fetch mojo. If you didn’t do that, there's an easy fix. Edit the file .gclient in your root Mojo directory (the parent directory to src.) Add this line at the end of the file:
target_os = [u'android']
Pull down all of the packages with this command:
$ gclient sync
Prepare the build directory for Android:
$ src/mojo/tools/mojob.py gn --android
Finally, perform the build. The result will be in out/android_Debug:
$ src/mojo/tools/mojob.py build --android
If you're a Googler, you can use Goma, a distributed compiler service for open-source projects such as Chrome and Android. The instructions below assume that Goma is installed in the default location (~/goma).
To enable Goma, update your “args.gn” file. Open the file in your editor with this command:
$ gn args out/Debug
Add this line to the end of the file:
use_goma = true
After you close the editor, the “gn args” command will automatically run “gn gen out/Debug” again.
Now you can dramatically increase the number of parallel tasks:
$ ninja -C out/Debug -j 1000
Prerequisites:
Build changed files:
mojob.py build --android
Push mojo_shell to to your device:
adb install -r out/android_Debug/apks/MojoShell.apk
Run Mojo Shell on the device:
./mojo/tools/android_mojo_shell.py mojo:sample_app
If you get a crash you won't see symbols. Use tools/android_stack_parser/stack to map back to symbols, e.g.:
adb logcat | ./tools/android_stack_parser/stack
Build the mojo target, which builds the shell and all examples:
ninja -C out/Release mojo
Run Mojo Shell:
./out/Release/mojo_shell mojo:sample_app
Optional: Run Mojo Shell with an HTTP server
cd out/Release python -m SimpleHTTPServer 4444 & ./mojo_shell --origin=http://127.0.0.1:4444 --disable-cache mojo:mojo_sample_app