forked from erikvanoosten/metrics-scala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
175 lines (161 loc) · 6.87 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
import sbt.Keys.scalaVersion
import sbt.librarymanagement.{CrossVersion, ModuleID}
lazy val commonSettings = Seq(
organization := "nl.grons",
scalaVersion := "2.12.18",
crossVersion := CrossVersion.binary,
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.16" % Test,
"org.mockito" % "mockito-core" % "4.11.0" % Test,
"org.slf4j" % "slf4j-simple" % "2.0.7" % Test
),
fork := true,
Test / testOptions += {
// Exclude tests based on scala version:
if (before212(scalaVersion.value)) Tests.Argument("-l", ">=scala2.12")
else Tests.Argument("-l", "<scala2.12")
},
javacOptions ++= Seq("-target", "1.8", "-J-Xmx512m", "-J-Xms128m", "-J-Xss10m"),
javaOptions ++= Seq("-Xmx512m", "-Djava.awt.headless=true"),
scalacOptions ++= scalacTargets(scalaVersion.value) ++ Seq("-deprecation", "-unchecked"),
publishTo := sonatypePublishToBundle.value,
publishMavenStyle := true,
Test / publishArtifact := false,
pomIncludeRepository := { _ => false },
licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/erikvanoosten/metrics-scala")),
scmInfo := Some(ScmInfo(
url("https://github.com/erikvanoosten/metrics-scala"),
"scm:git:[email protected]:erikvanoosten/metrics-scala.git"
)),
developers := List(
Developer(id="erikvanoosten", name="Erik van Oosten", email="", url=url("https://github.com/erikvanoosten")),
Developer(id="scullxbones", name="Brian Scully", email="", url=url("https://github.com/scullxbones"))
)
)
ThisBuild / publishTo := sonatypePublishTo.value
lazy val root = (project in file("."))
.aggregate(metricsScala, metricsScalaHdr, metricsAkka24, metricsAkka25, metricsAkka26, metricsPekko)
.settings(
crossScalaVersions := Nil,
publishArtifact := false,
publish / skip := true,
publish := {},
publishLocal := {},
name := "metrics4-scala-root",
sonatypeProfileName := "nl.grons"
)
lazy val metricsScala = (project in file("metrics-scala"))
.settings(
commonSettings,
crossScalaVersions := Seq("3.1.3", "2.13.11", "2.12.18", "2.11.12"),
name := "metrics4-scala",
description := "metrics-scala for Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
"io.dropwizard.metrics" % "metrics-core" % "4.2.19",
"io.dropwizard.metrics" % "metrics-healthchecks" % "4.2.19"
),
mimaPreviousArtifacts := mimaPrevious(scalaVersion.value)
)
lazy val metricsScalaHdr = (project in file("metrics-scala-hdr"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("3.1.3", "2.13.11", "2.12.18", "2.11.12"),
name := "metrics4-scala-hdr",
description := "metrics-scala-hdr for Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
"org.mpierce.metrics.reservoir" % "hdrhistogram-metrics-reservoir" % "1.1.3",
// Override version that hdrhistogram-metrics-reservoir depends on:
"org.hdrhistogram" % "HdrHistogram" % "2.1.12"
),
mimaPreviousArtifacts := mimaPrevious(scalaVersion.value)
)
lazy val metricsPekko = (project in file("metrics-pekko"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("3.1.3", "2.13.11", "2.12.18"),
name := "metrics4-pekko",
description := "metrics-scala for pekko 1.0.1 and Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-actor" % "1.0.1",
"org.apache.pekko" %% "pekko-testkit" % "1.0.1" % Test
),
sourceDirectory := baseDirectory.value.getParentFile / "metrics-pekko" / "src",
mimaPreviousArtifacts := mimaPrevious(scalaVersion.value)
)
lazy val metricsAkka26 = (project in file("metrics-akka-26"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("3.1.3", "2.13.11", "2.12.18"),
name := "metrics4-akka_a26",
description := "metrics-scala for Akka 2.6 and Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.6.20",
"com.typesafe.akka" %% "akka-testkit" % "2.6.20" % Test
),
sourceDirectory := baseDirectory.value.getParentFile / "metrics-akka" / "src",
mimaPreviousArtifacts := mimaPrevious(scalaVersion.value)
)
lazy val metricsAkka25 = (project in file("metrics-akka-25"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("2.13.11", "2.12.18"),
name := "metrics4-akka_a25",
description := "metrics-scala for Akka 2.5 and 2.6 and Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
// Stay on Akka 2.5 to guarantee backward compatibility:
// scala-steward:off
"com.typesafe.akka" %% "akka-actor" % "2.5.31",
"com.typesafe.akka" %% "akka-testkit" % "2.5.31" % Test
// scala-steward:on
),
sourceDirectory := baseDirectory.value.getParentFile / "metrics-akka" / "src",
mimaPreviousArtifacts := mimaPrevious(scalaVersion.value)
)
lazy val metricsAkka24 = (project in file("metrics-akka-24"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("2.12.18", "2.11.12"),
name := "metrics4-akka_a24",
description := "metrics-scala for Akka 2.4 and 2.5 and Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
// Stay on Akka 2.4 to guarantee backward compatibility:
// scala-steward:off
"com.typesafe.akka" %% "akka-actor" % "2.4.20",
"com.typesafe.akka" %% "akka-testkit" % "2.4.20" % Test
// scala-steward:on
),
sourceDirectory := baseDirectory.value.getParentFile / "metrics-akka" / "src",
mimaPreviousArtifacts := mimaPrevious(scalaVersion.value)
)
// 2.11.x are the only pre-2.12 scala versions that are used in this build
def before212(scalaVersion: String): Boolean = scalaVersion.startsWith("2.11.")
def mimaPrevious(scalaVersion: String): Set[ModuleID] = {
if (scalaVersion.startsWith("3."))
Set("nl.grons" %% "metrics4-scala" % "4.2.8")
else if (scalaVersion.startsWith("2.13."))
Set("nl.grons" %% "metrics4-scala" % "4.0.7")
else
Set("nl.grons" %% "metrics4-scala" % "4.0.1")
}
def scalacTargets(scalaVersion: String): Seq[String] = {
if (scalaVersion.startsWith("2.11.") || scalaVersion.startsWith("2.12.")) Seq("-target:jvm-1.8")
else if (scalaVersion.startsWith("2.13.")) Seq("-target:8")
else {
// Scala 3.1.2 or later. We cannot use 3.0 as Akka requires 3.1.
Seq("-scala-output-version:3.1", "-java-output-version:8")
}
}
// Config for sbt-github-actions plugin
ThisBuild / crossScalaVersions := Seq("2.12.18")
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
ThisBuild / githubWorkflowJavaVersions := Seq(
JavaSpec.temurin("8"),
JavaSpec.temurin("11"),
JavaSpec.temurin("17")
)