Ramy Medhat | ec8b8df | 2019-07-17 12:28:40 +0000 | [diff] [blame] | 1 | # |
| 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. |
| 18 | ifneq ($(filter-out false,$(USE_RBE)),) |
| 19 | ifdef RBE_DIR |
| 20 | rbe_dir := $(RBE_DIR) |
| 21 | else |
Ramy Medhat | ba6d777 | 2020-08-12 01:27:15 -0400 | [diff] [blame] | 22 | rbe_dir := prebuilts/remoteexecution-client/live/ |
Ramy Medhat | ec8b8df | 2019-07-17 12:28:40 +0000 | [diff] [blame] | 23 | endif |
Kousik Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 24 | |
Kousik Kumar | 2b2b87f | 2021-09-14 21:31:34 -0400 | [diff] [blame] | 25 | 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 Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 37 | ifdef RBE_CXX_EXEC_STRATEGY |
| 38 | cxx_rbe_exec_strategy := $(RBE_CXX_EXEC_STRATEGY) |
| 39 | else |
Kousik Kumar | 151dd8f | 2020-08-12 06:04:47 +0000 | [diff] [blame] | 40 | cxx_rbe_exec_strategy := local |
Kousik Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 41 | endif |
| 42 | |
Kousik Kumar | b0f055d | 2020-05-26 11:54:36 -0700 | [diff] [blame] | 43 | ifdef RBE_CXX_COMPARE |
| 44 | cxx_compare := $(RBE_CXX_COMPARE) |
| 45 | else |
Kousik Kumar | 151dd8f | 2020-08-12 06:04:47 +0000 | [diff] [blame] | 46 | cxx_compare := false |
Kousik Kumar | b0f055d | 2020-05-26 11:54:36 -0700 | [diff] [blame] | 47 | endif |
| 48 | |
Kousik Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 49 | ifdef RBE_JAVAC_EXEC_STRATEGY |
| 50 | javac_exec_strategy := $(RBE_JAVAC_EXEC_STRATEGY) |
| 51 | else |
Ramy Medhat | ba6d777 | 2020-08-12 01:27:15 -0400 | [diff] [blame] | 52 | javac_exec_strategy := remote_local_fallback |
Kousik Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 53 | endif |
| 54 | |
| 55 | ifdef RBE_R8_EXEC_STRATEGY |
| 56 | r8_exec_strategy := $(RBE_R8_EXEC_STRATEGY) |
| 57 | else |
Ramy Medhat | ba6d777 | 2020-08-12 01:27:15 -0400 | [diff] [blame] | 58 | r8_exec_strategy := remote_local_fallback |
Kousik Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 59 | endif |
| 60 | |
| 61 | ifdef RBE_D8_EXEC_STRATEGY |
| 62 | d8_exec_strategy := $(RBE_D8_EXEC_STRATEGY) |
| 63 | else |
Ramy Medhat | ba6d777 | 2020-08-12 01:27:15 -0400 | [diff] [blame] | 64 | d8_exec_strategy := remote_local_fallback |
Kousik Kumar | d463007 | 2020-02-04 18:28:48 -0800 | [diff] [blame] | 65 | endif |
| 66 | |
Anas Sulaiman | b72060b | 2023-11-01 16:52:21 +0000 | [diff] [blame^] | 67 | platform := container-image=docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:953fed4a6b2501256a0d17f055dc17884ff71b024e50ade773e0b348a6c303e6 |
Kousik Kumar | 2b2b87f | 2021-09-14 21:31:34 -0400 | [diff] [blame] | 68 | cxx_platform := $(platform),Pool=$(cxx_pool) |
| 69 | java_r8_d8_platform := $(platform),Pool=$(java_pool) |
Kousik Kumar | 3fd528e | 2020-04-02 12:07:47 -0700 | [diff] [blame] | 70 | |
Ramy Medhat | a9cc25d | 2020-01-27 14:21:24 -0500 | [diff] [blame] | 71 | RBE_WRAPPER := $(rbe_dir)/rewrapper |
Kousik Kumar | 92f3261 | 2020-10-20 05:52:49 +0000 | [diff] [blame] | 72 | 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 Medhat | ec8b8df | 2019-07-17 12:28:40 +0000 | [diff] [blame] | 73 | |
| 74 | # Append rewrapper to existing *_WRAPPER variables so it's possible to |
| 75 | # use both ccache and rewrapper. |
Ramy Medhat | a9cc25d | 2020-01-27 14:21:24 -0500 | [diff] [blame] | 76 | CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX)) |
| 77 | CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX)) |
| 78 | |
| 79 | ifdef RBE_JAVAC |
Kousik Kumar | 151dd8f | 2020-08-12 06:04:47 +0000 | [diff] [blame] | 80 | 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 Medhat | a9cc25d | 2020-01-27 14:21:24 -0500 | [diff] [blame] | 81 | endif |
| 82 | |
| 83 | ifdef RBE_R8 |
Benjamin Peterson | 099349b | 2023-01-19 18:00:54 +0000 | [diff] [blame] | 84 | R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=$(OUT_DIR)/host/linux-x86/framework/r8.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=$(firstword $(JAVA))) |
Ramy Medhat | a9cc25d | 2020-01-27 14:21:24 -0500 | [diff] [blame] | 85 | endif |
| 86 | |
| 87 | ifdef RBE_D8 |
Benjamin Peterson | 099349b | 2023-01-19 18:00:54 +0000 | [diff] [blame] | 88 | D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform=$(java_r8_d8_platform) --inputs=$(OUT_DIR)/host/linux-x86/framework/d8.jar --toolchain_inputs=$(firstword $(JAVA))) |
Ramy Medhat | a9cc25d | 2020-01-27 14:21:24 -0500 | [diff] [blame] | 89 | endif |
Ramy Medhat | ec8b8df | 2019-07-17 12:28:40 +0000 | [diff] [blame] | 90 | |
| 91 | rbe_dir := |
| 92 | endif |
Kousik Kumar | 3fd528e | 2020-04-02 12:07:47 -0700 | [diff] [blame] | 93 | |