Skip to content

build: Simplify bazel command lines#1909

Merged
sayboras merged 3 commits into
mainfrom
build-simplify-comman-lines
May 20, 2026
Merged

build: Simplify bazel command lines#1909
sayboras merged 3 commits into
mainfrom
build-simplify-comman-lines

Conversation

@jrajahalme
Copy link
Copy Markdown
Member

@jrajahalme jrajahalme commented May 18, 2026

Move variables and options to .bazelrc files to simplify Bazel command lines. This makes local builds easier and allows for the explicit platform setting to be removed from local builds so that Bazel chooses the appropriate toolchain. For example, instead of:

CARGO_BAZEL_REPIN=true bazel test --platforms=//bazel:linux_aarch64 --config=release --extra_toolchains=//bazel/toolchains:all --repo_env=BAZEL_LLVM_PATH=/usr/lib/llvm-18 //tests/...

this can be used:

bazel test --config=release //tests/...

Change clang install to check the installed version and not issuing apt install if not needed. This gets around current upstream clang apt repo breakage with package version requirements.

Note that since --platforms option changed Bazel will build from scratch (once).

Remove the repeated bazel cargo repin by bringing the lock file into this repo and adding a new make target cargo-repin to update it when needed. This removes about 15 seconds from each bazel invocation.

Fix local build installation.

@jrajahalme jrajahalme requested a review from a team as a code owner May 18, 2026 14:49
@jrajahalme jrajahalme requested a review from sayboras May 18, 2026 14:49
@jrajahalme jrajahalme added the clean-up Changes not affecting release behavior (style, removal of deprecated or dead code) label May 18, 2026
Move variables and options to .bazelrc files to simplify Bazel command
lines. This makes local builds easier and allows for the explicit
platform setting to be removed from local builds so that Bazel chooses
the appropriate toolchain. For example, instead of:

CARGO_BAZEL_REPIN=true bazel test --platforms=//bazel:linux_aarch64 --config=release --extra_toolchains=//bazel/toolchains:all --repo_env=BAZEL_LLVM_PATH=/usr/lib/llvm-18 //tests/...

this can be used:

bazel test --config=release //tests/...

Change clang install to check the installed version and not issuing apt
install if not needed. This gets around current upstream clang apt repo
breakage with package version requirements.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme jrajahalme force-pushed the build-simplify-comman-lines branch from 0b659df to 8237562 Compare May 18, 2026 15:33
Avoid bazel cargo repin on every bazel invocation, as it fetches
dependencies and adds ~15 seconds to each bazel invocation. Instead,
bring the Cargo.Bazel.lock file into bazel/ and update it only whne
needed. This is needed due to difference in bazel target names in
upstream Envoy repo vs. Envoy as a depndency being hashed in to the lock
file, so the upstream hash never matches.

Add a new make target "cargo-repin" to update the checked in lock
file. This needs to be done if bazel ever complains about hash not
matching, e.g., when upstream rust dependencies change.

Avoid performing bazel query for TIDY_SOURCES on each make invocation by
removing it from compile_commands.json dependencies. This only affects
local builds, as compile_commands.json is not part of the repo (it is in
.gitignore) so that fresh builds (e.g., in CI) always create this file
on-demand. New dependencies make it very likely that it is refreshed when
needed even locally.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
mv or install do not work properly with file system mounted from the host
to a VM, at least on a Lima VM there are permissions errors. Replace mv
with combo of rm/cp/chmod to resolve this.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Copy link
Copy Markdown
Contributor

@nezdolik nezdolik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@sayboras sayboras merged commit c342d67 into main May 20, 2026
9 of 10 checks passed
@sayboras sayboras deleted the build-simplify-comman-lines branch May 20, 2026 06:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clean-up Changes not affecting release behavior (style, removal of deprecated or dead code)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants