Import changes for goma client

  - 1baebb40efa974c366bfa243c80f7182fb2a1b67 Remove noisy stderr temp directory log message
  - 58045a6c8ec4e1a87d0e3bddbf7a05272394dd3c Roll boringssl from 5fcd47d137f9 to 28c24092e39b (10 revi...
  - 6c88bbfbfb9dd6bcede70ff5169077d2bf532211 Roll clang from 66bc5a8b79d5 to 2c485d86b9fd (8 revisions)
  - 6112319f313ebbff091ccd398288b0077500cbcc Roll boringssl from 74a75b395967 to 5fcd47d137f9 (12 revi...
  - 2b106f49f7aab4175f0fe5a88846e7c071986233 Roll clang from c419c81c9276 to 66bc5a8b79d5 (14 revisions)
  - b2b4be89863dda554a5744bf0023b708859304eb Roll boringssl from e24491a09cba to 74a75b395967 (15 revi...
  - 5372835eb6c228ef6c2332147d663364fa6825a3 Roll clang from d4255de5daba to c419c81c9276 (8 revisions)
  - 8f89aaa2ed32b8bd35449d8c82b65ff3d544a716 use go 1.20.4
  - 9b56dfc880ad8f9ca982846f520d789434ccb04e goma_auth: helpful message when goma_auth info|config error
  - 4d127251f76c9fd9589b03311187c91637d14184 Roll boringssl from 5e988c40553f to e24491a09cba (12 revi...
  - 438d3401665be7ebbe62d23a4a29222bb80c1200 Roll clang from 448305bbeb6d to d4255de5daba (5 revisions)
  - 91bee65029aed753a1125d151620ce33b6bfd3a5 Roll boringssl from a02b7435ca52 to 5e988c40553f (15 revi...
  - 189cdcbb815f613b3b5a57964e9fcaa5e8baa061 Roll clang from 2f9ce8ce378c to 448305bbeb6d (3 revisions)

GitOrigin-RevId: 1baebb40efa974c366bfa243c80f7182fb2a1b67
Change-Id: Ic22dedb0ed9db0ff2a3540d05f0532a896683b0d
11 files changed
tree: d507e99c644685e64f25f533b1e773aee3672c7b
  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 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.