Skip to content

Commit

Permalink
WIP: Bump bazelversion to 7.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
matte1 committed Apr 28, 2024
1 parent f3b1d9b commit be62a02
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ build:rbe --jobs=32
# BuildBuddy remote exec
build:rbe --remote_executor=grpcs://remote.buildbuddy.io

# Disable bazelmod
common --noenable_bzlmod


try-import %workspace%/.bazelrc.user
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.0
7.0.2
27 changes: 14 additions & 13 deletions toolchain/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -157,60 +157,61 @@ gcc_toolchain = repository_rule(

def _render_tool_paths(rctx, repository_name, toolchain_files_repository_name, binary_prefix):
relative_tool_paths = {
"ar": "external/{repository_name}/bin/{binary_prefix}-linux-ar".format(
"ar": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-ar".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"as": "external/{repository_name}/bin/{binary_prefix}-linux-as".format(
"as": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-as".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"cpp": "external/{repository_name}/bin/{binary_prefix}-linux-cpp".format(
"cpp": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-cpp".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"g++": "external/{repository_name}/bin/{binary_prefix}-linux-g++".format(
"g++": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-g++".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"gcc": "external/{repository_name}/bin/{binary_prefix}-linux-gcc".format(
"gcc": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-gcc".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"gcov": "external/{repository_name}/bin/{binary_prefix}-linux-gcov".format(
"gcov": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-gcov".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"gfortran": "external/{repository_name}/bin/{binary_prefix}-linux-gfortran".format(
"gfortran": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-gfortran".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"ld": "external/{repository_name}/bin/{binary_prefix}-linux-ld".format(
"ld": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-ld".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"nm": "external/{repository_name}/bin/{binary_prefix}-linux-nm".format(
"nm": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-nm".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"objcopy": "external/{repository_name}/bin/{binary_prefix}-linux-objcopy".format(
"objcopy": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-objcopy".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"objdump": "external/{repository_name}/bin/{binary_prefix}-linux-objdump".format(
"objdump": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-objdump".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
"strip": "external/{repository_name}/bin/{binary_prefix}-linux-strip".format(
"strip": "bazel-working-directory/gcc_toolchain/external/{repository_name}/bin/{binary_prefix}-linux-strip".format(
repository_name = toolchain_files_repository_name,
binary_prefix = binary_prefix,
),
}

path_env = ":".join([
"${{EXECROOT}}/external/{}/bin".format(repository)
"${{EXECROOT}}/bazel-working-directory/gcc_toolchain/external/{}/bin".format(repository)
for repository in [repository_name, toolchain_files_repository_name]
])
print(path_env)

tool_paths = {}
for name, tool_path in relative_tool_paths.items():
Expand Down
14 changes: 14 additions & 0 deletions toolchain/wrapper.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,20 @@ set -o errexit -o nounset -o pipefail
# symlinks of the BASH_SOURCE[0] is more reliable than navigating to the
# execroot from $PWD. This is due to the fact that the Bazel C++ toolchain can
# be called from different working directories (e.g. rules_foreign_cc rules).
# EXECROOT="${EXECROOT:-"$(realpath "$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../")"}"
EXECROOT="${EXECROOT:-"$(realpath "$(dirname "$(realpath "${BASH_SOURCE[0]}")")/../../..")"}"

echo "EXECROOT: ${EXECROOT}"
# ls -lh "${EXECROOT}"
# ls -lh "${EXECROOT}/bazel-execroot/gcc_toolchain"
# ls -lh "${EXECROOT}/bazel-source-roots"
# ls -lh "${EXECROOT}/bazel-working-directory/gcc_toolchain/external"
# ls -lh "${EXECROOT}/bazel-working-directory/gcc-toolchain"
# echo "BINARY: __binary__"
# echo "Running: ${EXECROOT}/__binary__ ${args[@]}"
echo "PATH = __PATH__"
# ls -lh /tmp/external/

export EXECROOT
export PATH="__PATH__"
args=("$@")
Expand All @@ -44,4 +57,5 @@ for i in "${!args[@]}"; do
fi
done


exec "${EXECROOT}/__binary__" "${args[@]}"

0 comments on commit be62a02

Please sign in to comment.