-
Notifications
You must be signed in to change notification settings - Fork 202
Build toolchain-examples #1971
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
Build toolchain-examples #1971
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,3 +23,4 @@ rust-project.json | |
| darwin.bazelrc | ||
| nativelink.bazelrc | ||
| integration_tests/**/*.log | ||
| toolchain-examples/*.log | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,6 @@ | ||
| # Don't use the host's default PATH and LD_LIBRARY_PATH. | ||
| build --incompatible_strict_action_env | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This causes |
||
| # Use rules_python's builtin script to emulate a bootstrap python. | ||
| build --@rules_python//python/config_settings:bootstrap_impl=script | ||
|
|
||
| # Toolchain to verify remote execution with zig-cc. | ||
| build:zig-cc --platforms @zig_sdk//platform:linux_amd64 | ||
| build:zig-cc --platforms @zig_sdk//platform:linux_amd64 | ||
|
|
||
| # These toolchains map out everything in | ||
| # https://github.com/uber/hermetic_cc_toolchain/blob/bfc407599e503a44928a3cefad27421c9341eff0/MODULE.bazel#L44 | ||
| # | ||
|
|
@@ -75,7 +68,6 @@ build:zig-cc --extra_toolchains @zig_sdk-macos-amd64//libc_aware/toolchain:linux | |
| build:zig-cc --extra_toolchains @zig_sdk-macos-amd64//toolchain:wasip1_wasm | ||
|
|
||
| # Toolchain to verify remote execution with contrib/toolchains_llvm. | ||
| build:llvm --platforms=@toolchains_llvm//platforms:linux-x86_64 | ||
| build:llvm --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux | ||
|
|
||
| # Java runtime to ensure hermeticity on the remote. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,10 +4,10 @@ module( | |
| compatibility_level = 0, | ||
| ) | ||
|
|
||
| bazel_dep(name = "platforms", version = "0.0.11") | ||
| bazel_dep(name = "platforms", version = "1.0.0") | ||
|
|
||
| # C++ | ||
| bazel_dep(name = "rules_cc", version = "0.1.1") | ||
| bazel_dep(name = "rules_cc", version = "0.1.5") | ||
|
|
||
| # Java | ||
| bazel_dep(name = "rules_java", version = "8.11.0") | ||
|
|
@@ -34,7 +34,16 @@ python.toolchain( | |
| use_repo(pip, "pip") | ||
|
|
||
| # Go | ||
| bazel_dep(name = "rules_go", version = "0.53.0") | ||
| bazel_dep(name = "rules_go", version = "0.57.0") | ||
|
|
||
| # Adds https://github.com/bazel-contrib/rules_go/commit/74199c92e20399b6ef46684b2c6fdd94b50a7892 | ||
| # to fix bash issues with Nix | ||
| archive_override( | ||
| module_name = "rules_go", | ||
| integrity = "sha256-ukyyC80j4VhRCD7DOaenkk41Vvnmsp7uAfHr4lxdXtQ=", | ||
| strip_prefix = "rules_go-74199c92e20399b6ef46684b2c6fdd94b50a7892", | ||
| urls = ["https://github.com/bazel-contrib/rules_go/archive/74199c92e20399b6ef46684b2c6fdd94b50a7892.zip"], | ||
| ) | ||
|
|
||
| # Rust | ||
| bazel_dep(name = "rules_rust", version = "0.61.0") | ||
|
|
@@ -89,8 +98,5 @@ bazel_dep(name = "abseil-cpp", version = "20250127.0") | |
| # Abseil for python | ||
| bazel_dep(name = "abseil-py", version = "2.1.0") | ||
|
|
||
| # GRPC | ||
| bazel_dep(name = "grpc", version = "1.71.0") | ||
|
|
||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dropping this as we don't test it and it's not in the docs |
||
| # Circl (Go, C++) | ||
| bazel_dep(name = "circl", version = "1.3.8") | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| { | ||
| nativelink, | ||
| writeShellScriptBin, | ||
| bazelisk, | ||
| }: | ||
| writeShellScriptBin "rbe-toolchain-test" '' | ||
| set -uo pipefail | ||
|
|
||
| cleanup() { | ||
| local pids=$(jobs -pr) | ||
| [ -n "$pids" ] && kill $pids | ||
| } | ||
| trap "cleanup" INT QUIT TERM EXIT | ||
|
|
||
| NO_COLOR=true ${nativelink}/bin/nativelink -- toolchain-examples/nativelink-config.json5 | tee -i toolchain-examples/nativelink.log & | ||
|
|
||
| CORE_BAZEL_ARGS="--check_direct_dependencies=error --remote_cache=grpc://localhost:50051 --remote_executor=grpc://localhost:50051" | ||
|
|
||
| CPU_TYPE=$(uname -m) | ||
|
|
||
| if [[ "$CPU_TYPE" == 'x86_64' ]]; then | ||
| PLATFORM='amd64' | ||
| else | ||
| PLATFORM='arm64' | ||
| fi | ||
|
|
||
| LLVM_PLATFORM="--platforms=@toolchains_llvm//platforms:linux-''${CPU_TYPE}" | ||
| ZIG_PLATFORM="--platforms @zig_sdk//platform:linux_''${PLATFORM}" | ||
|
|
||
| # As per https://nativelink.com/docs/rbe/remote-execution-examples#minimal-example-targets | ||
| COMMANDS=("test //cpp $ZIG_PLATFORM" | ||
| "test //cpp --config=llvm $LLVM_PLATFORM" | ||
| "test //python" | ||
| "test //go $ZIG_PLATFORM" | ||
| # "test //rust $ZIG_PLATFORM" # rules_rust isn't RBE-compatible | ||
| "test //java:HelloWorld --config=java" | ||
| "build @curl//... $ZIG_PLATFORM" | ||
| "build @zstd//... $ZIG_PLATFORM" | ||
| # "test @abseil-cpp//... $ZIG_PLATFORM" # Buggy build due to google_benchmark errors | ||
| "test @abseil-py//..." | ||
| "test @circl//... $ZIG_PLATFORM" | ||
| ) | ||
|
|
||
| echo "" > toolchain-examples/cmd.log | ||
| for cmd in "''${COMMANDS[@]}" | ||
| do | ||
| FULL_CMD="${bazelisk}/bin/bazelisk $cmd $CORE_BAZEL_ARGS" | ||
| echo $FULL_CMD | ||
| echo -e \\n$FULL_CMD\\n >> toolchain-examples/cmd.log | ||
| cmd_output=$(cd toolchain-examples && eval "$FULL_CMD" 2>&1 | tee -ai cmd.log) | ||
| cmd_exit_code=$? | ||
| case $cmd_exit_code in | ||
| 0 ) | ||
| echo "Saw a successful $cmd build" | ||
| ;; | ||
| *) | ||
| echo "Failed $cmd build:" | ||
| echo $cmd_output | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| nativelink_output=$(cat toolchain-examples/nativelink.log) | ||
|
|
||
| case $nativelink_output in | ||
| *"ERROR "* ) | ||
| echo "Error in nativelink build" | ||
| exit 1 | ||
| ;; | ||
| *) | ||
| echo 'Successful nativelink build' | ||
| ;; | ||
| esac | ||
| '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various upgrades were done for improved Nix compatibility, plus things that transitively depended on those.