-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
168 lines (159 loc) · 6.92 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
import org.scalafmt.sbt.ScalafmtPlugin.scalafmtConfigSettings
resolvers += "dnvriend" at "https://dl.bintray.com/dnvriend/maven"
lazy val akkaVersion = "2.6.17"
lazy val akkaPersistenceCassandraVersion = "1.0.5"
lazy val scalaMockVersion = "5.2.0"
// Restrict the number of concurrently executing MultiJVM/test tasks in all project:
Global / concurrentRestrictions += Tags.limit(Tags.Untagged, 1)
ThisBuild / scalaVersion := "2.13.4"
ThisBuild / scalacOptions ++= Seq(
"-feature",
"-unchecked",
"-Xlint",
"-Yrangepos",
"-Ywarn-unused:imports",
)
ThisBuild / scalacOptions ++= sys.props.get("lerna.enable.discipline").map(_ => "-Xfatal-warnings").toSeq
ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value)
// https://scalacenter.github.io/scalafix/docs/users/installation.html#sbt
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
// doc
ThisBuild / Compile / doc / autoAPIMappings := true
ThisBuild / git.remoteRepo := "[email protected]:lerna-stack/akka-entity-replication.git"
lazy val root = project
.in(file("."))
.enablePlugins(
MultiJvmPlugin,
ScalaUnidocPlugin,
GhpagesPlugin,
)
.configs(MultiJvm)
.aggregate(core, rollbackToolCassandra)
.settings(
name := "akka-entity-replication-root",
publish / skip := true,
mimaFailOnNoPrevious := false,
ScalaUnidoc / siteSubdirName := "latest/api",
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, ScalaUnidoc / siteSubdirName),
previewSite / aggregate := false,
ghpagesPushSite / aggregate := false,
)
lazy val core = (project in file("core"))
.enablePlugins(
MultiJvmPlugin,
)
.configs(MultiJvm)
.settings(
name := "akka-entity-replication",
fork in Test := true,
parallelExecution in Test := false,
javaOptions in Test ++= sbtJavaOptions,
jvmOptions in MultiJvm ++= sbtJavaOptions,
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-cluster-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster" % akkaVersion,
"com.typesafe.akka" %% "akka-cluster-sharding" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence" % akkaVersion,
// persistence-query 2.6.x を明示的に指定しないとエラーになる。
// 恐らく akka-persistence-inmemory の影響である。
"com.typesafe.akka" %% "akka-persistence-query" % akkaVersion,
"com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Optional,
// multi-jvm:test can't resolve [Optional] dependency
"com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test,
"io.altoo" %% "akka-kryo-serialization" % "1.1.5" % Test,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion % Test,
"ch.qos.logback" % "logback-classic" % "1.2.3" % Test,
"org.scalatest" %% "scalatest" % "3.0.9" % Test,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % Test,
// akka-persistence-inmemory が 2.6.x 系に対応していない。
// TODO 2.6.x 系に対応できる方法に変更する。
"com.github.dnvriend" %% "akka-persistence-inmemory" % "2.5.15.2" % Test,
"com.typesafe.akka" %% "akka-persistence-testkit" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test,
"org.scalamock" %% "scalamock" % scalaMockVersion % Test,
),
inConfig(MultiJvm)(
// multi-jvm ディレクトリをフォーマットするために必要
scalafmtConfigSettings
++ scalafixConfigSettings(MultiJvm)
++ Seq(
scalatestOptions ++= Seq(
"-u",
(target.value / "multi-jvm-test-reports").getPath,
),
),
),
// test-coverage
coverageExcludedPackages := Seq(
"lerna\\.akka\\.entityreplication\\.protobuf\\.msg\\..*",
).mkString(";"),
// scalapb
Compile / PB.targets := Seq(
scalapb.gen(flatPackage = true, lenses = false, grpc = false) -> (sourceManaged in Compile).value / "scalapb",
),
// mima
mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet,
mimaReportSignatureProblems := true, // check also generic parameters
)
lazy val rollbackToolCassandra = (project in file("rollback-tool-cassandra"))
.dependsOn(core)
.enablePlugins(MultiJvmPlugin)
.configs(MultiJvm)
.settings(
name := "akka-entity-replication-rollback-tool-cassandra",
fork in Test := true,
parallelExecution in Test := false,
javaOptions in Test ++= sbtJavaOptions,
jvmOptions in MultiJvm ++= sbtJavaOptions,
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-persistence" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-cassandra" % akkaPersistenceCassandraVersion,
"com.typesafe.akka" %% "akka-persistence-cassandra-launcher" % akkaPersistenceCassandraVersion % Test,
"ch.qos.logback" % "logback-classic" % "1.2.3" % Test,
"org.scalatest" %% "scalatest" % "3.0.9" % Test,
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-serialization-jackson" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % Test,
"org.scalamock" %% "scalamock" % scalaMockVersion % Test,
),
inConfig(MultiJvm)(
scalafmtConfigSettings
++ scalafixConfigSettings(MultiJvm)
++ Seq(
scalatestOptions ++= Seq(
"-u",
(target.value / "multi-jvm-test-reports").getPath,
),
),
),
// MiMa
mimaPreviousArtifacts := previousStableVersion.value.map(organization.value %% moduleName.value % _).toSet,
mimaReportSignatureProblems := true,
)
/**
* This is used to pass specific system properties (mostly from CI environment variables)
* to the forked process by sbt
*/
val sbtJavaOptions: Seq[String] = {
// selects properties starting with the following
val includes = Set(
"akka.",
)
sys.props.collect {
case (k, v) if includes.exists(k.startsWith) => s"-D$k=$v"
}.toSeq
}
addCommandAlias(
"testCoverage",
Seq(
"clean",
"coverage",
"test",
"multi-jvm:test",
"coverageAggregate",
).mkString(";"),
)