blob: 724ad7dc566bc6effdcbd95c2e5ac6b7d3448764 [file] [log] [blame]
Kousik Kumar4faa2a52020-03-05 14:08:09 -08001source build/envsetup.sh
2
3# This function prefixes the given command with appropriate variables needed
4# for the build to be executed with RBE.
5function use_rbe() {
6 local RBE_LOG_DIR="/tmp"
Luca Stefanicf82af22020-06-13 22:38:56 +02007 local RBE_BINARIES_DIR="prebuilts/remoteexecution-client/latest"
Kousik Kumar4faa2a52020-03-05 14:08:09 -08008 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 Arrudad990f702020-07-10 23:22:49 +000026
27# This function detects if the uploader is available and sets the path of it to
28# ANDROID_ENABLE_METRICS_UPLOAD.
29function _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 Medhat3491bbd2020-08-13 14:41:32 -040036# 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.
38function _set_rbe_vars() {
Ramy Medhatfe66d392020-08-26 05:47:33 -040039 unset USE_GOMA
Ramy Medhat3491bbd2020-08-13 14:41:32 -040040 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 Arrudad990f702020-07-10 23:22:49 +000047_export_metrics_uploader
Ramy Medhat3491bbd2020-08-13 14:41:32 -040048_set_rbe_vars