-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
125 lines (117 loc) · 3.63 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
import Dependencies._
lazy val mess = project
.in(file("."))
.settings(sharedSettings)
.settings(publish / skip := true)
.settings(
inThisBuild(
Seq(
organization := "com.github.tkrs",
homepage := Some(url("https://github.com/tkrs/mess")),
licenses := Seq("MIT License" -> url("http://www.opensource.org/licenses/mit-license.php")),
developers := List(
Developer(
"tkrs",
"Takeru Sato",
url("https://github.com/tkrs")
)
),
scalaVersion := Ver.`scala2.13`,
crossScalaVersions := Seq(Ver.`scala2.13`, Ver.scala3),
libraryDependencies ++= Seq(MunitScalacheck).map(_ % Test),
testFrameworks += new TestFramework("munit.Framework"),
scalafmtOnCompile := true,
scalafixOnCompile := true,
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
fork := true
)
)
)
// .settings(Compile / console / scalacOptions --= warnCompilerOptions)
.settings(Compile / console / scalacOptions += "-Yrepl-class-based")
.aggregate(core, benchmark, examples)
.dependsOn(core, benchmark, examples)
lazy val core = project
.in(file("modules/core"))
.settings(sharedSettings)
.settings(crossVersionSharedSources)
.settings(
description := "mess core",
moduleName := "mess-core"
)
.settings(Compile / sourceGenerators += (Compile / sourceManaged).map(Boilerplate.gen).taskValue)
.settings(
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq(MsgpackJava)
case _ => Seq(MsgpackJava, Shapeless)
}
}
)
lazy val examples = project
.in(file("modules/examples"))
.settings(sharedSettings)
.settings(publish / skip := true)
.settings(
description := "mess examples",
moduleName := "mess-examples"
)
.settings(
coverageEnabled := false
)
.dependsOn(core)
lazy val benchmark = project
.in(file("modules/benchmark"))
.settings(sharedSettings)
.settings(publish / skip := true)
.settings(
description := "mess benchmark",
moduleName := "mess-benchmark"
)
.settings(
coverageEnabled := false
)
.enablePlugins(JmhPlugin)
.dependsOn(core % "test->test")
lazy val sharedSettings = Seq(
scalacOptions ++= compilerOptions ++ {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Nil // Seq("-source:3.0-migration")
case Some((2, n)) if n >= 13 =>
Seq("-Xfatal-warnings",
"-Xlint",
"-Ywarn-unused",
"-Ywarn-extra-implicit",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)
case _ => Seq("-Xfuture", "-Xfatal-warnings", "-Ypartial-unification", "-Yno-adapted-args")
}
}
)
lazy val crossVersionSharedSources =
Seq(Compile, Test).map { sc =>
(sc / unmanagedSourceDirectories) ++=
(sc / unmanagedSourceDirectories).value.flatMap { dir: File =>
if (dir.getName != "scala") Seq(dir)
else
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, n)) =>
Seq(new File(dir.getPath + "_3"))
case Some((2, n)) if n >= 13 =>
Seq(new File(dir.getPath + "_2"), new File(dir.getPath + "_2.13+"))
case s =>
Seq(new File(dir.getPath + "_2"), new File(dir.getPath + "_2.12-"))
}
}
}
lazy val compilerOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-unchecked",
"-language:higherKinds",
"-feature"
)