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

Use path-to-underscore when generating files with the plugin #47

Merged
merged 4 commits into from
Feb 24, 2025

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Feb 18, 2025

Motivation:

The build system can't compile the code generated by the plugin when
different proto files with the same name are used. This is allowed and
expected if the files are in different proto packages.

Modifications:

  • Use the "path to underscore" naming scheme instead of the "full path"
    naming scheme. This changes path components to underscores, so
    "foo/bar/baz.proto" would have "foo_bar_baz.grpc.swift" generated for
    it.
  • Uncomment test.

Result:

Test passes.

Motivation:

The SwiftPM build plugin doesn't currently handle proto files with the
same name even if they come from different packages. This happens
because the build system cannot handle object files with the same name.
This change adds such a test while tidying up some of the plugin test
code.

Modifications:

- Divide up test resources in sources, config, and proto directories.
- Have one function per test
- Document each test with the expected structure
- Add another test but don't run it. (It fails.)

Result:

More tests. The issue will be fixed in a separate change.
Motivation:

The build system can't compile the code generated by the plugin when
different proto files with the same name are used. This is allowed and
expected if the files are in different proto packages.

Modifications:

- Use the "path to underscore" naming scheme instead of the "full path"
  naming scheme. This changes path components to underscores, so
  "foo/bar/baz.proto" would have "foo_bar_baz.grpc.swift" generated for
  it.
- Uncomment test.

Result:

Test passes.
@glbrntt
Copy link
Collaborator Author

glbrntt commented Feb 18, 2025

This is a follow up to #46 so ignore the first few commits. I'll fixup this PR once #46 is merged.

The relevant changes are in 4e864e0

@glbrntt glbrntt added 🔨 semver/patch No public API change. kind/bug Feature doesn't work as expected. labels Feb 18, 2025
@glbrntt glbrntt requested a review from gjcairo February 18, 2025 18:54
@glbrntt glbrntt merged commit 64f97e9 into grpc:main Feb 24, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected. 🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants