This repository has been archived by the owner on Oct 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.sbt
81 lines (64 loc) · 2.61 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import Dependencies._
import BuildSettings._
scalaVersion in ThisBuild := "2.11.11"
ivyScala := ivyScala.value map {
_.copy(overrideScalaVersion = true)
}
organization in ThisBuild := "io.strongtyped"
crossScalaVersions in ThisBuild := Seq("2.11.11", "2.12.2")
parallelExecution in Test := false
lazy val root = Project(
id = "active-slick-root",
base = file("."),
settings = projSettings ++ Seq(
publishArtifact := false
)
) aggregate(activeSlick, shapelessIntegration, samples)
// Core ==========================================
lazy val activeSlick = Project(
id = "active-slick",
base = file("modules/core"),
settings = projSettings ++ mainDeps ++ testDeps
)
//================================================
// Shapeless Integration ========================
lazy val shapelessIntegration = {
// settings to include shapeless dependencies
val shapeless = Seq(
libraryDependencies ++= shapelessDeps
)
Project(
id = "active-slick-shapeless",
base = file("modules/shapeless"),
settings = projSettings ++ mainDeps ++ shapeless ++ testDeps
) dependsOn activeSlick
}
//================================================
// Samples =======================================
// contains examples used on the docs, not intended to be released
lazy val samples = Project(
id = "active-slick-samples",
base = file("modules/samples"),
settings = projSettings ++ Seq(
publishArtifact := false,
libraryDependencies ++= Seq(
"com.typesafe.slick" %% "slick-codegen" % slickVersion,
"com.h2database" % "h2" % "1.4.187",
"org.slf4j" % "slf4j-nop" % "1.7.12", // To silence build warnings
scalaTest
),
slick <<= slickCodeGenTask,
sourceGenerators in Compile <+= slickCodeGenTask
) ++ mainDeps
).dependsOn(activeSlick % "compile->compile;test->test")
//======+=========================================
lazy val slick = TaskKey[Seq[File]]("gen-tables")
lazy val slickCodeGenTask = (sourceManaged, dependencyClasspath in Compile, runner in Compile, streams) map { (srcManaged, cp, r, s) =>
val pkg = "io.strongtyped.active.slick.docexamples.codegen"
val url = "jdbc:h2:mem:test;INIT=runscript from 'modules/samples/src/main/resources/codegen_schema.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.jdbc.H2Profile"
toError(r.run("slick.codegen.SourceCodeGenerator", cp.files, Array(slickDriver, jdbcDriver, url, srcManaged.getPath, pkg), s.log))
val outputDir = srcManaged / pkg.replace(".", "/")
Seq(outputDir / "Tables.scala")
}