nscn.polaris2.mill

Members list

Packages

Type members

Classlikes

trait Http4sGrpcModule extends ProtocModule

Generates http4s-grpc service bindings, alongside the messages nscn.polaris2.protoc.mill.ProtocModule generates from the same .proto files.

Generates http4s-grpc service bindings, alongside the messages nscn.polaris2.protoc.mill.ProtocModule generates from the same .proto files.

This is the Mill counterpart of org.http4s.grpc.sbt.Http4sGrpcPlugin. Everything to do with finding .proto files, resolving protoc and putting the Well-Known Types on its include path comes from ProtocModule; this trait contributes one more generator to the same protoc invocation, writing into a http4s-grpc/ subdirectory of the generated-sources root so a service file cannot collide with a message file of the same name.

object api extends ScalaModule, Http4sGrpcModule {
 def scalaVersion = "3.9.0"
 def jvmVersion = "25"
 // .proto files live in `api/protobuf` by default
}

Configuration is ProtocModule's: protocProtoSources, protocVersion, protocPath, protocFlatPackage, protocOptions, protocArgs. The service generator receives the same options as the message generator, which is not optional - flat_package and (nscn.polaris2.protoc.file).package_name change where the message types land, and a binding referring to the wrong name does not compile.

Both mill-protoc-runtime and mill-http4s-grpc-core are added to mvnDeps through super, so a module that adds its own dependencies must do the same:

def mvnDeps = Task { super.mvnDeps() ++ Seq(mvn"org.typelevel::cats-core:2.13.0") }

A bare def mvnDeps = Seq(...) compiles cleanly - Mill's build-file compiler inserts override for you - and silently drops both runtimes.

Both artifacts live in a self-hosted registry rather than Maven Central, so the consuming module also needs def repositories = Seq("https://forgejo.wolf109909.top/api/packages/NorthstarCN/maven") (additive: Mill appends Coursier's defaults), in addition to the //| repositories: header that resolves the plugin itself.

Attributes

Companion
object
Supertypes
trait ProtocModule
trait ScalaModule
trait ScalaModuleApi
trait ScalaModuleBase
trait JavaModule
trait JavaModuleApi
trait JdkCommandsModule
trait AssemblyModule
trait SemanticDbJavaModule
trait SemanticDbJavaModuleApi
trait OfflineSupportModule
trait GenIdeaModule
trait GenIdeaModuleApi
trait RunModule
trait RunModuleApi
trait DefaultTaskModule
trait JavaModuleBase
trait BspModule
trait BspModuleApi
trait WithJvmWorkerModule
trait JavaHomeModule
trait CoursierModule
trait Module
trait ModuleApi
trait Wrapper
class BaseClass
trait Cacher
trait Cacher
class Object
trait Matchable
class Any
Show all

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type