| 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. |
| 4 |
build --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 |
| 8 |
build --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. |
| 11 |
build --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. |
| 15 |
build --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. |
| 19 |
build --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. |
| 28 |
build --extra_toolchains=//toolchain:clang_ios_arm64_toolchain |
| 29 |
build --extra_toolchains=//toolchain:clang_linux_x64_toolchain |
| 30 |
build --extra_toolchains=//toolchain:clang_mac_x64_toolchain |
| 31 |
build --extra_toolchains=//toolchain:clang_mac_arm64_toolchain |
| 32 |
build --extra_toolchains=//toolchain:clang_host_mac_x64_target_mac_arm64_toolchain |
| 33 |
build --extra_toolchains=//toolchain:clang_host_mac_arm64_target_mac_x64_toolchain |
| 34 |
build --extra_toolchains=//toolchain:clang_windows_x64_toolchain |
| 35 |
build --extra_toolchains=//toolchain:linux_amd64_ndk_arm64_toolchain |
| 36 |
build --extra_toolchains=//toolchain:linux_amd64_ndk_arm32_toolchain |
| 37 |
|
| 38 |
# Hide DEBUG messages from Bazel. |
| 39 |
# Many of these are things related to the git checkouts that are not relevent to devs. |
| 40 |
# https://bazel.build/reference/command-line-reference#flag--ui_event_filters |
| 41 |
build --ui_event_filters=-debug |
| 42 |
|
| 43 |
# For some reason, since upgrading to Go v1.21 and rules_go v0.42.0, Go binaries fail at runtime |
| 44 |
# with "fatal error: invalid function symbol table" unless we disable cgo via the below flag. |
| 45 |
# Reference: |
| 46 |
# https://github.com/bazelbuild/rules_go/blob/d74d9ab34e8789e6a55a2d9caf0e2b3c63202e04/go/modes.rst#build-settings. |
| 47 |
build --@rules_go//go/config:pure |
| 48 |
|
| 49 |
# ============================================================================= |
| 50 |
# Alias to build configurations below. This makes configuring things from |
| 51 |
# the command line easier. |
| 52 |
|
| 53 |
# Public CanvasKit flags |
| 54 |
build --flag_alias=ck_enable_fonts=//modules/canvaskit:enable_fonts |
| 55 |
build --flag_alias=ck_disable_fonts=no//modules/canvaskit:enable_fonts |
| 56 |
build --flag_alias=ck_enable_canvas_polyfill=//modules/canvaskit:enable_canvas_polyfill |
| 57 |
build --flag_alias=ck_disable_canvas_polyfill=no//modules/canvaskit:enable_canvas_polyfill |
| 58 |
build --flag_alias=ck_enable_embedded_font=//modules/canvaskit:include_embedded_font |
| 59 |
build --flag_alias=ck_disable_embedded_font=no//modules/canvaskit:include_embedded_font |
| 60 |
build --flag_alias=ck_enable_matrix_js=//modules/canvaskit:include_matrix_js |
| 61 |
build --flag_alias=ck_disable_matrix_js=no//modules/canvaskit:include_matrix_js |
| 62 |
build --flag_alias=ck_enable_skottie=//modules/canvaskit:enable_skottie |
| 63 |
build --flag_alias=ck_disable_skottie=no//modules/canvaskit:enable_skottie |
| 64 |
build --flag_alias=ck_enable_skp_serialization=//modules/canvaskit:enable_skp_serialization |
| 65 |
build --flag_alias=ck_disable_skp_serialization=no//modules/canvaskit:enable_skp_serialization |
| 66 |
build --flag_alias=ck_enable_runtime_effect=//modules/canvaskit:enable_runtime_effect |
| 67 |
build --flag_alias=ck_disable_runtime_effect=no//modules/canvaskit:enable_runtime_effect |
| 68 |
build --flag_alias=ck_enable_webgl=//modules/canvaskit:enable_webgl |
| 69 |
build --flag_alias=ck_exclude_debugger=no//modules/canvaskit:build_for_debugger |
| 70 |
build --flag_alias=ck_include_debugger=//modules/canvaskit:build_for_debugger |
| 71 |
|
| 72 |
# ============================================================================= |
| 73 |
# REMOTE BUILD EXECUTION |
| 74 |
# ============================================================================= |
| 75 |
|
| 76 |
# ===== |
| 77 |
# The following was copied from https://github.com/bazelbuild/bazel-toolchains/blob/ea243d43269df23de03a797cff2347e1fc3d02bb/bazelrc/bazel-4.1.0.bazelrc |
| 78 |
# We should be free to modify this as we see fit. |
| 79 |
# |
| 80 |
# Depending on how many machines are in the remote execution instance, setting |
| 81 |
# this higher can make builds faster by allowing more jobs to run in parallel. |
| 82 |
# Setting it too high can result in jobs that timeout, however, while waiting |
| 83 |
# for a remote machine to execute them. |
| 84 |
build:remote --jobs=50 |
| 85 |
|
| 86 |
# Set several flags related to specifying the platform, toolchain and java |
| 87 |
# properties. |
| 88 |
build:remote --java_runtime_version=rbe_jdk |
| 89 |
build:remote --tool_java_runtime_version=rbe_jdk |
| 90 |
|
| 91 |
# When a remote configuration is chosen, add "remote" to the list of spawn_strategies. |
| 92 |
build:remote --spawn_strategy=remote,sandboxed,local |
| 93 |
|
| 94 |
# Enable remote execution so actions are performed on the remote systems. |
| 95 |
build:remote --remote_executor=grpcs://remotebuildexecution.googleapis.com |
| 96 |
|
| 97 |
# Some long running tasks are linking because the workers have relatively little RAM |
| 98 |
# (at least as of now). |
| 99 |
build:remote --remote_timeout=300 |
| 100 |
|
| 101 |
# Enable authentication. This will pick up application default credentials by |
| 102 |
# default. You can use --google_credentials=some_file.json to use a service |
| 103 |
# account credential instead. |
| 104 |
# See https://developers.google.com/remote-build-execution/docs/authentication |
| 105 |
# To authenticate, you should run gcloud auth application-default login |
| 106 |
build:remote --google_default_credentials=true |
| 107 |
|
| 108 |
# End of the copied RBE settings |
| 109 |
#===== |
| 110 |
|
| 111 |
# Use the RBE instance on the skia-rbe GCP project. |
| 112 |
build:remote --remote_instance_name projects/skia-rbe/instances/default_instance |
| 113 |
|
| 114 |
# The linxu_rbe config will build on RBE and default to compiling for linux_x64 using |
| 115 |
# the hermetic toolchain. |
| 116 |
build:linux_rbe --config=remote |
| 117 |
# On the RBE instances, we also have the Java and C++ toolchain from the Docker image available. |
| 118 |
# These need to come after the --extra_toolchains flags (above) that register our hermetic |
| 119 |
# toolchains, because we only want these backup toolchains to be used by Bazel internals, |
| 120 |
# if at all. |
| 121 |
build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/java:all |
| 122 |
build:linux_rbe --extra_toolchains=//bazel/rbe/gce_linux/config:cc-toolchain |
| 123 |
# Make the Linux platform available for selection as an Execution platform (if it is not already, |
| 124 |
# e.g. on a Linux host) |
| 125 |
build:linux_rbe --extra_execution_platforms=//bazel/platform:linux_x64_hermetic |
| 126 |
|
| 127 |
# Import our specified build configurations |
| 128 |
# https://docs.bazel.build/versions/main/best-practices.html#using-the-bazelrc-file |
| 129 |
# We chose to split our build configurations into their own file to have better organization |
| 130 |
# because we anticipate that file growing large. |
| 131 |
import %workspace%/bazel/buildrc |
| 132 |
|
| 133 |
# Device-specific configurations. |
| 134 |
import %workspace%/bazel/devicesrc |
| 135 |
|
| 136 |
# Import User's custom builds if they have defined any |
| 137 |
try-import %workspace%/bazel/user/buildrc |