-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sbt
142 lines (128 loc) · 4.32 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
inThisBuild(
List(
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
)
val Scala2_12 = "2.12.19"
val Scala2_13 = "2.13.6"
val Scala3 = "3.0.1"
val versions = new {
val scalikejdbc = "3.3.5"
val silencer = "1.17.13"
}
lazy val TableOfContents = config("tableOfContents").extend(Test)
lazy val legacyCommonSettings = Seq(
scalacOptions ++= Seq(
"-Yrangepos",
"-Ywarn-unused:imports"
)
)
def createProject(path: String, scalaVer: String): sbt.Project = {
val isScala3 = scalaVer.startsWith("3")
Project(path, file(path))
.settings(
scalaVersion := scalaVer,
scalacOptions ++= mkScalacOptions(isScala3),
libraryDependencies ++= mkLibraryDependencies(isScala3)
)
}
def mkScalacOptions(isScala3: Boolean): Seq[String] = {
Seq(
"-deprecation",
"-feature",
"-unchecked",
"-Xfatal-warnings"
) ++ {
if (isScala3) {
Seq()
} else {
Seq(
"-Xlint",
"-P:silencer:checkUnused"
)
}
}
}
def mkLibraryDependencies(isScala3: Boolean): Seq[ModuleID] = {
Seq(
"org.scalatest" %% "scalatest-funspec" % "3.2.11" % Test,
"org.scalatest" %% "scalatest-shouldmatchers" % "3.2.11" % Test
) ++ {
if (isScala3) {
Seq()
} else {
Seq(
compilerPlugin("com.github.ghik" % "silencer-plugin" % versions.silencer cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % versions.silencer % Provided cross CrossVersion.full
)
}
}
}
lazy val reporter = (project in file("reporter"))
.settings(legacyCommonSettings)
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.5"
)
)
lazy val legacy = (project in file("legacy"))
.dependsOn(reporter)
.settings(legacyCommonSettings)
.configs(TableOfContents)
.settings(inConfig(TableOfContents)(Defaults.testTasks): _*)
.settings(
name := "scala_samples",
scalaVersion := Scala2_12,
version := "1.0",
TableOfContents / testOptions ++= Seq(
Tests.Argument(
TestFrameworks.ScalaTest,
"-C",
"org.nomadblacky.scala.reporter.TableOfContentsReporter"
)
),
libraryDependencies ++= Seq(
"org.scalactic" %% "scalactic" % "3.0.9",
"org.scalatest" %% "scalatest" % "3.0.9" % "test",
"org.scalacheck" %% "scalacheck" % "1.18.1" % "test",
"com.github.scopt" %% "scopt" % "4.1.0",
"org.pegdown" % "pegdown" % "1.6.0",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.jfree" % "jfreechart" % "1.5.0",
"com.github.pathikrit" %% "better-files" % "3.9.2",
"org.scalaz" %% "scalaz-core" % "7.3.8",
"com.typesafe.akka" %% "akka-http-core" % "10.2.10",
"com.typesafe.akka" %% "akka-stream" % "2.6.20",
"org.typelevel" %% "cats-core" % "2.12.0",
"com.lihaoyi" %% "ammonite-ops" % "2.4.1",
"com.typesafe.play" %% "play-ahc-ws-standalone" % "2.1.11",
"org.scalikejdbc" %% "scalikejdbc" % versions.scalikejdbc,
"org.scalikejdbc" %% "scalikejdbc-config" % versions.scalikejdbc,
"org.scalikejdbc" %% "scalikejdbc-test" % versions.scalikejdbc % "test",
"org.skinny-framework" %% "skinny-orm" % "3.1.0",
"com.h2database" % "h2" % "2.3.232",
"ch.qos.logback" % "logback-classic" % "1.5.16"
)
)
lazy val akkaStream = createProject("akka-stream", Scala2_13)
.settings(
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-stream" % "2.6.20",
"com.typesafe.akka" %% "akka-stream-testkit" % "2.6.20" % Test
)
)
lazy val basics = createProject("basics", Scala2_13)
lazy val collections = createProject("collections", Scala2_13)
lazy val scala3 = createProject("scala3", Scala3)
.settings(
libraryDependencies ++= Seq(
"org.scalameta" %% "munit" % "0.7.27" % Test
)
)
lazy val shapeless = createProject("shapeless", Scala2_13)
.settings(
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.12"
)
)