Skip to content

Commit eebe916

Browse files
Fix antlr4-cpp-runtime VERSION filename collision on Windows
On case-insensitive filesystems (Windows), antlr4-cpp-runtime's VERSION file collides with C++ standard library <version> header, causing build failures. Adding powershell-based patch_win_cmds to correctly rename it inside Windows Kokoro builds. Also, fix syntax errors introduced in the previous commit. PiperOrigin-RevId: 922465750
1 parent 78b2d31 commit eebe916

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

MODULE.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ bazel_dep(name = "rules_python", version = "1.9.0")
5151
single_version_override(
5252
module_name = "antlr4-cpp-runtime",
5353
patch_cmds = [
54-
"mv VERSION VERSION.txt || true",
55-
"mv version version.txt || true",
54+
"python3 -c \"import os; [os.rename(f, f + '.txt') for f in ['VERSION', 'version'] if os.path.exists(f)]\" || python -c \"import os; [os.rename(f, f + '.txt') for f in ['VERSION', 'version'] if os.path.exists(f)]\"",
5655
],
5756
)
5857

release/kokoro/presubmit_windows.bat

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ setlocal enabledelayedexpansion
1919

2020
set "IN_PRESUBMIT=1"
2121
set "PRESUBMIT_STATUS=0"
22+
set "FETCH_RETRIES=10"
23+
set "FETCH_RETRY_DELAY_S=10"
2224
if "%PYTHON_VERSIONS%" == "" (
2325
set "PYTHON_VERSIONS=3.11"
2426
)
@@ -53,18 +55,18 @@ for %%V in (%PYTHON_VERSIONS%) do (
5355
set ATTEMPTS=0
5456
:fetch_loop
5557
set /a ATTEMPTS+=1
56-
echo Fetch attempt !ATTEMPTS! of %FETCH_RETRIES%...
58+
echo Fetch attempt !ATTEMPTS! of !FETCH_RETRIES!...
5759
bazel %STARTUP_FLAGS% fetch //... > fetch.log 2>&1
5860
set FETCH_STATUS=!ERRORLEVEL!
5961
type fetch.log
6062
if !FETCH_STATUS! NEQ 0 (
6163
findstr /i "timeout timed" fetch.log >nul
6264
if !ERRORLEVEL! EQU 0 (
63-
if !ATTEMPTS! LSS %FETCH_RETRIES% (
64-
echo Fetch failed with timeout. Retrying in %FETCH_RETRY_DELAY_S% seconds...
65+
if !ATTEMPTS! LSS !FETCH_RETRIES! (
66+
echo Fetch failed with timeout. Retrying in !FETCH_RETRY_DELAY_S! seconds...
6567
:: Use ping instead of timeout because timeout command fails in non-interactive Kokoro environments
6668
:: with "ERROR: Input redirection is not supported, exiting the process immediately."
67-
set /a PINGS=%FETCH_RETRY_DELAY_S%+1
69+
set /a PINGS=!FETCH_RETRY_DELAY_S!+1
6870
ping -n !PINGS! 127.0.0.1 >nul
6971
goto fetch_loop
7072
)

release/kokoro/set_env_windows.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ echo Python Version Selected: %PYTHON_VERSION%
5353
:: Detect Python executable first (needed for downloading BCR assets dynamically)
5454
set PYTHON_EXE=python
5555
where python%PYTHON_VERSION% >nul 2>&1
56-
if !ERRORLEVEL! EQU 0 (
56+
if %ERRORLEVEL% EQU 0 (
5757
set PYTHON_EXE=python%PYTHON_VERSION%
5858
) else if exist C:\Python%PY_VER_NO_DOT%\python.exe (
5959
set PYTHON_EXE=C:\Python%PY_VER_NO_DOT%\python.exe

0 commit comments

Comments
 (0)