Kousik Kumar | 4faa2a5 | 2020-03-05 14:08:09 -0800 | [diff] [blame] | 1 | source build/envsetup.sh |
| 2 | |
| 3 | # This function prefixes the given command with appropriate variables needed |
| 4 | # for the build to be executed with RBE. |
| 5 | function use_rbe() { |
| 6 | local RBE_LOG_DIR="/tmp" |
Luca Stefani | cf82af2 | 2020-06-13 22:38:56 +0200 | [diff] [blame] | 7 | local RBE_BINARIES_DIR="prebuilts/remoteexecution-client/latest" |
Kousik Kumar | 4faa2a5 | 2020-03-05 14:08:09 -0800 | [diff] [blame] | 8 | local DOCKER_IMAGE="gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62" |
| 9 | |
| 10 | # Do not set an invocation-ID and let reproxy auto-generate one. |
| 11 | USE_RBE="true" \ |
| 12 | FLAG_server_address="unix:///tmp/reproxy_$RANDOM.sock" \ |
| 13 | FLAG_exec_root="$(gettop)" \ |
| 14 | FLAG_platform="container-image=docker://${DOCKER_IMAGE}" \ |
| 15 | RBE_use_application_default_credentials="true" \ |
| 16 | RBE_log_dir="${RBE_LOG_DIR}" \ |
| 17 | RBE_reproxy_wait_seconds="20" \ |
| 18 | RBE_output_dir="${RBE_LOG_DIR}" \ |
| 19 | RBE_log_path="text://${RBE_LOG_DIR}/reproxy_log.txt" \ |
| 20 | RBE_CXX_EXEC_STRATEGY="remote_local_fallback" \ |
| 21 | RBE_cpp_dependency_scanner_plugin="${RBE_BINARIES_DIR}/dependency_scanner_go_plugin.so" \ |
| 22 | RBE_DIR=${RBE_BINARIES_DIR} \ |
| 23 | RBE_re_proxy="${RBE_BINARIES_DIR}/reproxy" \ |
| 24 | $@ |
| 25 | } |
Patrice Arruda | d990f70 | 2020-07-10 23:22:49 +0000 | [diff] [blame] | 26 | |
| 27 | # This function detects if the uploader is available and sets the path of it to |
| 28 | # ANDROID_ENABLE_METRICS_UPLOAD. |
| 29 | function _export_metrics_uploader() { |
| 30 | local uploader_path="$(gettop)/vendor/google/misc/metrics_uploader_prebuilt/metrics_uploader.sh" |
| 31 | if [ -x "${uploader_path}" ]; then |
| 32 | export ANDROID_ENABLE_METRICS_UPLOAD="${uploader_path}" |
| 33 | fi |
| 34 | } |
| 35 | |
Ramy Medhat | 3491bbd | 2020-08-13 14:41:32 -0400 | [diff] [blame] | 36 | # This function sets RBE specific environment variables needed for the build to |
| 37 | # executed by RBE. This file should be sourced once per checkout of Android code. |
| 38 | function _set_rbe_vars() { |
Ramy Medhat | fe66d39 | 2020-08-26 05:47:33 -0400 | [diff] [blame^] | 39 | unset USE_GOMA |
Ramy Medhat | 3491bbd | 2020-08-13 14:41:32 -0400 | [diff] [blame] | 40 | export USE_RBE="true" |
| 41 | export RBE_CXX_EXEC_STRATEGY="remote_local_fallback" |
| 42 | export RBE_JAVAC=1 |
| 43 | export RBE_R8=1 |
| 44 | export RBE_D8=1 |
| 45 | } |
| 46 | |
Patrice Arruda | d990f70 | 2020-07-10 23:22:49 +0000 | [diff] [blame] | 47 | _export_metrics_uploader |
Ramy Medhat | 3491bbd | 2020-08-13 14:41:32 -0400 | [diff] [blame] | 48 | _set_rbe_vars |