Skip to content
This repository was archived by the owner on Apr 16, 2020. It is now read-only.
This repository was archived by the owner on Apr 16, 2020. It is now read-only.

tower-grpc-build does not support packages nested under a root package #85

@kevindrosendahl

Description

@kevindrosendahl

Hi, I've been able to reproduce an issue I've seen with generating services based on a package that contains a service under its root, and messages consumed by the service under sub-packages in the same package.

I've added a test case to reproduce the issue here: https://github.com/kevindrosendahl/tower-grpc/tree/2816fe19250c80612bca5af8fb5bd72497e77de1/tests/nested-package

It's the same test case as collide except that all of the other messages all exist in the hello
top level package (e.g. proto/common.proto is in package hello.common instead of common, proto/nested.proto is in package hello.common.nested).

Here is a gist of the output when running cargo build -p nested-package as well as the generated hello.rs: https://gist.github.com/kevindrosendahl/ebee338f5e8d84fefca8f8eb0fd8a428

From a read over the output, it appears that there are two issues at play:

  1. Import name conflict (https://gist.github.com/kevindrosendahl/ebee338f5e8d84fefca8f8eb0fd8a428#file-hello-rs-L9 and https://gist.github.com/kevindrosendahl/ebee338f5e8d84fefca8f8eb0fd8a428#file-hello-rs-L11 both imported as HelloRequest)
  2. The import for the methods trait appears to be looking for the common module in the server module rather than its parent, as the server module is properly doing (https://gist.github.com/kevindrosendahl/ebee338f5e8d84fefca8f8eb0fd8a428#file-hello-rs-L265).

I'm not sure how trivial this is to fix. If it seems like it may be a bit involved and you're unable to prioritize it, I can potentially try looking into contributing a solution in the coming weeks, but would probably need some guidance.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions