From 849549d40304890255f6033d13c2646e3bfb6ebb Mon Sep 17 00:00:00 2001 From: Jeremy Leconte Date: Fri, 8 Nov 2024 21:02:24 +0100 Subject: [PATCH] Enable rust toolchain for bots that depend on chromium base/. The Android bots and the libfuzzer bots have an indirect dependency on base. This CL downloads the rust toolchain for these bots so that rust can be used in Chromium base/ without guards to prevent WebRTC from breaking. Change-Id: I81e0a32827e8eee29f333d933d0fb21dc0b7dc23 Bug: None Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/367921 Commit-Queue: Jeremy Leconte Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/main@{#43384} --- .gn | 3 +- DEPS | 46 ++++++++++++++++++ tools_webrtc/mb/mb_config.pyl | 89 +++++++++++++++++++++++++++++------ 3 files changed, 123 insertions(+), 15 deletions(-) diff --git a/.gn b/.gn index f4c26795a0..12d5e3d4fc 100644 --- a/.gn +++ b/.gn @@ -82,6 +82,7 @@ default_args = { # let's temporarily disable it. enable_jni_multiplexing = false - # This adds a dependency to //base. + # TODO(b/42223878): use_fuzztest_wrapper adds a dependency to //base so + # let's temporarly disable it. use_fuzztest_wrapper = false } diff --git a/DEPS b/DEPS index ed3f0827d7..a9b8fde206 100644 --- a/DEPS +++ b/DEPS @@ -126,6 +126,46 @@ deps = { 'condition': 'not (host_os == "linux" and host_cpu == "arm64")', }, + 'third_party/rust': { + 'url': Var('chromium_git') + '/chromium/src/third_party/rust@0e0ef14876a32128574eaf80bc7fc1c7cde92006', + 'condition': 'checkout_android or checkout_fuzzer', + }, + + 'third_party/rust-toolchain': { + 'dep_type': 'gcs', + 'bucket': 'chromium-browser-clang', + 'objects': [ + { + 'object_name': 'Linux_x64/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz', + 'sha256sum': '043bc520520424fad9fdfc87102e3af7c8f1ca4da3f7885e18f54fd29fc783e4', + 'size_bytes': 115068636, + 'generation': 1725552307196828, + 'condition': 'host_os == "linux" and non_git_source', + }, + { + 'object_name': 'Mac/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz', + 'sha256sum': '100befb02da0940fdede41a0ad0e28ded1ce4b6794b5e488bccc91ba1d27348a', + 'size_bytes': 108415524, + 'generation': 1725552308530261, + 'condition': 'host_os == "mac" and host_cpu == "x64"', + }, + { + 'object_name': 'Mac_arm64/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz', + 'sha256sum': '6f3ba8fe5a9590b476c087b412bd60e7e46ec59bc37aac76d9f7894c6bc34a75', + 'size_bytes': 97820200, + 'generation': 1725552309875662, + 'condition': 'host_os == "mac" and host_cpu == "arm64"', + }, + { + 'object_name': 'Win/rust-toolchain-009e73825af0e59ad4fc603562e038b3dbd6593a-2-llvmorg-20-init-3847-g69c43468.tar.xz', + 'sha256sum': '1d04274c7a96aa0148a9bb5b29fa5b33c24b97971e33634bed62ce504b1cb346', + 'size_bytes': 172453420, + 'generation': 1725552311180142, + 'condition': 'host_os == "win"', + }, + ], + }, + 'src/third_party/clang-format/script': 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git@3c0acd2d4e73dd911309d9e970ba09d58bf23a62', 'src/third_party/libc++/src': @@ -1960,6 +2000,12 @@ hooks = [ 'action': ['vpython3', 'src/tools/clang/scripts/update.py', '--package=clangd'], }, + { + 'name': 'rust', + 'pattern': '.', + 'condition': 'checkout_android or checkout_fuzzer', + 'action': ['python3', 'src/tools/rust/update_rust.py'], + }, { # Update LASTCHANGE. 'name': 'lastchange', diff --git a/tools_webrtc/mb/mb_config.pyl b/tools_webrtc/mb/mb_config.pyl index d148ddc811..5c2165d1a3 100644 --- a/tools_webrtc/mb/mb_config.pyl +++ b/tools_webrtc/mb/mb_config.pyl @@ -234,54 +234,78 @@ # A given config *may* be platform-specific but is not necessarily so (i.e., # we might have mac, win, and linux bots all using the 'release_bot' config). 'configs': { - 'android_asan_shared_release_bot_arm': - ['android', 'asan', 'clang', 'pure_release_bot', 'arm'], + 'android_asan_shared_release_bot_arm': [ + 'android', + 'asan', + 'chromium_base_dependency', + 'clang', + 'pure_release_bot', + 'arm', + ], 'android_debug_static_bot_arm': [ 'android', + 'chromium_base_dependency', 'debug_static_bot', 'arm', 'h265', ], 'android_debug_static_bot_arm64': [ 'android', + 'chromium_base_dependency', 'debug_static_bot', 'arm64', 'h265', ], 'android_debug_static_bot_x64': [ 'android', + 'chromium_base_dependency', 'debug_static_bot', 'x64', 'h265', ], 'android_debug_static_bot_x86': [ 'android', + 'chromium_base_dependency', 'debug_static_bot', 'x86', 'h265', ], - 'android_pure_release_bot_arm': ['android', 'pure_release_bot', 'arm'], - 'android_pure_release_bot_arm64': ['android', 'pure_release_bot', 'arm64'], + 'android_pure_release_bot_arm': [ + 'android', + 'chromium_base_dependency', + 'pure_release_bot', + 'arm', + ], + 'android_pure_release_bot_arm64': [ + 'android', + 'chromium_base_dependency', + 'pure_release_bot', + 'arm64', + ], 'android_release_bot_arm': [ 'android', + 'chromium_base_dependency', 'release_bot', 'arm', 'h265', ], 'android_release_bot_arm64': [ 'android', + 'chromium_base_dependency', 'release_bot', 'arm64', 'h265', ], 'android_release_bot_x64': [ 'android', + 'chromium_base_dependency', 'release_bot', 'x64', 'h265', ], 'android_release_bot_x86': [ 'android', + 'chromium_base_dependency', 'release_bot', 'x86', 'h265', @@ -305,15 +329,24 @@ 'debug_bot_arm64': ['openh264', 'debug_bot', 'arm64', 'h265'], 'debug_bot_x64': ['openh264', 'debug_bot', 'x64', 'h265'], 'debug_bot_x86': ['openh264', 'debug_bot', 'x86', 'h265'], - 'disable_trace_events_android_arm': - ['android', 'arm', 'disable_trace_events', 'release_bot'], + 'disable_trace_events_android_arm': [ + 'android', + 'arm', + 'chromium_base_dependency', + 'disable_trace_events', + 'release_bot', + ], 'disable_trace_events_x64': ['x64', 'disable_trace_events', 'release_bot'], 'disable_trace_events_x86': ['x86', 'disable_trace_events', 'release_bot'], 'dummy_audio_file_devices_no_protobuf_android_arm': [ - 'android', 'debug_static_bot', 'arm', 'dummy_audio_file_devices', - 'no_protobuf' + 'android', + 'arm', + 'chromium_base_dependency', + 'debug_static_bot', + 'dummy_audio_file_devices', + 'no_protobuf', ], 'dummy_audio_file_devices_no_protobuf_x64': ['debug_bot', 'x64', 'dummy_audio_file_devices', 'no_protobuf'], @@ -339,8 +372,14 @@ 'ios', 'release_bot', 'arm64', 'no_ios_code_signing', 'xctest', ], 'libfuzzer_asan_release_bot_x64': [ - 'libfuzzer', 'asan', 'optimize_for_fuzzing', 'openh264', - 'pure_release_bot', 'x64', 'h265' + 'asan', + 'chromium_base_dependency', + 'h265', + 'libfuzzer', + 'openh264', + 'optimize_for_fuzzing', + 'pure_release_bot', + 'x64', ], 'libstdcpp_x64': ['debug_bot', 'x64', 'no_custom_libcxx'], 'mac_asan_clang_release_bot_x64': [ @@ -355,7 +394,13 @@ ['msan', 'clang', 'openh264', 'pure_release_bot', 'x64', 'h265'], 'no_h264_debug_bot_x86': ['debug_bot', 'x86'], 'openssl_x64': ['debug_bot', 'x64', 'no_build_ssl'], - 'perfetto_android_arm': [ 'android', 'arm', 'perfetto', 'release_bot'], + 'perfetto_android_arm': [ + 'android', + 'arm', + 'chromium_base_dependency', + 'perfetto', + 'release_bot' + ], 'perfetto_x64': [ 'x64', 'perfetto', 'release_bot'], 'perfetto_x86': [ 'x86', 'perfetto', 'release_bot'], 'pure_release_bot_x64': ['openh264', 'pure_release_bot', 'x64', 'h265'], @@ -366,8 +411,14 @@ 'release_bot_x64_fuchsia': ['openh264', 'release_bot', 'x64', 'fuchsia', 'h265'], 'release_bot_x86': ['openh264', 'release_bot', 'x86', 'h265'], - 'rtti_no_sctp_android_arm': - ['android', 'debug_static_bot', 'arm', 'rtti', 'no_sctp'], + 'rtti_no_sctp_android_arm': [ + 'android', + 'arm', + 'chromium_base_dependency', + 'debug_static_bot', + 'no_sctp', + 'rtti', + ], 'rtti_no_sctp_no_unicode_win_x86': ['debug_bot', 'x86', 'rtti', 'no_sctp', 'win_undef_unicode'], 'rtti_no_sctp_x64': ['debug_bot', 'x64', 'rtti', 'no_sctp'], @@ -440,6 +491,10 @@ 'asan': { 'gn_args': 'is_asan=true', }, + # TODO(b/42223878): Remove this code when the dependency on base is gone. + 'chromium_base_dependency': { + 'mixins': ['enable_chromium_prelude', 'enable_rust'] + }, # is_clang=true by default, this is only to guard from upstream changes. 'clang': { 'gn_args': 'is_clang=true', @@ -468,6 +523,12 @@ 'dummy_audio_file_devices': { 'gn_args': 'rtc_use_dummy_audio_file_devices=true', }, + 'enable_chromium_prelude': { + 'gn_args': 'enable_chromium_prelude=true', + }, + 'enable_rust': { + 'gn_args': 'enable_rust=true enable_rust_cxx=true', + }, 'fuchsia': { 'gn_args': 'target_os="fuchsia"' }, @@ -484,7 +545,7 @@ 'gn_args': 'ios_code_signing_identity_description="Apple Development"', }, 'libfuzzer': { - # use_fuzztest_wrapper adds a dependency to //base. + # TODO(b/42223878): use_fuzztest_wrapper adds a dependency to //base. 'gn_args': 'use_libfuzzer=true use_fuzztest_wrapper=true', }, 'lsan': {