Skip to content

Add windows support#1011

Merged
vladmos merged 4 commits intobazelbuild:masterfrom
PatriceVignola:add-windows-support2
Jan 23, 2024
Merged

Add windows support#1011
vladmos merged 4 commits intobazelbuild:masterfrom
PatriceVignola:add-windows-support2

Conversation

@PatriceVignola
Copy link
Contributor

This PR adds Windows support to call bazel run //:buildifier without needing msys2 workarounds by adding a native .bat file. This should address issues that have been opened a while ago: #770 and #346

for /f "tokens=2" %%i in ('findstr /r "\<buildifier\.exe\>" MANIFEST') do (set buildifier_abs_path=%%i)

powershell ^
function Buildify($Root)^
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buildifier has the -r flag to recursively find all relevant files within a directory, maybe it makes sense to reuse it? The built-in recursive function can ignore some paths (currently just .git, but may support .buildifierignore in the future, see #801), I think it's better to have such logic defined once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the Linux version does it recursively by default, without needing the -r flag. I think the Windows and Linux versions should have the same behavior.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it had been implemented this way before the -r flag was introduced. I can fix it later, but won't be able to fix the windows version easily because don't have a windows machine around. So I suggest using -r from the beginng.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do I use the -r flag with bazel run //:buildifier? I'm able to use it with the standalone executable but not as a bazel rule.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted on #1136 that the -r flag also does not match the same set of files. The set used by the runner template is more complete. Ideally, those should probably be aligned, but I'd be in favor of merging this in for running on Windows first.

@craigmparis
Copy link

This would be very useful for me. Is there any progress on this?

@limdor
Copy link
Contributor

limdor commented Jan 1, 2024

What is the status of this PR? Any news?

@vladmos
Copy link
Member

vladmos commented Jan 23, 2024

I agree for merging it now and fixing the behavior of recursive flags later, sorry for the delayed review.

@vladmos vladmos merged commit 304e38a into bazelbuild:master Jan 23, 2024
@limdor
Copy link
Contributor

limdor commented Jan 23, 2024

Cool thanks. Any estimations for when is planned the next release @vladmos?

@limdor
Copy link
Contributor

limdor commented Apr 3, 2024

I'm not sure if I'm the only one but for me it does not seem to work the autodetection of being on windows
https://ci.appveyor.com/project/limdor/bazel-examples/builds/49536214/job/q3jx26k4anwxip9u
I need to investigate a bit more what the problem might be.

@limdor
Copy link
Contributor

limdor commented Apr 7, 2024

@PatriceVignola @vladmos I'm not sure how this was validated but to me it does not work unless I remove the declaration of the bash file in Windows
#1262

@vladmos
Copy link
Member

vladmos commented Apr 12, 2024

@limdor Sorry, the previous internal import with incompatible formatting rules took longer than expected. I'll cut a new release next Monday.

Also I've just merged #1262, could you please validate the issue is resolved for you? I don't have a Windows machine at the moment.

@limdor
Copy link
Contributor

limdor commented Apr 12, 2024

With #1262 it works for me.

apattidb pushed a commit to databricks/buildtools that referenced this pull request May 10, 2024
* Add Windows Support

* Add Windows Support

* Revert line ending change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants