Skip to content

Commit 005f50b

Browse files
committed
[build] 03-05-25 Bazel cleanup
- It turns out that Bazel never uses the CXX env variable – when we need to specify the right path to clang, providing CC is sufficient - For some V8 dependencies, replace googlesource mirror with the GitHub repository itself - Drop superfluous repo_mapping and Windows overrides that are no longer needed for V8
1 parent e896a4f commit 005f50b

File tree

7 files changed

+20
-25
lines changed

7 files changed

+20
-25
lines changed

Diff for: .bazelrc

+3-7
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ build:windows --host_copt='-Wno-macro-redefined'
116116
build:windows --per_file_copt='external/dawn@-Wno-unknown-argument'
117117
build:windows --host_per_file_copt='external/dawn@-Wno-unknown-argument'
118118

119-
# V8 now requires Windows 10, Bazel fails to set this properly.
120-
build:windows --per_file_copt=external/v8/src/base/platform/platform-win32.cc@-D_WIN32_WINNT=0x0A00
121-
build:windows --host_per_file_copt=external/v8/src/base/platform/platform-win32.cc@-D_WIN32_WINNT=0x0A00
122-
123119
# typescript configuration
124120
# do more correct type checking
125121
common --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
@@ -206,9 +202,9 @@ build:unix --workspace_status_command=./tools/unix/workspace-status.sh
206202
build:unix --cxxopt='-std=c++20' --host_cxxopt='-std=c++20'
207203
build:unix --@capnp-cpp//src/kj:libdl=True
208204

205+
# Bazel uses CC to compile C and C++ actions, no need to define CXX.
209206
build:unix --action_env=BAZEL_COMPILER=clang
210207
build:unix --action_env=CC=clang
211-
build:unix --action_env=CXX=clang++
212208

213209
build:unix --test_env=LLVM_SYMBOLIZER=llvm-symbolizer
214210

@@ -301,8 +297,8 @@ build:windows --enable_runfiles
301297
# `#pragma once` when using symlinked virtual includes, `__atomic_*` functions,
302298
# a standards-compliant preprocessor, support for GNU statement expressions
303299
# used by some KJ macros, and understands the `.c++` extension by default.
304-
# As of bazel 7, incompatible_enable_cc_toolchain_resolution is enabled by default, so we need to
305-
# define a platform for the clang-cl build.
300+
# As of bazel 7, toolchain resolution is enabled by default, so we need to define a platform for
301+
# the clang-cl build.
306302
build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl
307303
build:windows --extra_execution_platforms=//:x64_windows-clang-cl
308304

Diff for: .github/workflows/release-python-runtime.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
chmod +x llvm.sh
2828
sudo ./llvm.sh 16
2929
sudo apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev
30-
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
31-
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
30+
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
31+
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
3232
- name: Configure download mirrors
3333
shell: bash
3434
run: |

Diff for: .github/workflows/release.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ jobs:
118118
chmod +x llvm.sh
119119
sudo ./llvm.sh 16
120120
sudo apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev
121-
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
122-
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
121+
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
122+
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
123123
- name: Setup macOS
124124
if: runner.os == 'macOS'
125125
run: |
@@ -297,8 +297,8 @@ jobs:
297297
chmod +x llvm.sh
298298
sudo ./llvm.sh 16
299299
sudo apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev
300-
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
301-
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
300+
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
301+
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
302302
- name: Build type generating Worker
303303
run: |
304304
bazel build --disk_cache=~/bazel-disk-cache --strip=always --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci --config=release_linux //types:types_worker
@@ -358,8 +358,8 @@ jobs:
358358
chmod +x llvm.sh
359359
sudo ./llvm.sh 16
360360
sudo apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev
361-
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
362-
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
361+
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
362+
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
363363
- name: build types
364364
run: |
365365
bazel build --disk_cache=~/bazel-disk-cache --strip=always --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci --config=release_linux //types:types

Diff for: .github/workflows/type-snapshot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
chmod +x llvm.sh
4343
sudo ./llvm.sh 16
4444
sudo apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev
45-
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
46-
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
45+
echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
46+
echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
4747
- name: build types
4848
run: |
4949
bazel build --disk_cache=~/bazel-disk-cache --strip=always --remote_cache=https://bazel:${{ secrets.BAZEL_CACHE_KEY }}@bazel-remote-cache.devprod.cloudflare.dev --config=ci --config=release_linux //types:types

Diff for: Dockerfile.release

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ RUN ./llvm.sh 16
1616
RUN apt-get install -y --no-install-recommends clang-16 lld-16 libunwind-16 libc++abi1-16 libc++1-16 libc++-16-dev libclang-rt-16-dev
1717
COPY . .
1818

19-
RUN echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
20-
RUN echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++" >> .bazelrc
19+
RUN echo "build:linux --action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
20+
RUN echo "build:linux --host_action_env=CC=/usr/lib/llvm-16/bin/clang >> .bazelrc
2121
COPY .bazel-cache /bazel-disk-cache
2222
# pnpm version will be different depending on the value of `packageManager` field in package.json
2323
RUN npm install -g pnpm@latest

Diff for: WORKSPACE

+3-4
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,20 @@ git_repository(
147147
include_prefix = "third_party/fast_float/src",
148148
)""",
149149
commit = "cb1d42aaa1e14b09e1452cfdef373d051b8c02a4",
150-
remote = "https://chromium.googlesource.com/external/github.com/fastfloat/fast_float.git",
150+
remote = "https://github.com/fastfloat/fast_float.git",
151151
)
152152

153153
git_repository(
154154
name = "fp16",
155155
build_file_content = "exports_files(glob([\"**\"]))",
156156
commit = "0a92994d729ff76a58f692d3028ca1b64b145d91",
157-
remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
157+
remote = "https://github.com/Maratyszcza/FP16.git",
158158
)
159159

160160
git_repository(
161161
name = "highway",
162162
commit = "00fe003dac355b979f36157f9407c7c46448958e",
163-
remote = "https://chromium.googlesource.com/external/github.com/google/highway.git",
163+
remote = "https://github.com/google/highway.git",
164164
)
165165

166166
# OK, now we can bring in tcmalloc itself.
@@ -337,7 +337,6 @@ new_local_repository(
337337
deps = [ "@v8//:v8_icu", "@workerd//:icudata-embed" ],
338338
visibility = ["//visibility:public"])""",
339339
path = "empty",
340-
repo_mapping = {"@abseil-cpp": "@com_google_absl"},
341340
)
342341

343342
# rust-based lolhtml dependency, including the API header.

Diff for: build/ci.bazelrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ build:ci-linux-common --copt='-Werror'
5050
build:ci-linux-common --copt='-Wno-error=#warnings'
5151
build:ci-linux-common --copt='-Wno-error=deprecated-declarations'
5252
# keep in sync with .github/workflows/test.yml
53-
build:ci-linux-common --action_env=CC=/usr/lib/llvm-16/bin/clang --action_env=CXX=/usr/lib/llvm-16/bin/clang++
54-
build:ci-linux-common --host_action_env=CC=/usr/lib/llvm-16/bin/clang --host_action_env=CXX=/usr/lib/llvm-16/bin/clang++
53+
build:ci-linux-common --action_env=CC=/usr/lib/llvm-16/bin/clang
54+
build:ci-linux-common --host_action_env=CC=/usr/lib/llvm-16/bin/clang
5555

5656
build:ci-linux --config=ci-linux-common
5757
build:ci-linux-arm --config=ci-linux --remote_download_regex=".*src/workerd/server/workerd.*"

0 commit comments

Comments
 (0)