Skip to content

Conversation

rdesgroppes
Copy link

@rdesgroppes rdesgroppes commented Oct 7, 2025

This happens on Windows when using the buildifier_test macro:

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
+ ...  -clike 'WORKSPACE.*.oss' }; 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.

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.
@rdesgroppes rdesgroppes force-pushed the fix-findstr-cannot-open-manifest branch from 603adc7 to 3be1fd0 Compare October 7, 2025 16:25
rdesgroppes added a commit to DataDog/datadog-agent that referenced this pull request Oct 14, 2025
### What does this PR do?
Applies 2 more patches that were submitted upstream:
- bazelbuild/buildtools#1399
- bazelbuild/buildtools#1400

### Motivation
1. `buildifier` macro: its implementation and Windows runner script
template ignore excluded patterns as of today,
2. `buildifier_test` macro: the Windows runner script template doesn't
consider the `bazel`-provided manifest file.

### Describe how you validated your changes
Local Windows VM (QEMU/virt-manager).

### Additional Notes
`bazel run //bazel/buildifier` takes [2
minutes](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1177131952#L77-L78)
on Windows:
1. they're spawning a nested powershell and then use a "manual"
recursion from within, which could be optimized => later effort,
2. as Tony mentioned at multiple occasions, we should only run
`buildifier` on modified files => again, later effort.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant