Skip to content

Add tools/sync-bazelversion.sh, commit results #1629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dt_patches/test_dt_patches/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.1
6.5.0
1 change: 1 addition & 0 deletions dt_patches/test_dt_patches_user_srcjar/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions examples/crossbuild/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions examples/scala3/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions examples/semanticdb/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions examples/testing/scalatest_repositories/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions examples/testing/specs2_junit_repositories/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
32 changes: 32 additions & 0 deletions scripts/sync-bazelversion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# Synchronizes .bazelversion in nested workspaces with the top level workspace.
#
# These could be symlinks, but that might break Windows users who don't know how
# to enable symlinks. Of course, they're programmers, they should learn, but
# avoiding surprises as a general principle is best.
#
# What would be ideal is the `import ../.bazelrc` syntax supported by Bazel, but
# Bazelisk doesn't currently support that.

ROOTDIR="${BASH_SOURCE[0]%/*}/.."
cd "$ROOTDIR"

if [[ "$?" -ne 0 ]]; then
echo "Could not change to $ROOTDIR." >&2
exit 1
elif [[ ! -r .bazelversion ]]; then
echo ".bazelversion doesn't exist or isn't readable in $PWD." >&2
exit 1
fi

while IFS="" read repo_marker_path; do
repo_path="${repo_marker_path%/*}"

# We search for WORKSPACE and MODULE.bazel instead of .bazelversion in case
# anyone adds new child repositories. But we need to guard against overwriting
# the top-level WORKSPACE and MODULE.bazel files.
if [[ "$repo_path" != "$repo_marker_path" ]]; then
cp .bazelversion "$repo_path"
fi
done < <(find [A-Za-z0-9]* \( -name "WORKSPACE*" -or -name "MODULE.bazel" \))
1 change: 1 addition & 0 deletions test_cross_build/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions test_version/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
1 change: 1 addition & 0 deletions third_party/test/proto/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0