1
- # Based on https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/bazel-0.10.0.bazelrc
1
+ # https://github.com/bazelbuild/bazel-toolchains/blob/master/bazelrc/bazel-0.15.0.bazelrc
2
+ # Copyright 2016 The Bazel Authors. All rights reserved.
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.
2
15
16
+ # This .bazelrc file contains all of the flags required for the toolchain,
17
+ # Remote Build Execution, and the Bazel Build Results UI. Specific flags in
18
+ # your Bazel command allow you to use only the remote build, to use only the
19
+ # results UI, or to use them both together.
20
+ #
21
+ # This .bazelrc file also contains all of the flags required for the local
22
+ # docker sandboxing.
23
+
24
+ # Remote Build Execution requires a strong hash function, such as SHA256.
3
25
startup --host_jvm_args=-Dbazel.DigestFunction=SHA256
4
26
5
- # Auth
6
- build:remote --auth_enabled=true
7
- build:remote --auth_scope=https://www.googleapis.com/auth/cloud-platform
8
- build:remote --tls_enabled=true
27
+ # Depending on how many machines are in the remote execution instance, setting
28
+ # this higher can make builds faster by allowing more jobs to run in parallel.
29
+ # Setting it too high can result in jobs that timeout, however, while waiting
30
+ # for a remote machine to execute them.
31
+ build:remote --jobs=50
9
32
10
- # RBE Toolchains
11
- build:remote --experimental_strict_action_env=true
12
- build:remote --experimental_remote_platform_override='properties:{ name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-debian8@sha256:d84a7de5175a22505209f56b02f1da20ccec64880da09ee38eaef3670fbd2a56" }'
13
- build:remote --crosstool_top=@bazel_toolchains//configs/debian8_clang/0.3.0/bazel_0.10.0:toolchain
14
- build:remote --host_java_toolchain=@bazel_toolchains//configs/debian8_clang/0.3.0:jdk8
15
- build:remote --host_javabase=@bazel_toolchains//configs/debian8_clang/0.3.0:jdk8
16
- build:remote --javabase=@bazel_toolchains//configs/debian8_clang/0.3.0:jdk8
33
+ # Set several flags related to specifying the platform, toolchain and java
34
+ # properties.
35
+ # These flags are duplicated rather than imported from (for example)
36
+ # %workspace%/configs/ubuntu16_04_clang/1.0/toolchain.bazelrc to make this
37
+ # bazelrc a standalone file that can be copied more easily.
38
+ # These flags should only be used as is for the rbe-ubuntu16-04 container
39
+ # and need to be adapted to work with other toolchain containers.
40
+ build:remote --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:jdk8
41
+ build:remote --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:jdk8
42
+ build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
43
+ build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
44
+ build:remote --crosstool_top=@bazel_toolchains//configs/ubuntu16_04_clang/1.0/bazel_0.15.0/default:toolchain
45
+ build:remote --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
46
+ # Platform flags:
47
+ # The toolchain container used for execution is defined in the target indicated
48
+ # by "extra_execution_platforms", "host_platform" and "platforms".
49
+ # If you are using your own toolchain container, you need to create a platform
50
+ # target with "constraint_values" that allow for the toolchain specified with
51
+ # "extra_toolchains" to be selected (given constraints defined in
52
+ # "exec_compatible_with").
53
+ # More about platforms: https://docs.bazel.build/versions/master/platforms.html
54
+ build:remote --enabled_toolchain_types=@bazel_tools//tools/cpp:toolchain_type
55
+ build:remote --extra_toolchains=@bazel_toolchains//configs/ubuntu16_04_clang/1.0/bazel_0.15.0/cpp:cc-toolchain-clang-x86_64-default
56
+ build:remote --extra_execution_platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604
57
+ build:remote --host_platform=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604
58
+ build:remote --platforms=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604
17
59
18
- # RBE
19
- build:remote --remote_timeout=3600
20
- build:remote --remote_local_fallback=false
60
+ # Set various strategies so that all actions execute remotely. Mixing remote
61
+ # and local execution will lead to errors unless the toolchain and remote
62
+ # machine exactly match the host machine.
21
63
build:remote --spawn_strategy=remote
22
64
build:remote --strategy=Javac=remote
23
65
build:remote --strategy=Closure=remote
24
66
build:remote --genrule_strategy=remote
25
67
build:remote --define=EXECUTOR=remote
26
68
27
- # BRUI
28
- build:results --bes_timeout=10s
69
+ # Enable the remote cache so action results can be shared across machines,
70
+ # developers, and workspaces.
71
+ build:remote --remote_cache=remotebuildexecution.googleapis.com
72
+
73
+ # Enable remote execution so actions are performed on the remote systems.
74
+ build:remote --remote_executor=remotebuildexecution.googleapis.com
75
+
76
+ # Enable encryption.
77
+ build:remote --tls_enabled=true
78
+
79
+ # Enforce stricter environment rules, which eliminates some non-hermetic
80
+ # behavior and therefore improves both the remote cache hit rate and the
81
+ # correctness and repeatability of the build.
82
+ build:remote --experimental_strict_action_env=true
83
+
84
+ # Set a higher timeout value, just in case.
85
+ build:remote --remote_timeout=3600
86
+
87
+ # Enable authentication. This will pick up application default credentials by
88
+ # default. You can use --auth_credentials=some_file.json to use a service
89
+ # account credential instead.
90
+ build:remote --auth_enabled=true
91
+
92
+ # Set flags for uploading to BES in order to view results in the Bazel Build
93
+ # Results UI.
94
+ build:results --bes_backend="buildeventservice.googleapis.com"
95
+ build:results --bes_timeout=60s
96
+
97
+ # If the upload to BES fails, the build will fail.
29
98
build:results --bes_best_effort=false
99
+
100
+ # Output BES results url
101
+ build:results --bes_results_url="https://source.cloud.google.com/results/invocations/"
102
+
103
+ # Set flags for uploading to BES without Remote Build Execution.
104
+ build:results-local --bes_backend="buildeventservice.googleapis.com"
105
+ build:results-local --bes_timeout=60s
106
+ build:results-local --bes_best_effort=false
107
+ build:results-local --tls_enabled=true
108
+ build:results-local --auth_enabled=true
109
+ build:results-local --spawn_strategy=local
110
+ build:results-local --experimental_remote_spawn_cache
111
+ build:results-local --remote_cache=remotebuildexecution.googleapis.com
112
+ build:results-local --remote_timeout=3600
113
+ build:results-local --bes_results_url="https://source.cloud.google.com/results/invocations/"
114
+
115
+ # The following flags are only necessary for local docker sandboxing
116
+ # with the rbe-ubuntu16-04 container. Use of these flags is still experimental.
117
+ build:docker-sandbox --host_javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:jdk8
118
+ build:docker-sandbox --javabase=@bazel_toolchains//configs/ubuntu16_04_clang/1.0:jdk8
119
+ build:docker-sandbox --crosstool_top=@bazel_toolchains//configs/ubuntu16_04_clang/1.0/bazel_0.15.0/default:toolchain
120
+ build:docker-sandbox --experimental_docker_image=gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f
121
+ build:docker-sandbox --spawn_strategy=docker
122
+ build:docker-sandbox --strategy=Javac=docker
123
+ build:docker-sandbox --strategy=Closure=docker
124
+ build:docker-sandbox --genrule_strategy=docker
125
+ build:docker-sandbox --define=EXECUTOR=remote
126
+ build:docker-sandbox --experimental_docker_verbose
127
+ build:docker-sandbox --experimental_enable_docker_sandbox
128
+
129
+ # The following flags enable the remote cache so action results can be shared
130
+ # across machines, developers, and workspaces.
131
+ build:remote-cache --remote_cache=remotebuildexecution.googleapis.com
132
+ build:remote-cache --tls_enabled=true
133
+ build:remote-cache --experimental_strict_action_env=true
134
+ build:remote-cache --remote_timeout=3600
135
+ build:remote-cache --auth_enabled=true
136
+ build:remote-cache --spawn_strategy=standalone
137
+ build:remote-cache --strategy=Javac=standalone
138
+ build:remote-cache --strategy=Closure=standalone
139
+ build:remote-cache --genrule_strategy=standalone
0 commit comments