-
-
Notifications
You must be signed in to change notification settings - Fork 414
scalapb-support-java-generation #5817
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
base: main
Are you sure you want to change the base?
scalapb-support-java-generation #5817
Conversation
5e06bff
to
4e8e912
Compare
|
||
object TutorialWithScalaAndJavaGen extends TutorialBase { | ||
object core extends TutorialModule { | ||
override def scalaPBGenerators = Seq[Generator](ScalaGen, JavaGen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like we need to explicitly define the type of the Seq here, otherwise upickle can't find the implicit reader.
although having a single value in there seems to work fine...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does making Generator
an enum fixes the issue?
@lefou could you help review this one? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This addition look good. I added some comments below.
Can you also update the plugin readme.adoc
which gets rendered as part of the documentation?
sealed trait Generator derives ReadWriter { | ||
def generator: String | ||
def supportsScalaPBOptions: Boolean | ||
} | ||
case object ScalaGen extends Generator { | ||
override def generator: String = "--scala_out" | ||
override def supportsScalaPBOptions: Boolean = true | ||
} | ||
case object JavaGen extends Generator { | ||
override def generator: String = "--java_out" | ||
override def supportsScalaPBOptions: Boolean = | ||
false // Java options are specified directly in the proto file | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this could be an enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you define Generator
in it's own file? It also needs some docs what supportsScalaPBOptions
means. I'd prefer to name it supportsScalaPbOptions
(small b
).
Are there other generators we could support? Can we add an CustomGen
to let the user define and use other generators?
|
||
def scalaPBVersion: T[String] | ||
|
||
def scalaPBGenerators: T[Seq[Generator]] = Seq[Generator](ScalaGen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have some docs here which answers: What is a generator? Which can be choosen from? What is the default?
|
||
object TutorialWithScalaAndJavaGen extends TutorialBase { | ||
object core extends TutorialModule { | ||
override def scalaPBGenerators = Seq[Generator](ScalaGen, JavaGen) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does making Generator
an enum fixes the issue?
Extend the scalapb plugin to allow for generating scala, or java, or both.
Can probably be extended in the future to support arbitrary generators https://scalapb.github.io/docs/scalapbc/#loading-additional-generators-from-maven