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

BE: issues/711: Normalize path for proto schemas locations for Windows OS #712

Closed

Conversation

DimaVilda
Copy link
Contributor

@DimaVilda DimaVilda commented Dec 15, 2024

  • Breaking change? (if so, please describe the impact and migration path for existing application instances)

What changes did you make? (Give an overview)
A change is related to #711 issue.

Problem:

  • The ProtoFile imports and Location paths don't work correctly on Windows due to path separator differences
  • Windows uses backslashes () while proto imports consistently use forward slashes (/)
  • This causes multiple NPEs when running tests on Windows

Solution:

  • Base and relative path are normalized from Windows style (C:\path\to) to Unix style (C:/path/to) so Location.get(...) method can correctly parse them.

Is there anything you'd like reviewers to focus on?

How Has This Been Tested? (put an "x" (case-sensitive!) next to an item)

  • No need to
  • Manually (please, describe, if necessary)
  • Unit checks
  • Integration checks
  • Covered by existing automation

Checklist (put an "x" (case-sensitive!) next to all the items, otherwise the build will fail)

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (e.g. ENVIRONMENT VARIABLES)
  • My changes generate no new warnings (e.g. Sonar is happy)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Check out Contributing and Code of Conduct

A picture of a cute animal (not mandatory but encouraged)

@DimaVilda DimaVilda requested a review from a team as a code owner December 15, 2024 15:24
@kapybro kapybro bot added status/triage Issues pending maintainers triage status/triage/manual Manual triage in progress status/triage/completed Automatic triage completed and removed status/triage Issues pending maintainers triage labels Dec 15, 2024
@DimaVilda
Copy link
Contributor Author

hey peeps!
Did a small fix related to #261
We can keep is as a tempo solution because after my investigation I realized that the problem is on library side. I tried to upgrade 'wire' to latest 5.0.0 version but it didn't help.

I created a MR to their source code to fix their issue and described a problem. Check:
square/wire#3215

Hope they will merge it and we can pull it up later. However I am not sure we can do it pretty soon.

@@ -411,7 +411,10 @@ private Map<String, ProtoFile> loadFilesWithLocations() {
// relative path will be used as "import" statement
String relativePath = baseLocation.relativize(path).toString();
var protoFileElement = ProtoParser.Companion.parse(
Location.get(baseLocation.toString(), relativePath),
Location.get(
Copy link
Member

Choose a reason for hiding this comment

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

Hi, thanks for the PR.
This is what I meant in #696 (comment). This feels like a hacky solution aiming to fix the tests on Windows. In the end, there are built-in APIs in io/nio that we'd like to use if there's a need.
it's been discussed here before: #261 (comment)
Considering this is a bug in wire, I'd wait for it to get fixed so we don't have to resort to such solutions.

Let me know what you think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, we can wait for some fix from 'wire' side and I understnand that it looks hacky, that is why I higlighted this approach as tempo in comments. Feel free to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/triage/completed Automatic triage completed status/triage/manual Manual triage in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants