Skip to content

Commit 3be1fd0

Browse files
committed
buildifier_test: fix FINDSTR: Cannot open MANIFEST
This happens on Windows when using `buildifier_test`: ``` INFO: Running command line: 'external\bazel_tools\tools\test\tw.exe' buildifier/test.bat Executing tests from //buildifier:test ----------------------------------------------------------------------------- FINDSTR: Cannot open MANIFEST The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object. At line:1 char:566 + ... (Should-Exclude $_.Path) }; foreach ($File in $Files) { & '' -mode=d ... + ~~ + CategoryInfo : InvalidOperation: (:String) [], RuntimeException + FullyQualifiedErrorId : BadExpression The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command [...] ``` The present change simply consists in giving a second try with `$RUNFILES_MANIFEST_FILE` and failing fast should both be absent.
1 parent 2eb4fcc commit 3be1fd0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

buildifier/runner.bat.template

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ rem Unquote the arguments
99
set stripped_args=%stripped_args:'=%
1010

1111
rem Get the absolute path to the buildifier executable
12-
for /f "tokens=2" %%i in ('findstr /r "\<buildifier\.exe\>" MANIFEST') do (set buildifier_abs_path=%%i)
12+
if exist MANIFEST (
13+
set manifest_file=MANIFEST
14+
) else if exist "%RUNFILES_MANIFEST_FILE%" (
15+
set "manifest_file=%RUNFILES_MANIFEST_FILE:/=\%"
16+
) else (
17+
>&2 echo Error: manifest file not found
18+
exit /b 1
19+
)
20+
for /f "tokens=2" %%i in ('findstr /r "\<buildifier\.exe\>" "%manifest_file%"') do (set buildifier_abs_path=%%i)
1321

1422
powershell ^
1523
function Buildify($Root)^

0 commit comments

Comments
 (0)