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

Auto-Compile .proto Files #1632

Open
i5kender opened this issue Jul 21, 2023 · 1 comment
Open

Auto-Compile .proto Files #1632

i5kender opened this issue Jul 21, 2023 · 1 comment
Labels

Comments

@i5kender
Copy link

What are you trying to achieve?

I can manually convert .proto files to .grpc.swift and .pb.swift files with gRPC-Swift-Plugins.
I would like to automate the whole process.

What have you tried so far?

1- I manually copied the .proto files into the project directory.
image

2- I created a build rules.
image

  1. The .grpc.swift and .pb.swift files are created during building.
    image

The build cannot be completed successfully and I get the following error.

error opening input file '/Library/Developer/Xcode/DerivedData/Smyrna-crvgddjdfhycebbfwtioteccgohr/Build/Intermediates.noindex/Smyrna.build/Debug-iphonesimulator/smyrna.build/DerivedSources/UserModel.grpc.swift' (No such file or directory)

In Addition,
When i try to create the file(UserModel.grpc.swift) manually it doesn't occur anyway.
protoc --grpc-swift_out=. UserModel.proto

I think, unable to create .grpc.swift file because it consists of model only.

How can I fix this error ?

Thanks

@FranzBusch
Copy link
Collaborator

The problem you are running into here is that we don't generate empty files when there are no service definitions in the proto file. We could certainly add an option to the plugin to always generate empty files even if there is no service definition in the proto file.
The code for this lives here: https://github.com/grpc/grpc-swift/blob/bf6065fc97c2ead57073d6d556cbb83daa60aa66/Sources/protoc-gen-grpc-swift/main.swift#L138C28-L138C28

Would you be open to raise a PR to add support for this?

Additionally, we would also recommend you to take a look at our SPM plugin and see if you could use that instead: https://github.com/grpc/grpc-swift/blob/main/Sources/protoc-gen-grpc-swift/Docs.docc/spm-plugin.md

@i5kender i5kender mentioned this issue Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants