aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Pieter Holland <anthony.holland@gmail.com>2016-03-25 18:23:27 +0200
committerAnthony Pieter Holland <anthony.holland@gmail.com>2016-03-25 18:23:27 +0200
commit3df9e26bb9aa7b992dd704c72e34e0e28159f426 (patch)
treef12e27a5a3c47d645508a91abdb2eee3e37de9c4
parent08831a9fb92242a4b1af2f5f3e12d560d36d6659 (diff)
downloadslick-codegen-example-3df9e26bb9aa7b992dd704c72e34e0e28159f426.tar.gz
slick-codegen-example-3df9e26bb9aa7b992dd704c72e34e0e28159f426.tar.bz2
slick-codegen-example-3df9e26bb9aa7b992dd704c72e34e0e28159f426.zip
Updated library version for sbt, scala, slick, sl4j, h2 and the eclipse plugin to latest stable versions as of the time of this commit. Also has to remove prefix "scala." from val profile in Example.scala
-rw-r--r--build.sbt30
-rw-r--r--project/Build.scala40
-rw-r--r--project/build.properties2
-rw-r--r--project/plugins.sbt2
-rw-r--r--src/main/scala/Example.scala2
5 files changed, 33 insertions, 43 deletions
diff --git a/build.sbt b/build.sbt
new file mode 100644
index 0000000..86ceb40
--- /dev/null
+++ b/build.sbt
@@ -0,0 +1,30 @@
+val slickVersion = "3.1.1"
+
+lazy val mainProject = Project(
+ id="slick-codegen-example",
+ base=file("."),
+ settings = Defaults.coreDefaultSettings ++ Seq(
+ scalaVersion := "2.11.8",
+ libraryDependencies ++= List(
+ "com.typesafe.slick" %% "slick" % slickVersion,
+ "com.typesafe.slick" %% "slick-codegen" % slickVersion,
+ "org.slf4j" % "slf4j-nop" % "1.7.19",
+ "com.h2database" % "h2" % "1.4.191"
+ ),
+ slick <<= slickCodeGenTask, // register manual sbt command
+ sourceGenerators in Compile <+= slickCodeGenTask // register automatic code generation on every compile, remove for only manual use
+ )
+)
+
+// code generation task
+lazy val slick = TaskKey[Seq[File]]("gen-tables")
+lazy val slickCodeGenTask = (sourceManaged, dependencyClasspath in Compile, runner in Compile, streams) map { (dir, cp, r, s) =>
+ val outputDir = (dir / "slick").getPath // place generated files in sbt's managed sources folder
+ val url = "jdbc:h2:mem:test;INIT=runscript from 'src/main/sql/create.sql'" // connection info for a pre-populated throw-away, in-memory db for this demo, which is freshly initialized on every run
+ val jdbcDriver = "org.h2.Driver"
+ val slickDriver = "slick.driver.H2Driver"
+ val pkg = "demo"
+ 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))
+}
diff --git a/project/Build.scala b/project/Build.scala
deleted file mode 100644
index 17f055b..0000000
--- a/project/Build.scala
+++ /dev/null
@@ -1,40 +0,0 @@
-import sbt._
-import Keys._
-import Tests._
-
-/**
- * This is a simple sbt setup generating Slick code from the given
- * database before compiling the projects code.
- */
-object myBuild extends Build {
- val slickVersion = "3.0.1"
-
- lazy val mainProject = Project(
- id="main",
- base=file("."),
- settings = Project.defaultSettings ++ Seq(
- scalaVersion := "2.11.6",
- libraryDependencies ++= List(
- "com.typesafe.slick" %% "slick" % slickVersion,
- "com.typesafe.slick" %% "slick-codegen" % slickVersion,
- "org.slf4j" % "slf4j-nop" % "1.7.12",
- "com.h2database" % "h2" % "1.4.187"
- ),
- slick <<= slickCodeGenTask, // register manual sbt command
- sourceGenerators in Compile <+= slickCodeGenTask // register automatic code generation on every compile, remove for only manual use
- )
- )
-
- // code generation task
- lazy val slick = TaskKey[Seq[File]]("gen-tables")
- lazy val slickCodeGenTask = (sourceManaged, dependencyClasspath in Compile, runner in Compile, streams) map { (dir, cp, r, s) =>
- val outputDir = (dir / "slick").getPath // place generated files in sbt's managed sources folder
- val url = "jdbc:h2:mem:test;INIT=runscript from 'src/main/sql/create.sql'" // connection info for a pre-populated throw-away, in-memory db for this demo, which is freshly initialized on every run
- val jdbcDriver = "org.h2.Driver"
- val slickDriver = "slick.driver.H2Driver"
- val pkg = "demo"
- 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))
- }
-}
diff --git a/project/build.properties b/project/build.properties
index 0974fce..817bc38 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=0.13.0
+sbt.version=0.13.9
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 0b28604..87c66b0 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1 +1 @@
-addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0")
+addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0")
diff --git a/src/main/scala/Example.scala b/src/main/scala/Example.scala
index b6fe0b6..1e419a0 100644
--- a/src/main/scala/Example.scala
+++ b/src/main/scala/Example.scala
@@ -1,6 +1,6 @@
object Tables extends {
// or just use object demo.Tables, which is hard-wired to the driver stated during generation
- val profile = scala.slick.driver.H2Driver
+ val profile = slick.driver.H2Driver
} with demo.Tables