Skip to content

minimal Gradle buildscript to generate Kotlin GRPC stubs from protobuf code

License

Notifications You must be signed in to change notification settings

nmalkin/generate-kotlin-grpc-from-protos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal build.gradle.kts for compiling protos & generating Kotlin stub code for GRPC

This is a barebones repo showing how to generate Kotlin stub code and compile protos for GRPC from a Gradle buildscript (build.gradle.kts).

Here's what you need to do:

  1. Put your proto files in src/main/proto
  2. gradle generateProto
  3. Look for the generated files in build/generated/source/proto/main

Rationale

The official gRPC guide to Kotlin refers to the collection of gRPC Kotlin examples for compiling protos and generating stub code. However, the examples have several projects all together and are therefore kind of complicated. What is the minimal build.gradle.kts necessary to automatically generate proto code and stub methods? That is what this repo attempts to provide.

Notes

  • Newer versions of the plugins and dependencies may be available by the time you see this.
  • The Gradle buildscript includes just enough to generate the stub code. You'll need additional dependencies to compile them; at a minimum, the Kotlin and Protobuf libraries.

About

minimal Gradle buildscript to generate Kotlin GRPC stubs from protobuf code

Topics

Resources

License

Stars

Watchers

Forks