Import changes for goma client

  - 5748707d7e968c42d51ab01c404e3bf8cbd0dc7f Add deprecation notice in README.md
  - 9e3acbecdfbb23e6dcf01d30549c49a97e8f749d use go 1.21.6
  - fada41c3870314383cb9f33a19ef1b24ebe6c7b2 Roll clang from 2b9d966ec582 to 657c88b9c012 (1 revision)
  - c599baba12f3d916b2683b9aa34e2a87613df394 Roll clang from 09ec89c1157b to 2b9d966ec582 (1 revision)
  - 945eca830fed4e250f7ddbd2b83c4a9774303041 Roll clang from dbe34d7b760d to 09ec89c1157b (4 revisions)
  - 7df58f86a09deaa165e6481849664c8dfc241a77 Roll clang from 28cba3ec325c to dbe34d7b760d (3 revisions)
  - 872ad24b18a7839244744b593937103e153b18cf use go 1.21.5
  - f515be2df0ebeb171e18125b8d4121418ac3d5cf Roll clang from 22c6d2c55478 to 28cba3ec325c (5 revisions)
  - 1cec9c0dbaa46645965bc79bcc22dfbf9df72811 Roll clang from 9fbc780088a0 to 22c6d2c55478 (5 revisions)
  - edb9069a9816efbba34a853c435ffa71ff2f73b9 Roll clang from 1f8329e28f7e to 9fbc780088a0 (3 revisions)
  - a20abf5c5e13ae6ee18103b6746eeb01d90c4598 Roll clang from bbcb7c6c14ff to 1f8329e28f7e (1 revision)
  - bbb3fe8cf5cdaf8b56f2df274c9ebe6a165897df use go 1.21.4
  - c49dd8e1154b7b8a69f41b7fe53427c4841e9b37 Roll clang from 2492c5a0a36d to bbcb7c6c14ff (3 revisions)
  - 38340e8983466bdaa607212fbc203b75acf19d14 Roll clang from 86aed39db276 to 2492c5a0a36d (6 revisions)
  - 01e848dce03931804da85d79385266f4e2c559e0 fix compile warnings for clang roll
  - 538f8628264c1308ee0f6841d91a5aba01e8ccb2 Roll clang from ceb8145f5589 to 86aed39db276 (1 revision)
  - 875d889b73f155de15c78784c3f2003ce39b7cba Roll clang from 22e15941889d to ceb8145f5589 (2 revisions)
  - 47f34628f8dcb07ae37e242cf363dcedc68cc2df use go 1.21.3
  - a56908b5dda2fd029183284b2b529b5be6df7518 Roll clang from f775f73afa54 to 22e15941889d (1 revision)
  - e2f87cb843d7b187f059b2d0f61f200ca4b7e9ae Roll clang from dc3593cbb8b6 to f775f73afa54 (4 revisions)
  - d70401e99b6921c8ae2ef2ae88d014084794326d Roll boringssl from a1843d660b47 to d24a38200fef (3 revis...
  - 5986717e98374d567af9229d61fa3c626a2cc776 Roll clang from ac34945aad34 to dc3593cbb8b6 (5 revisions)

GitOrigin-RevId: 5748707d7e968c42d51ab01c404e3bf8cbd0dc7f
Change-Id: Ie2e41238632afe9418a8a0bda5e322c981b9cfbd
63 files changed
tree: 63f62a47469b60fbfec9102f3bc075df27f785c2
  1. base/
  2. benchmark/
  3. build/
  4. client/
  5. doc/
  6. go/
  7. infra/
  8. lib/
  9. test/
  10. testing/
  11. third_party/
  12. tools/
  13. .clang-format
  14. .gitallowed
  15. .gitignore
  16. .gn
  17. .style.yapf
  18. BUILD.gn
  19. codereview.settings
  20. CONTRIBUTING.md
  21. DEPS
  22. LICENSE
  23. OWNERS
  24. PRESUBMIT.py
  25. README.md
README.md

Goma client

Goma is not maintained any more, please use reclient instead.

Goma is a distributed compiler service for open-source project such as Chromium and Android. It's some kind of replacement of distcc+ccache.

NOTE: For non-Googler usage, please see Goma for Chromium Contributors.

Google employees interested in contributing to the goma client should use internal version. see http://go/ma-client-code

How Goma works

Goma hooks a compile request, and sends it to a backend compile server. If you have plenty of backend servers, a lot of compile can be processed in parallel, for example, -j100, -j500 or -j1000.

Also, the Goma backend caches the compile result. If the same compile request comes, the cached result is returned from the Goma cache server.

How to build

Goma client can be built on Linux, Mac, and Win.

Prerequisite

  1. Use 64bit platform (Linux, Mac or Win).
  2. Install depot_tools.
  3. Install dependencies.
    • On Mac, install Xcode.
    • On Windows, install Visual Studio 2017. Community edition is OK.

Checkout source

$ mkdir goma && cd goma
$ gclient config https://chromium.googlesource.com/infra/goma/client
$ gclient sync
$ cd client

We assume the Goma client code is checked out to ${GOMA_SRC}. You can set this in your environment, but do not export it as it will make gomacc complain.

If you want to develop goma client, make goma client source unmanaged by gclient. Open .gclient file, and check "managed" value. If it's True, changed it to False. Otherwise, gclient will manage your repository, so your checkout can be unintentionally changed with gclient sync.

Move to client directory (which is under git repo), and configure git repository with your username and emails.

$ cd client
$ git config user.email 'foo@example.com'
$ git config user.name 'Your Name'

Build

$ cd "${GOMA_SRC}/client"
$ gclient sync
$ gn gen --args="is_debug=false" out/Release
$ ninja -C out/Release

Several important gn args

The build option can be modified with gn args.

is_debug=true/false
  Do debug build if true.
dcheck_always_on=true/false
  Enable DCHECK always (even in release build).
is_asan=true/false
  Use ASan build (with clang).
use_link_time_optimization=true/false
  Currently working only on Win. If true, /LTCG is enable.
use_lld=true/false
  Use lld for link (it will be fast)

Run unittest

$ cd "${GOMA_SRC}/client"
$ ./build/run_unittest.py --target=Release --build-dir=out

Coding style

Follow Google code style.

For C++11/14 features, we prefer to follow Chromium's guidelines.

How to use

For Chromium development

Goma can be integrated with Chromium development easily.

  1. Build goma client
  2. Start compiler_proxy
$ "${GOMA_SRC}/client/out/Release/goma_ctl.py" start

For Chromium

In Chromium src, specify the following args in gn args

use_goma = true
goma_dir = "${GOMA_SRC}/client/out/Release"  (Replace ${GOMA_SRC} to your checkout)

Then build like the following:

$ cd /path/to/chromium/src/out/Release
$ ninja -j100 chrome

More details are avairable in chromium's build instructions.

For general development

  1. Build Goma client
  2. Start compiler_proxy
$ ./goma_ctl.py ensure_start
  1. Change your build script so that gomacc is prepended to compiler command. For example:
$ gomacc clang++ -c foo.cc
  1. Build your product with make -j100, ninja -j100 or larger -j. Check http://localhost:8088 to see compiler_proxy is actually working.
  • You can use autoninja in depot_tools instead of specifying gomacc manually.