Generate sources from IDL
Mu can generate code from a number of different IDL formats:
- message classes, gRPC server and client from Protobuf
.proto
files (see Generating sources from Protocol Buffers for detailed instructions) - message classes, gRPC server and client from Avro
.avpr
or.avdl
files (see Generating sources from Avro)
Plugin Installation
Add the following line to project/plugins.sbt
:
addSbtPlugin("io.higherkindness" % "sbt-mu-srcgen" % "0.31.1")
And enable the plugin on the appropriate project(s):
enablePlugins(SrcGenPlugin)
How to use the plugin
The plugin will automatically integrate its source generation into your compile
process, so the sources are generated before compilation when you run the
compile
task.
You can also run the sbt task manually. To generate code from Avro IDL files:
sbt muSrcGen
Or for Protobuf:
sbt protocGenerate
Import
If you want to customize the plugin’s configuration, you will need to add this
import at the top of your build.sbt
:
import higherkindness.mu.rpc.srcgen.Model._
Settings
For an explanation of the plugin’s settings, see the source generation reference.