Skip to content

Commit 1b5a241

Browse files
committed
BATMAN
0 parents  commit 1b5a241

13 files changed

+87
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bazel-*

MODULE.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"Your one stop shop for hermetic c/c++ toolchains in Bazel!"
2+
module(name = "toolchains_cc")
3+
4+
bazel_dep(name = "rules_cc", version = "0.1.1")
5+
bazel_dep(name = "platforms", version = "0.0.11")

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# toolchains_cc
2+
3+
Your one stop shop for default, hermetic c/c++ toolchains in Bazel!
4+
5+
This package:
6+
* is easy to configure,
7+
* supports linux, macos, and windows bazel builds,
8+
* supports clang, gcc, and msvc compiler toolchains,
9+
* supports x86_64 and arm64,
10+
* has low overhead on CI runs, and
11+
* enables remote caching to further speed up your development and CI.

bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
$(dirname $(readlink -f "$0"))/tools/bazel "$@"

bazel.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@ECHO OFF
2+
"%~dp0tools\bazel.bat" %*

tools/bazel

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Determine OS type
4+
OS="$(uname -s)"
5+
case "$OS" in
6+
Linux)
7+
OS="linux"
8+
;;
9+
Darwin)
10+
OS="darwin"
11+
;;
12+
*)
13+
echo "Unsupported operating system: $OS"
14+
exit 1
15+
;;
16+
esac
17+
18+
# Determine architecture
19+
ARCH="$(uname -m)"
20+
case "$ARCH" in
21+
x86_64)
22+
ARCH="amd64"
23+
;;
24+
arm64|aarch64)
25+
ARCH="arm64"
26+
;;
27+
*)
28+
echo "Unsupported architecture: $ARCH"
29+
exit 1
30+
;;
31+
esac
32+
33+
# Construct the path to the Bazelisk binary
34+
DIRNAME=$(dirname $(readlink -f "$0"))
35+
BAZELISK_BINARY="${DIRNAME}/bazelisk-${OS}-${ARCH}"
36+
37+
# Check if the binary exists
38+
if [ ! -x "$BAZELISK_BINARY" ]; then
39+
echo "Bazelisk binary not found or not executable: $BAZELISK_BINARY"
40+
exit 1
41+
fi
42+
43+
# Run the Bazelisk binary
44+
exec "$BAZELISK_BINARY" "$@"

tools/bazel.bat

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
REM Detect system architecture using environment variable
5+
if /i "%PROCESSOR_ARCHITECTURE%"=="ARM64" (
6+
set "bazelisk=%~dp0bazelisk-windows-arm64.exe"
7+
) else (
8+
set "bazelisk=%~dp0bazelisk-windows-amd64.exe"
9+
)
10+
11+
REM Check if the executable exists
12+
if not exist "%bazelisk%" (
13+
echo Error: %bazelisk% not found.
14+
echo Detected architecture: %PROCESSOR_ARCHITECTURE%
15+
echo Please ensure the appropriate Bazelisk executable is available.
16+
exit /b 1
17+
)
18+
19+
REM Execute Bazelisk with all arguments passed to this script
20+
"%bazelisk%" %*
21+
22+
exit /b %ERRORLEVEL%

tools/bazelisk-darwin-amd64

5.7 MB
Binary file not shown.

tools/bazelisk-darwin-arm64

5.57 MB
Binary file not shown.

tools/bazelisk-linux-amd64

5.71 MB
Binary file not shown.

0 commit comments

Comments
 (0)