Skip to content

Commit a08be1f

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
Fix Windows bazel build by unsetting ANDROID_HOME
Prevent transitive rules_android dependency from attempting to configure an Android SDK repository on CI environments where ANDROID_HOME is set but contains an incompatible Android SDK build tools version. PiperOrigin-RevId: 934041346
1 parent 4414207 commit a08be1f

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# This allows Bazel to automatically pick up the `windows` config on Windows.
33
common --enable_platform_specific_config
44

5+
# Prevent rules_android (pulled in transitively) from attempting to configure an Android SDK repository
6+
# using the preinstalled Android SDK on CI machines (e.g. Kokoro Windows), which fails build tools version checks.
7+
common --repo_env=ANDROID_HOME=
8+
59
# Disable automatic creation of `__init__.py` files, which prevent multiple
610
# workspaces from providing files with the same package prefix (e.g., "cel").
711
# See https://github.com/bazelbuild/rules_python/issues/330.

release/kokoro/presubmit_windows.bat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ for %%V in (%PYTHON_VERSIONS%) do (
5656
:fetch_loop
5757
set /a ATTEMPTS+=1
5858
echo Fetch attempt !ATTEMPTS! of !FETCH_RETRIES!...
59-
bazel %STARTUP_FLAGS% fetch //... > fetch.log 2>&1
59+
bazel !STARTUP_FLAGS! fetch //... > fetch.log 2>&1
6060
set FETCH_STATUS=!ERRORLEVEL!
6161
type fetch.log
6262
if !FETCH_STATUS! NEQ 0 (
@@ -78,7 +78,7 @@ for %%V in (%PYTHON_VERSIONS%) do (
7878
if exist fetch.log del fetch.log
7979

8080
echo --- Getting Output Base ---
81-
for /f "tokens=*" %%i in ('bazel %STARTUP_FLAGS% info output_base') do set "OUTPUT_BASE=%%i"
81+
for /f "tokens=*" %%i in ('bazel !STARTUP_FLAGS! info output_base') do set "OUTPUT_BASE=%%i"
8282
set "OUTPUT_BASE=!OUTPUT_BASE:/=\!"
8383
echo Output Base: !OUTPUT_BASE!
8484

@@ -99,15 +99,15 @@ for %%V in (%PYTHON_VERSIONS%) do (
9999
)
100100

101101
echo --- Bazel Build ---
102-
bazel %STARTUP_FLAGS% build %LINK_FLAGS% //...
102+
bazel !STARTUP_FLAGS! build !LINK_FLAGS! //...
103103
if !ERRORLEVEL! NEQ 0 (
104104
echo Build failed!
105105
set "PRESUBMIT_STATUS=1"
106106
goto cleanup
107107
)
108108

109109
echo --- Bazel Test Python %%V ---
110-
bazel %STARTUP_FLAGS% test %LINK_FLAGS% --test_output=errors //...
110+
bazel !STARTUP_FLAGS! test !LINK_FLAGS! --test_output=errors //...
111111
if !ERRORLEVEL! NEQ 0 (
112112
echo Tests failed for Python %%V!
113113
set "PRESUBMIT_STATUS=1"

0 commit comments

Comments
 (0)