-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
213 lines (198 loc) · 7.23 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import sbt._
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
// Basics
// note: keep in sync to pekko https://github.com/apache/incubator-pekko/blob/main/project/Dependencies.scala
val mainScalaVersion = "3.3.4"
val secondaryScalaVersions = Seq("2.12.20", "2.13.14")
val kryoVersion = "5.6.2"
enablePlugins(ReleasePlugin)
addCommandAlias("validatePullRequest", ";+test")
lazy val root: Project = project.in(file("."))
.settings(Test / parallelExecution := false)
.settings(commonSettings)
.settings(name := "scala-kryo-serialization")
.settings(releaseProcess := releaseSettings)
.settings(publish / skip := true)
.aggregate(core)
lazy val core: Project = project.in(file("core"))
.settings(moduleSettings)
.settings(description := "pekko-serialization implementation using kryo - core implementation")
.settings(name := "scala-kryo-serialization")
.settings(libraryDependencies ++= coreDeps ++ testingDeps)
.settings(Compile / unmanagedSourceDirectories += {
scalaBinaryVersion.value match {
case "2.12" => baseDirectory.value / "src" / "main" / "scala-2.12"
case "2.13" => baseDirectory.value / "src" / "main" / "scala-2.13"
case _ => baseDirectory.value / "src" / "main" / "scala-3"
}
})
.settings(Test / unmanagedSourceDirectories += {
scalaBinaryVersion.value match {
case "2.12" => baseDirectory.value / "src" / "test" / "scala-2.12"
case "2.13" => baseDirectory.value / "src" / "test" / "scala-2.13"
case _ => baseDirectory.value / "src" / "test" / "scala-3"
}
})
// Dependencies
lazy val coreDeps = Seq(
"com.esotericsoftware.kryo" % "kryo5" % kryoVersion,
"com.typesafe" % "config" % "1.4.3",
"org.lz4" % "lz4-java" % "1.8.0",
"org.agrona" % "agrona" % "1.22.0", // should match pekko-remote/aeron inherited version
"org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0",
"org.slf4j" % "slf4j-api" % "2.0.16",
"org.slf4j" % "log4j-over-slf4j" % "2.0.16")
lazy val testingDeps = Seq(
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"ch.qos.logback" % "logback-classic" % "1.5.10" % Test)
// Settings
lazy val commonSettings: Seq[Setting[?]] = Seq(
organization := "io.altoo")
lazy val moduleSettings: Seq[Setting[?]] = commonSettings ++ noReleaseInSubmoduleSettings ++ scalacBasicOptions ++ scalacStrictOptions ++ scalacLintOptions ++ Seq(
scalaVersion := mainScalaVersion,
versionScheme := Some("early-semver"),
crossScalaVersions := (scalaVersion.value +: secondaryScalaVersions),
fork := true,
testForkedParallel := false,
classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.ScalaLibrary,
run / javaOptions += "-XX:+UseAES -XX:+UseAESIntrinsics", // Enabling hardware AES support if available
// required to run serialization with JDK 17
Test / javaOptions ++= Seq("--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.util.concurrent=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.invoke=ALL-UNNAMED", "--add-opens", "java.base/java.math=ALL-UNNAMED"),
// required to run unsafe with JDK 17
Test / javaOptions ++= Seq("--add-opens", "java.base/java.nio=ALL-UNNAMED", "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED"),
pomExtra := pomExtras,
publishTo := sonatypePublishToBundle.value,
publishMavenStyle := true,
Test / publishArtifact := false,
pomIncludeRepository := { _ => false })
lazy val scalacBasicOptions = Seq(
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" | "2.13" =>
Seq(
"-encoding", "utf8",
"-feature",
"-unchecked",
"-deprecation",
"-language:existentials",
"-Xlog-reflective-calls",
"-Ywarn-unused:-nowarn",
"-Xsource:3",
"-opt:l:inline",
"-opt-inline-from:io.altoo.pekko.serialization.kryo.*")
case "3" =>
Seq(
"-encoding", "utf8",
"-feature",
"-unchecked",
"-deprecation",
"-language:existentials")
}
})
// strict options
lazy val scalacStrictOptions = Seq(
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" =>
Seq(
"-Xfatal-warnings",
"-Yno-adapted-args",
"-Ywarn-adapted-args",
"-Ywarn-dead-code",
"-Ywarn-extra-implicit",
"-Ywarn-inaccessible",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit",
"-Ywarn-unused:-explicits,-implicits,_")
case "2.13" =>
Seq(
"-Werror",
"-Wdead-code",
"-Wextra-implicit",
"-Wunused:imports",
"-Wunused:patvars",
"-Wunused:privates",
"-Wunused:locals",
// "-Wunused:params", enable once 2.12 support is dropped
"-Wunused:nowarn")
case "3" =>
Seq(
// "-Xfatal-warnings", enable once dotty supports @nowarn
"-Ycheck-all-patmat")
}
})
// lint options
lazy val scalacLintOptions = Seq(
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" =>
Seq(
"-Xlint:private-shadow",
"-Xlint:type-parameter-shadow",
"-Xlint:adapted-args",
"-Xlint:unsound-match",
"-Xlint:option-implicit")
case "2.13" =>
Seq(
"-Xlint:inaccessible",
"-Xlint:nullary-unit",
"-Xlint:private-shadow",
"-Xlint:type-parameter-shadow",
"-Xlint:adapted-args",
"-Xlint:option-implicit",
"-Xlint:missing-interpolator",
"-Xlint:poly-implicit-overload",
"-Xlint:option-implicit",
"-Xlint:package-object-classes",
"-Xlint:constant",
"-Xlint:nonlocal-return",
"-Xlint:valpattern",
"-Xlint:eta-zero",
"-Xlint:deprecation")
case "3" =>
Seq()
}
})
lazy val noReleaseInSubmoduleSettings: Seq[Setting[?]] = Seq(
releaseProcess := Seq[ReleaseStep](ReleaseStep(_ => sys.error("cannot release a submodule!"))))
// Configure cross builds.
lazy val releaseSettings = Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
// do these manually on checked out tag... verify on https://oss.sonatype.org/#stagingRepositories
// releaseStepCommandAndRemaining("+publishSigned"),
// releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges)
releaseCrossBuild := true
lazy val pomExtras = <url>https://github.com/altoo-ag/scala-kryo-serialization</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:altoo-ag/scala-kryo-serialization.git</url>
<connection>scm:git:[email protected]:altoo-ag/scala-kryo-serialization.git</connection>
</scm>
<developers>
<developer>
<id>danischroeter</id>
<name>Daniel Schröter</name>
<email>[email protected]</email>
</developer>
<developer>
<id>nvollmar</id>
<name>Nicolas Vollmar</name>
<email>[email protected]</email>
</developer>
</developers>