I'm having some difficulties understanding the syntax for scalapb, specifically I'm trying to add multiple .proto source directories for a multi-project SBT build.
My project structure is as follows:
/build.sbt
/main/src/protobuf
/common/main/src/protobuf
/client/main/src/protobuf
My build.sbt is as follows:
name := "myApp"
import Dependencies._
import com.trueaccord.scalapb.{ScalaPbPlugin => PB}
val protoDirectories = Seq(
file("common/src/main/protobuf"),
file("client/src/main/protobuf")
)
sourceDirectories in PB.protobufConfig ++= protoDirectories
PB.protobufSettings ++ Seq(
flatPackage := false
)
lazy val common = (project in file("common")).
settings(Commons.settings: _*).
settings(libraryDependencies ++= commonDependencies)
lazy val client = (project in file("client")).
settings(Commons.settings: _*).
settings(libraryDependencies ++= clientDependencies).
dependsOn(common)
When I run sbt compile
, I get the following error message:
[error] Reference to undefined setting:
[error]
[error] sphere/*:sourceDirectories from myApp/*:sourceDirectories (<path_to_project_dir>\build.sbt:11)
[error] Did you mean myApp/protobuf:sourceDirectories ?
Could someone please point me in the right direction? I'm failing to understand some basic concept here...
EDIT
Ok, so I was pointing to the wrong sequence for the protoDirectories. I have amended the build.sbt to reflect the new changes. I still have a problem that my .proto files are not compiled in the sub projects. If I move my .proto files to the root /main/src/protobuf, they compile just fine.