nau
nau

Reputation: 1165

scalapb how to generate code from protobuf files in test directory?

I'd like to generate code from protobuf files in test directory.

project/test/protobuf/myproto.proto

This doesn't work.

PB.targets in Test := Seq(
  scalapb.gen() -> (sourceManaged in Test).value
)

Looks like scalapb only generates files for protos in main/protobuf directory.

Upvotes: 3

Views: 1311

Answers (1)

thesamet
thesamet

Reputation: 6582

You need to enable ScalaPB code generator for your test configuration. Add this to build.sbt:

Test / PB.targets += scalapb.gen() -> (Test / sourceManaged).value / "scalapb"

See https://github.com/thesamet/sbt-protoc#protos-in-other-configs

Upvotes: 5

Related Questions