rules_ts icon indicating copy to clipboard operation
rules_ts copied to clipboard

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

Open willjschmitt opened this issue 1 year ago • 5 comments

Fixes https://github.com/aspect-build/rules_ts/issues/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

willjschmitt avatar Aug 06 '24 23:08 willjschmitt

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 06 '24 23:08 CLAassistant

Test

All tests were cache hits

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


Buildifier      Format

aspect-workflows[bot] avatar Aug 13 '24 01:08 aspect-workflows[bot]

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 🙏

jbedard avatar Sep 21 '24 00:09 jbedard

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

willjschmitt avatar Nov 04 '24 22:11 willjschmitt

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

willjschmitt avatar Nov 12 '24 22:11 willjschmitt

Any chance this can be re-reviewed based on my last comment in reply to adding test coverage?

willjschmitt avatar May 15 '25 22:05 willjschmitt

Were we never able to get a test failing on windows? But the PR lgtm I think, especially now that we have some better coverage. Sorry for missing your last comment :/

jbedard avatar May 26 '25 16:05 jbedard

Test

All tests were cache hits

173 tests (100.0%) were fully cached saving 8s.


Buildifier      Format

aspect-workflows[bot] avatar May 28 '25 18:05 aspect-workflows[bot]