Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created June 28, 2018 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xuwei-k/4c333a9c9ba99773a6282a69005455ee to your computer and use it in GitHub Desktop.
Save xuwei-k/4c333a9c9ba99773a6282a69005455ee to your computer and use it in GitHub Desktop.
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