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