Skip to content

Commit 809f0b0

Browse files
committed
Replace hardcoded bazel-selenium references with dynamic path resolution (#16976)
* Replace hardcoded bazel-selenium references with dynamic path resolution * Validate bazel output_base before constructing external path * Fix EXEC_ROOT path resolution by following symlink before navigating * Use bazel info execution_root for reliable path resolution * Keep bazel-selenium in README for readability
1 parent e92a7dc commit 809f0b0

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,7 @@ rust/target
128128
rust/.idea
129129

130130
# Bazel stuff
131-
bazel-bin
132-
bazel-genfiles
133-
bazel-out
134-
bazel-selenium
135-
bazel-testlogs
131+
/bazel-*
136132
MODULE.bazel.lock
137133

138134
/.vscode/

dotnet/private/docfx.bzl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ def _docfx_impl(ctx):
3535
_UNIX_TEMPLATE = """#!/usr/bin/env bash
3636
set -euo pipefail
3737
cd "$BUILD_WORKSPACE_DIRECTORY"
38-
exec "$BUILD_WORKSPACE_DIRECTORY/bazel-selenium/{dotnet}" exec \
39-
"$BUILD_WORKSPACE_DIRECTORY/bazel-selenium/{docfx}" {config} "$@"
38+
EXEC_ROOT=$(bazel info execution_root)
39+
exec "$EXEC_ROOT/{dotnet}" exec \
40+
"$EXEC_ROOT/{docfx}" {config} "$@"
4041
"""
4142

4243
_WINDOWS_TEMPLATE = """@echo off
44+
setlocal
4345
cd /d "%BUILD_WORKSPACE_DIRECTORY%"
44-
"%BUILD_WORKSPACE_DIRECTORY%\\bazel-selenium\\{dotnet}" exec ^
45-
"%BUILD_WORKSPACE_DIRECTORY%\\bazel-selenium\\{docfx}" {config} %*
46+
for /f "tokens=*" %%i in ('bazel info execution_root') do set "EXEC_ROOT=%%i"
47+
"%EXEC_ROOT%\\{dotnet}" exec ^
48+
"%EXEC_ROOT%\\{docfx}" {config} %*
49+
endlocal
4650
"""
4751

4852
docfx = rule(

dotnet/update-deps.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44
REPO_ROOT="$SCRIPT_DIR/.."
55

6-
if [[ -d "$REPO_ROOT/bazel-selenium/external" ]]; then
7-
DOTNET_DIR=$(find "$REPO_ROOT/bazel-selenium/external" -maxdepth 1 -name "rules_dotnet++dotnet+dotnet_*" -type d | head -1)
6+
OUTPUT_BASE=$(cd "$REPO_ROOT" && bazel info output_base 2>/dev/null)
7+
if [[ -n "$OUTPUT_BASE" && -d "$OUTPUT_BASE/external" ]]; then
8+
EXTERNAL_DIR="$OUTPUT_BASE/external"
9+
DOTNET_DIR=$(find "$EXTERNAL_DIR" -maxdepth 1 -name "rules_dotnet++dotnet+dotnet_*" -type d 2>/dev/null | head -1)
810
if [[ -n "$DOTNET_DIR" && -x "$DOTNET_DIR/dotnet" ]]; then
911
DOTNET="$DOTNET_DIR/dotnet"
1012
echo "Using bazel-managed dotnet: $DOTNET"
1113
fi
14+
else
15+
echo "Warning: bazel info output_base failed; falling back to system dotnet" >&2
1216
fi
1317
DOTNET="${DOTNET:-dotnet}"
1418

0 commit comments

Comments
 (0)