diff --git a/otel_sdk_build.cmd b/otel_sdk_build.cmd index 4463cfeef5..2a0f499c5a 100644 --- a/otel_sdk_build.cmd +++ b/otel_sdk_build.cmd @@ -5,11 +5,17 @@ set BAZEL_SH= set BAZEL_VC= set BAZEL_VC_FULL_VERSION= +for /F "delims=" %%i in ("%ComSpec%") do set __COMSPEC_DIR__=%%~dpi +if "%__COMSPEC_DIR__%"=="" goto:no-comspec + +for /F "usebackq delims=" %%i in (`where python`) do set __PYTHON_DIR__=%%~dpi +if "%__PYTHON_DIR__%"=="" goto:no-python + rem Look first for bazelisk, then bazel -for /F "usebackq" %%i in (`where bazelisk bazel`) do set __BAZEL__=%%i +for /F "usebackq delims=" %%i in (`where bazelisk bazel`) do set __BAZEL__=%%i if "%__BAZEL__%"=="" goto:no-bazel -set PATH=c:\windows\system32;c:\program files\python312 +set PATH=%__COMSPEC_DIR__%;%__PYTHON_DIR__% pushd "%~dp0" "%__BAZEL__%" build -k --//:with_dll=true ... @@ -36,7 +42,15 @@ endlocal goto:eof :no-bazel -echo FAILED: No bazel.exe found! +echo FAILED: No bazelisk or bazel found! +goto:eof + +:no-python +echo FAILED: No python found! +goto:eof + +:no-comspec +echo FAILED: No ComSpec env var set! goto:eof :error