blob: 25a17030757ecda3c48c10bf7ef453ce09bd14e8 [file] [log] [blame]
Kousik Kumar6a19b062020-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"
7 local RBE_BINARIES_DIR="prebuilts/remoteexecution-client/latest/"
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}
Ramy Medhat4d158b52020-08-13 14:41:32 -040026
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
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.
38function _set_rbe_vars() {
39 export USE_RBE="true"
40 export RBE_CXX_EXEC_STRATEGY="remote_local_fallback"
41 export RBE_JAVAC=1
42 export RBE_R8=1
43 export RBE_D8=1
44}
45
46_export_metrics_uploader
47_set_rbe_vars