Http4sGrpcCodeGenerator

nscn.polaris2.mill.generator.Http4sGrpcCodeGenerator
object Http4sGrpcCodeGenerator extends CodeGenApp

Emits http4s service bindings for every service in a .proto.

Ported from org.http4s.grpc.generator.Http4sGrpcCodeGenerator, and rebased from ScalaPB onto mill-protoc: the message types it refers to are the ones nscn.polaris2.protoc.codegen.Scala3Generator emits, and the naming decisions come from the same GenContext that generator uses. Sharing that context is what keeps flat_package, (nscn.polaris2.protoc.file).package_name and the rest agreeing across the two targets; a service referring to a type name the message generator did not produce is the failure mode this avoids.

mill-protoc's own generator ignores service declarations entirely, so the two targets never write the same file.

This is a plain ProtocCodeGenerator, so it runs in-process through the bridge (how nscn.polaris2.mill.Http4sGrpcModule drives it) or as a standalone protoc plugin through its inherited main.

Attributes

Graph
Supertypes
trait CodeGenApp
trait ProtocCodeGenerator
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def process(request: CodeGenRequest): CodeGenResponse
override def registerExtensions(registry: ExtensionRegistry): Unit

Teaches the request parser about mill-protoc's options.

Teaches the request parser about mill-protoc's options.

Without it every (nscn.polaris2.protoc.*) option arrives as an unknown field and reads back as its default, so this generator would compute different names than the message generator for exactly the files that configure anything.

Attributes

Definition Classes
CodeGenApp

Inherited methods

final def main(args: Array[String]): Unit

Attributes

Inherited from:
CodeGenApp
final def run(input: CodedInputStream): Array[Byte]

Never throws: a generator that dies without writing a response leaves protoc waiting on the pipe, so every failure is converted into a CodeGeneratorResponse.error.

Never throws: a generator that dies without writing a response leaves protoc waiting on the pipe, so every failure is converted into a CodeGeneratorResponse.error.

Attributes

Inherited from:
CodeGenApp
final override def run(req: Array[Byte]): Array[Byte]

Attributes

Definition Classes
CodeGenApp -> ProtocCodeGenerator
Inherited from:
CodeGenApp
def suggestedDependencies: Seq[Artifact]

Artifacts the generated code needs on the consumer's classpath.

Artifacts the generated code needs on the consumer's classpath.

Attributes

Inherited from:
ProtocCodeGenerator

Concrete fields

val generatorName: String

The name protoc knows this generator by, i.e. --scala-http4s-grpc_out.

The name protoc knows this generator by, i.e. --scala-http4s-grpc_out.

Attributes