-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
38 lines (29 loc) · 978 Bytes
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name := """base-play-application"""
organization := "com.dreigada"
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.11"
libraryDependencies ++= List(
Dependencies.slick,
Dependencies.playSlick,
Dependencies.playSlickEvolutions,
Dependencies.slickCodeGen,
Dependencies.sqliteDriver,
evolutions,
jdbc
)
// code generation task
lazy val generateTables = TaskKey[Seq[File]]("gen-tables")
generateTables := {
val outputDir = (root.base / "app").getPath
val cp = (dependencyClasspath in Compile).value
val r = (runner in Compile).value
val s = streams.value
val url = "jdbc:sqlite:testDB"
val jdbcDriver = "org.sqlite.JDBC"
val slickDriver = "slick.driver.SQLiteDriver"
val pkg = "queries"
toError(r.run("slick.codegen.SourceCodeGenerator", cp.files, Array(slickDriver, jdbcDriver, url, outputDir, pkg), s.log))
val fname = outputDir + "/demo/Tables.scala"
Seq(file(fname))
}