Skip to content

Instantly share code, notes, and snippets.

@fedesilva
Forked from xuwei-k/build.sbt
Created August 11, 2021 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedesilva/bab3708c694c593aab05b26d6098d0f8 to your computer and use it in GitHub Desktop.
Save fedesilva/bab3708c694c593aab05b26d6098d0f8 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