blob: 19c0e4249a669fd1d4c8e4b89e867aa5ccc2cbaa [file] [log] [blame]
Ramy Medhatec8b8df2019-07-17 12:28:40 +00001#
2# Copyright (C) 2019 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Notice: this works only with Google's RBE service.
18ifneq ($(filter-out false,$(USE_RBE)),)
19 ifdef RBE_DIR
20 rbe_dir := $(RBE_DIR)
21 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040022 rbe_dir := prebuilts/remoteexecution-client/live/
Ramy Medhatec8b8df2019-07-17 12:28:40 +000023 endif
Kousik Kumard4630072020-02-04 18:28:48 -080024
25 ifdef RBE_CXX_EXEC_STRATEGY
26 cxx_rbe_exec_strategy := $(RBE_CXX_EXEC_STRATEGY)
27 else
Kousik Kumar151dd8f2020-08-12 06:04:47 +000028 cxx_rbe_exec_strategy := local
Kousik Kumard4630072020-02-04 18:28:48 -080029 endif
30
Kousik Kumarb0f055d2020-05-26 11:54:36 -070031 ifdef RBE_CXX_COMPARE
32 cxx_compare := $(RBE_CXX_COMPARE)
33 else
Kousik Kumar151dd8f2020-08-12 06:04:47 +000034 cxx_compare := false
Kousik Kumarb0f055d2020-05-26 11:54:36 -070035 endif
36
Kousik Kumar2dcf4022020-05-26 11:54:36 -070037 ifdef RBE_CXX_COMPARE
38 cxx_compare := $(RBE_CXX_COMPARE)
39 else
40 cxx_compare := "false"
41 endif
42
Kousik Kumard4630072020-02-04 18:28:48 -080043 ifdef RBE_JAVAC_EXEC_STRATEGY
44 javac_exec_strategy := $(RBE_JAVAC_EXEC_STRATEGY)
45 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040046 javac_exec_strategy := remote_local_fallback
Kousik Kumard4630072020-02-04 18:28:48 -080047 endif
48
49 ifdef RBE_R8_EXEC_STRATEGY
50 r8_exec_strategy := $(RBE_R8_EXEC_STRATEGY)
51 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040052 r8_exec_strategy := remote_local_fallback
Kousik Kumard4630072020-02-04 18:28:48 -080053 endif
54
55 ifdef RBE_D8_EXEC_STRATEGY
56 d8_exec_strategy := $(RBE_D8_EXEC_STRATEGY)
57 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040058 d8_exec_strategy := remote_local_fallback
Kousik Kumard4630072020-02-04 18:28:48 -080059 endif
60
Kousik Kumar151dd8f2020-08-12 06:04:47 +000061 platform := container-image=docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62
62 cxx_platform := $(platform),Pool=default
63 java_r8_d8_platform := $(platform),Pool=java16
Kousik Kumar3fd528e2020-04-02 12:07:47 -070064
Ramy Medhata9cc25d2020-01-27 14:21:24 -050065 RBE_WRAPPER := $(rbe_dir)/rewrapper
Kousik Kumar92f32612020-10-20 05:52:49 +000066 RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_allowlist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform=$(cxx_platform) --compare=$(cxx_compare)
Ramy Medhatec8b8df2019-07-17 12:28:40 +000067
68 # Append rewrapper to existing *_WRAPPER variables so it's possible to
69 # use both ccache and rewrapper.
Ramy Medhata9cc25d2020-01-27 14:21:24 -050070 CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
71 CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
72
73 ifdef RBE_JAVAC
Kousik Kumar151dd8f2020-08-12 06:04:47 +000074 JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac --exec_strategy=$(javac_exec_strategy) --platform=$(java_r8_d8_platform))
Ramy Medhata9cc25d2020-01-27 14:21:24 -050075 endif
76
77 ifdef RBE_R8
Kousik Kumar151dd8f2020-08-12 06:04:47 +000078 R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
Ramy Medhata9cc25d2020-01-27 14:21:24 -050079 endif
80
81 ifdef RBE_D8
Kousik Kumar151dd8f2020-08-12 06:04:47 +000082 D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=out/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java)
Ramy Medhata9cc25d2020-01-27 14:21:24 -050083 endif
Ramy Medhatec8b8df2019-07-17 12:28:40 +000084
85 rbe_dir :=
86endif
Kousik Kumar3fd528e2020-04-02 12:07:47 -070087