aboutsummaryrefslogtreecommitdiff
path: root/generateModel.sbt
diff options
context:
space:
mode:
Diffstat (limited to 'generateModel.sbt')
-rw-r--r--generateModel.sbt21
1 files changed, 21 insertions, 0 deletions
diff --git a/generateModel.sbt b/generateModel.sbt
new file mode 100644
index 0000000..8597c05
--- /dev/null
+++ b/generateModel.sbt
@@ -0,0 +1,21 @@
1
2// code generation task that calls the customized code generator
3lazy val slick = TaskKey[Seq[File]]("generateModel")
4lazy val slickCodeGenTask = (sourceManaged, dependencyClasspath in Compile, runner in Compile, streams) map { (dir, cp, r, s) =>
5 //val outputDir = (dir / "slick").getPath
6 val outputDir = "app"
7 val url = System.getenv("DATABASE_URL")
8 val jdbcDriver = "org.postgresql.Driver"
9 val slickDriver = "scala.slick.driver.PostgresDriver"
10 val pkg = "models"
11 val tables = "bids,charges,items,transactions,users"
12 val views = "accounts,sales"
13 toError(r.run("codegen.ModelGenerator", cp.files, Array(slickDriver, jdbcDriver, url, tables, outputDir, "Tables", pkg), s.log))
14 toError(r.run("codegen.ModelGenerator", cp.files, Array(slickDriver, jdbcDriver, url, views, outputDir, "Views", pkg), s.log))
15 Seq(
16 file(outputDir + "/models/Tables.scala"),
17 file(outputDir + "/models/Views.scala")
18 )
19}
20
21slick <<= slickCodeGenTask