blob: 370d4bd0e0967332390663531bbd1ed5ef52fd41 [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
Kousik Kumar2b2b87f2021-09-14 21:31:34 -040025 ifdef RBE_CXX_POOL
26 cxx_pool := $(RBE_CXX_POOL)
27 else
28 cxx_pool := default
29 endif
30
31 ifdef RBE_JAVA_POOL
32 java_pool := $(RBE_JAVA_POOL)
33 else
34 java_pool := java16
35 endif
36
Kousik Kumard4630072020-02-04 18:28:48 -080037 ifdef RBE_CXX_EXEC_STRATEGY
38 cxx_rbe_exec_strategy := $(RBE_CXX_EXEC_STRATEGY)
39 else
Kousik Kumar151dd8f2020-08-12 06:04:47 +000040 cxx_rbe_exec_strategy := local
Kousik Kumard4630072020-02-04 18:28:48 -080041 endif
42
Kousik Kumarb0f055d2020-05-26 11:54:36 -070043 ifdef RBE_CXX_COMPARE
44 cxx_compare := $(RBE_CXX_COMPARE)
45 else
Kousik Kumar151dd8f2020-08-12 06:04:47 +000046 cxx_compare := false
Kousik Kumarb0f055d2020-05-26 11:54:36 -070047 endif
48
Kousik Kumar2dcf4022020-05-26 11:54:36 -070049 ifdef RBE_CXX_COMPARE
50 cxx_compare := $(RBE_CXX_COMPARE)
51 else
52 cxx_compare := "false"
53 endif
54
Kousik Kumard4630072020-02-04 18:28:48 -080055 ifdef RBE_JAVAC_EXEC_STRATEGY
56 javac_exec_strategy := $(RBE_JAVAC_EXEC_STRATEGY)
57 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040058 javac_exec_strategy := remote_local_fallback
Kousik Kumard4630072020-02-04 18:28:48 -080059 endif
60
61 ifdef RBE_R8_EXEC_STRATEGY
62 r8_exec_strategy := $(RBE_R8_EXEC_STRATEGY)
63 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040064 r8_exec_strategy := remote_local_fallback
Kousik Kumard4630072020-02-04 18:28:48 -080065 endif
66
67 ifdef RBE_D8_EXEC_STRATEGY
68 d8_exec_strategy := $(RBE_D8_EXEC_STRATEGY)
69 else
Ramy Medhatba6d7772020-08-12 01:27:15 -040070 d8_exec_strategy := remote_local_fallback
Kousik Kumard4630072020-02-04 18:28:48 -080071 endif
72
Kousik Kumar151dd8f2020-08-12 06:04:47 +000073 platform := container-image=docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62
Kousik Kumar2b2b87f2021-09-14 21:31:34 -040074 cxx_platform := $(platform),Pool=$(cxx_pool)
75 java_r8_d8_platform := $(platform),Pool=$(java_pool)
Kousik Kumar3fd528e2020-04-02 12:07:47 -070076
Ramy Medhata9cc25d2020-01-27 14:21:24 -050077 RBE_WRAPPER := $(rbe_dir)/rewrapper
Kousik Kumar92f32612020-10-20 05:52:49 +000078 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 +000079
80 # Append rewrapper to existing *_WRAPPER variables so it's possible to
81 # use both ccache and rewrapper.
Ramy Medhata9cc25d2020-01-27 14:21:24 -050082 CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
83 CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX))
84
85 ifdef RBE_JAVAC
Kousik Kumar151dd8f2020-08-12 06:04:47 +000086 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 -050087 endif
88
89 ifdef RBE_R8
Kousik Kumar151dd8f2020-08-12 06:04:47 +000090 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 -050091 endif
92
93 ifdef RBE_D8
Kousik Kumar151dd8f2020-08-12 06:04:47 +000094 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 -050095 endif
Ramy Medhatec8b8df2019-07-17 12:28:40 +000096
97 rbe_dir :=
98endif
Kousik Kumar3fd528e2020-04-02 12:07:47 -070099