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

Target dir for input:git_repo #3152

Closed
hollyhox-21 opened this issue Jul 12, 2024 · 4 comments
Closed

Target dir for input:git_repo #3152

hollyhox-21 opened this issue Jul 12, 2024 · 4 comments

Comments

@hollyhox-21
Copy link

Feature

Please add the target directory where the compiled proto file will be placed

  - git_repo: "https://github.com/some-repo.git"
    branch: master
    subdir: endpoints
    target: pkg/some_dir/some_grpc_services
@hollyhox-21 hollyhox-21 added the Feature New feature or request label Jul 12, 2024
@bufdev
Copy link
Member

bufdev commented Jul 12, 2024

We do not understand what you are asking for - output locations are specified in the plugins configuration, not the inputs. Can you clarify?

@bufdev bufdev added Needs clarification and removed Feature New feature or request labels Jul 12, 2024
@hollyhox-21
Copy link
Author

hollyhox-21 commented Jul 12, 2024

I mean override out for input git_repo. I want to compile outside proto files. And use their for create client.
For example: There is service A(go) and service B(java). Both are gRPCs. Service B is a client of service A. I want to generate .pb files through my plugins.

I want to see that view:

**buf.gen.yaml:**
version: v2
plugins:
  - remote: buf.build/protocolbuffers
    out: pkg/api
    opt:
      - paths=source_relative
inputs:
  - directory: api
  - git_repo: "https://github.com/serviceA.git"
     branch: master
     subdir: api
     out: pkg/remote_api
     
     
.
├── api
│ └── serviceB
│     └── foo.proto
├── pkg
│ ├── api
│ │ └── serviceB
│ │     ├── foo.pb.java
│ │     ├── foo.pb.gw.java
│ │     ├── foo.swagger.json
│ │     └── foo_grpc.pb.java
│ └── remote_api
│         └── api
│                 └── serviceA
│                         ├── bar.pb.java
│                         ├── bar.pb.gw.java
│                         ├── bar.swagger.json
│                         └── bar_grpc.pb.java
└── tree.txt

@bufdev
Copy link
Member

bufdev commented Jul 12, 2024

I still don't understand. Can you create an example repository with what you want to see, and the output?

@doriable
Copy link
Member

The inputs key in buf.gen.yaml currently does not interact with the plugins key -- the destination of your output is configured in plugins on a per-plugin basis, and then each plugin is applied to each input.

If you want a different plugin configuration, our current guidance is to define a second file, e.g. buf.remote.gen.yaml, and have your the remote repository you are targeting and plugin configurations, e.g.

**buf.gen.yaml:**

version: v2
plugins:
  - remote: buf.build/protocolbuffers
    out: pkg/api
    opt:
      - paths=source_relative
inputs:
  - directory: api

**buf.remote.gen.yaml:**
version: v2
plugins:
  - remote: buf.build/protocolbuffers
    out: pkg/remote_api
    opt:
      - paths=source_relative
  - git_repo: "https://github.com/serviceA.git"
     branch: master
     subdir: api

And then you can use the second file with buf generate --template buf.remote.gen.yaml.

We have similar requests in the past, #3060, I can close this as a duplicate and we can combine the discussions. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants