Skip to content

Instantly share code, notes, and snippets.

@fedesilva
Forked from xuwei-k/build.sbt
Created Aug 11, 2021
Embed
What would you like to do?
use flatbuffers java from sbt
import scala.sys.process.Process
scalaVersion := "2.12.6"
libraryDependencies ++= Seq(
"com.google.flatbuffers" % "flatbuffers-java" % "1.9.0"
)
sourceGenerators in Compile += Def.task {
val files = (file("src/main/fbs") ** "*.fbs").get.map(_.getAbsolutePath).toList
val out = (sourceManaged in Compile).value
val args = "flatc" :: "--java" :: "-o" :: out.getAbsolutePath :: files
Process(args).!
(out ** "*.java").get
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment