Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jul 21, 2025

Motivation:

protoc requires the import path (-I/--import-path) to be an exact prefix of the input files. The plugin currently uses the absolute path of a file for input paths without modifying the import path.

The result of this is that the user must always specify an absolute import path (because the default chosen by is protoc is ".").

Modifications:

  • Use the relative path for input files (this will be whatever the user provides, which may be an absolute path) rather than the absolute path which will get the full absolute path even if the user specified "foo.proto" as input.

Result:

Users can do: swift package generate-grpc-code-from-protos foo.proto

Motivation:

protoc requires the import path (-I/--import-path) to be an exact prefix
of the input files. The plugin currently uses the absolute path of a
file for input paths without modifying the import path.

The result of this is that the user must always specify an absolute
import path (because the default chosen by is protoc is ".").

Modifications:

- Use the relative path for input files (this will be whatever the user
  provides, which may be an absolute path) rather than the absolute path
  which will get the full absolute path even if the user specified
  "foo.proto" as input.

Result:

Users can do: swift package generate-grpc-code-from-protos foo.proto
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Jul 21, 2025
@glbrntt glbrntt merged commit 2f5ef06 into grpc:main Jul 21, 2025
32 checks passed
@glbrntt glbrntt deleted the relative-import-path branch July 21, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants