How to add "targets in compile" to a SBT project which is defined with lazy val root = project.in(".")

233 views Asked by At

I have a project:

lazy val root = project
  .in(file("."))
  .settings( ...

I wish to add ScalaPB to the project and I need to add:

PB.targets in Compile := Seq(
    scalapb.gen(grpc = true) -> (sourceManaged in Compile).value,
    scalapb.zio_grpc.ZioCodeGenerator -> (sourceManaged in Compile).value,
)

How can I add this to the lazy val project?

1

There are 1 answers

0
mfirry On BEST ANSWER

This should work:

lazy val root = project
  .in(file("."))
  .settings(
    PB.targets in Compile := Seq(
      scalapb.gen(grpc = true) -> (sourceManaged in Compile).value,
      scalapb.zio_grpc.ZioCodeGenerator -> (sourceManaged in Compile).value
    )
  )