1# https://bazel.build/concepts/platforms-intro#cxx 2# This forces Bazel's C++ rules use platforms to select toolchains instead of the default 3# --crosstool_top, --compiler, etc. 4build --incompatible_enable_cc_toolchain_resolution 5 6# We do not want Bazel to detect any C++ toolchains on the local machine 7# https://github.com/bazelbuild/bazel/blob/4ccc21f2f089971e5f4032397764a4be3549c40a/tools/cpp/cc_configure.bzl#L47 8build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 9 10# We would like developers to not upload to the remote build cache, only the RBE workers themselves. 11build --remote_upload_local_results=false 12 13# Enforce stricter environment rules, which eliminates some non-hermetic behavior and therefore 14# improves both the remote cache hit rate and the correctness and repeatability of the build. 15build --incompatible_strict_action_env=true 16 17# This tells Bazel that the host platform can use the hermetic toolchain. This is a small lie until 18# Windows support is added. 19build --host_platform=//bazel/platform:host_with_hermetic_toolchain 20# Linux users (the only platform where we support remote builds currently) can add the following 21# line (uncommented) to //bazel/user/buildrc to allow interchangeable operation between local 22# operations and remote operations. 23# build --host_platform=//bazel/platform:linux_x64_hermetic 24 25# Register our toolchains. We do this here, and not in WORKSPACE.bazel because 26# --extra_toolchains has priority over register_toolchains and we conditionally add some toolchains 27# for RBE. 28build --extra_toolchains=//toolchain:clang_linux_x64_toolchain 29build --extra_toolchains=//toolchain:clang_mac_x64_toolchain 30build --extra_toolchains=//toolchain:clang_mac_arm64_toolchain 31build --extra_toolchains=//toolchain:clang_host_mac_x64_target_mac_arm64_toolchain 32build --extra_toolchains=//toolchain:linux_amd64_ndk_arm64_toolchain 33build --extra_toolchains=//toolchain:linux_amd64_ndk_arm32_toolchain 34 35# Hide DEBUG messages from Bazel. 36# Many of these are things related to the git checkouts that are not relevent to devs. 37# https://bazel.build/reference/command-line-reference#flag--ui_event_filters 38build --ui_event_filters=-debug 39 40# For some reason, since upgrading to Go v1.21 and rules_go v0.42.0, Go binaries fail at runtime 41# with "fatal error: invalid function symbol table" unless we disable cgo via the below flag. 42# Reference: 43# https://github.com/bazelbuild/rules_go/blob/d74d9ab34e8789e6a55a2d9caf0e2b3c63202e04/go/modes.rst#build-settings. 44build --@io_bazel_rules_go//go/config:pure 45 46# ============================================================================= 47# Alias to build configurations below. This makes configuring things from 48# the command line easier. 49# 50# NOTE: Add new enable flags which build new source files, and need to be 51# included when exporting to other projects (CMake, GNI), to 52# //bazel/exporter/bazel_query_command.go. 53# Public string flags 54build --flag_alias=gpu_backend=//src/gpu:gpu_backend 55build --flag_alias=include_decoder=//src/codec:include_decoder 56build --flag_alias=include_encoder=//src/encode:include_encoder 57build --flag_alias=include_fontmgr=//bazel/common_config_settings:include_fontmgr 58build --flag_alias=with_gl_standard=//src/gpu:with_gl_standard 59 60# Public boolean flags 61build --flag_alias=disable_discardable_memory=no//src/lazy:enable_discardable_memory 62build --flag_alias=enable_discardable_memory=//src/lazy:enable_discardable_memory 63build --flag_alias=disable_effect_serialization=no//bazel/common_config_settings:enable_effect_serialization 64build --flag_alias=enable_effect_serialization=//bazel/common_config_settings:enable_effect_serialization 65build --flag_alias=disable_legacy_shader_context=no//src/shaders:legacy_shader_context 66build --flag_alias=enable_legacy_shader_context=//src/shaders:legacy_shader_context 67build --flag_alias=disable_native_interface=no//src/gpu/ganesh/gl:enable_native_interface 68build --flag_alias=enable_native_interface=//src/gpu/ganesh/gl:enable_native_interface 69build --flag_alias=disable_pdf_backend=no//src/pdf:enable_pdf_backend 70build --flag_alias=enable_pdf_backend=//src/pdf:enable_pdf_backend 71build --flag_alias=disable_skslc=no//src/sksl:enable_skslc 72build --flag_alias=enable_skslc=//src/sksl:enable_skslc 73build --flag_alias=disable_svg_canvas=no//src/svg:enable_svg_canvas 74build --flag_alias=enable_svg_canvas=//src/svg:enable_svg_canvas 75build --flag_alias=disable_tracing=no//bazel/common_config_settings:enable_tracing 76build --flag_alias=enable_tracing=//bazel/common_config_settings:enable_tracing 77build --flag_alias=disable_vma=no//src/gpu:use_vulkan_memory_allocator 78build --flag_alias=enable_vma=//src/gpu:use_vulkan_memory_allocator 79build --flag_alias=with_default_global_memory_pool=//src/lazy:use_default_global_memory_pool 80build --flag_alias=with_no_global_memory_pool=no//src/lazy:use_default_global_memory_pool 81build --flag_alias=with_harfbuzz=//bazel/common_config_settings:use_harfbuzz 82build --flag_alias=with_fontations=//bazel/common_config_settings:use_fontations 83build --flag_alias=with_no_harfbuzz=no//bazel/common_config_settings:use_harfbuzz 84build --flag_alias=with_icu=//bazel/common_config_settings:use_icu 85build --flag_alias=with_no_icu=no//bazel/common_config_settings:use_icu 86build --flag_alias=enable_build_for_debugger=//bazel/common_config_settings:build_for_debugger 87build --flag_alias=disable_build_for_debugger=no//bazel/common_config_settings:build_for_debugger 88 89# Flags used by Skia tools, not to be used by clients 90build --flag_alias=disable_gpu_test_utils=no//src/gpu:enable_gpu_test_utils 91build --flag_alias=enable_gpu_test_utils=//src/gpu:enable_gpu_test_utils 92build --flag_alias=adb_platform=//tools/testrunners/common/android/adb_test_runner:adb_platform 93 94# Public CanvasKit flags 95build --flag_alias=ck_enable_fonts=//modules/canvaskit:enable_fonts 96build --flag_alias=ck_disable_fonts=no//modules/canvaskit:enable_fonts 97build --flag_alias=ck_enable_canvas_polyfill=//modules/canvaskit:enable_canvas_polyfill 98build --flag_alias=ck_disable_canvas_polyfill=no//modules/canvaskit:enable_canvas_polyfill 99build --flag_alias=ck_enable_embedded_font=//modules/canvaskit:include_embedded_font 100build --flag_alias=ck_disable_embedded_font=no//modules/canvaskit:include_embedded_font 101build --flag_alias=ck_enable_matrix_js=//modules/canvaskit:include_matrix_js 102build --flag_alias=ck_disable_matrix_js=no//modules/canvaskit:include_matrix_js 103build --flag_alias=ck_enable_skottie=//modules/canvaskit:enable_skottie 104build --flag_alias=ck_disable_skottie=no//modules/canvaskit:enable_skottie 105build --flag_alias=ck_enable_skp_serialization=//modules/canvaskit:enable_skp_serialization 106build --flag_alias=ck_disable_skp_serialization=no//modules/canvaskit:enable_skp_serialization 107build --flag_alias=ck_enable_runtime_effect=//modules/canvaskit:enable_runtime_effect 108build --flag_alias=ck_disable_runtime_effect=no//modules/canvaskit:enable_runtime_effect 109build --flag_alias=ck_enable_webgl=//modules/canvaskit:enable_webgl 110 111# ============================================================================= 112# REMOTE BUILD EXECUTION 113# ============================================================================= 114 115# ===== 116# The following was copied from https://github.com/bazelbuild/bazel-toolchains/blob/ea243d43269df23de03a797cff2347e1fc3d02bb/bazelrc/bazel-4.1.0.bazelrc 117# We should be free to modify this as we see fit. 118# 119# Depending on how many machines are in the remote execution instance, setting 120# this higher can make builds faster by allowing more jobs to run in parallel. 121# Setting it too high can result in jobs that timeout, however, while waiting 122# for a remote machine to execute them. 123build:remote --jobs=50 124 125# Set several flags related to specifying the platform, toolchain and java 126# properties. 127build:remote --java_runtime_version=rbe_jdk 128build:remote --tool_java_runtime_version=rbe_jdk 129 130# When a remote configuration is chosen, add "remote" to the list of spawn_strategies. 131build:remote --spawn_strategy=remote,sandboxed 132 133# Enable remote execution so actions are performed on the remote systems. 134build:remote --remote_executor=grpcs://remotebuildexecution.googleapis.com 135 136# Some long running tasks are linking because the workers have relatively little RAM 137# (at least as of now). 138build:remote --remote_timeout=300 139 140# Enable authentication. This will pick up application default credentials by 141# default. You can use --google_credentials=some_file.json to use a service 142# account credential instead. 143# See https://developers.google.com/remote-build-execution/docs/authentication 144# To authenticate, you should run gcloud auth application-default login 145build:remote --google_default_credentials=true 146 147# End of the copied RBE settings 148#===== 149 150# Use the RBE instance on the skia-rbe GCP project. 151build:remote --remote_instance_name projects/skia-rbe/instances/default_instance 152 153# The linxu_rbe config will build on RBE and default to compiling for linux_x64 using 154# the hermetic toolchain. 155build:linux_rbe --config=remote 156# On the RBE instances, we also have the Java and C++ toolchain from the Docker image available. 157# These need to come after the --extra_toolchains flags (above) that register our hermetic 158# toolchains, because we only want these backup toolchains to be used by Bazel internals, 159# if at all. 160build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/java:all 161build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/config:cc-toolchain 162# Make the Linux platform available for selection as an Execution platform (if it is not already, 163# e.g. on a Linux host) 164build:linux_rbe --extra_execution_platforms=//bazel/platform:linux_x64_hermetic 165 166# Import our specified build configurations 167# https://docs.bazel.build/versions/main/best-practices.html#using-the-bazelrc-file 168# We chose to split our build configurations into their own file to have better organization 169# because we anticipate that file growing large. 170import %workspace%/bazel/buildrc 171 172# Device-specific configurations. 173import %workspace%/bazel/devicesrc 174 175# Import User's custom builds if they have defined any 176try-import %workspace%/bazel/user/buildrc 177