sbt • Execute code generation logic iff the inputs have changed • For Slick we can use DB migration files as inputs • No changes in the migration files ⇒ generated code is up to date! slickCodeGenTask := { val cachedGen = FileFunction.cached(target.value / "slickCodeGen", inStyle = FileInfo.hash) { in: Set[File] => runner.value.run("slick.codegen.SourceCodeGenerator", cp.files, Array(slickDriver, jdbcDriver, url, outputDir.getPath, pkg), s.log).failed foreach (sys error _.getMessage) val fname = outputDir + "/my/slick/tables/Tables.scala" Seq(file(fname)) } cachedGen(IO.listFiles(file("migrations")).toSet) }