Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: convert forward slashes to backslashes for protoc plugins on Windows. #668

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

willjschmitt
Copy link
Contributor

Fixes #667

This takes the approach rules_proto_grpc does to detect if we are building on Windows via the host_path_separator. protoc will fail to call into the plugins if they are expressed to protoc as forward-slash paths. Alternatively, we could make this more limited like my patch in the linked issue to check .bat file extensions, which is fragile in its own way, but works for the given use case.


Changes are visible to end-users: no

Test plan

  • Manual testing; please provide instructions so we can reproduce: check out https://github.com/AchilleaResearch/rules_ts_667 on Windows and bazel build //:foo_ts_pb. This PR's change is a patch in that repo, so I could also change that to directly use my commit instead, if preferred

There aren't any tests as far as I can tell currently for ts_proto_library, so my manual test is the best I can currently offer, and it's not clear if the Windows test runners are fully active, but I'd be happy to write a test for initial coverage on ts_proto_library if desired

@CLAassistant
Copy link

CLAassistant commented Aug 6, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

aspect-workflows bot commented Aug 13, 2024

Test

All tests were cache hits

150 tests (100.0%) were fully cached saving 9s.


Buildifier      Format

@jbedard
Copy link
Member

jbedard commented Sep 21, 2024

Would you be able to add some initial ts_proto_library tests? It would be great to merge some tests in and then try to reproduce+fix the windows after 🙏

@willjschmitt
Copy link
Contributor Author

Rebased, and the unit test that would repro and show this PR improving things is f00e046 in #671

willjschmitt and others added 3 commits November 12, 2024 14:48
…dows.

Fixes aspect-build#667

This takes the approach used [elsewhere in rules_ts](https://github.com/aspect-build/rules_ts/blob/da284adac1fcb6bd9da81ce5d4b3e29660ecface/ts/private/ts_project.bzl#L80) to detect if we are building on Windows. protoc will fail to call into the plugins if they are expressed to protoc as forward-slash paths.
@willjschmitt willjschmitt force-pushed the fix/667/windows-backslashes-ts_proto_library branch from 461bb13 to 03327a1 Compare November 12, 2024 22:48
@willjschmitt
Copy link
Contributor Author

Now that #671 is merged in, I rebased and the same unit test should apply, showing a noop on Linux and now should work on Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants