-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathbuild.sbt
165 lines (151 loc) · 6.2 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
import sbt.Keys.scalaVersion
import sbt.librarymanagement.{CrossVersion, ModuleID}
import xerial.sbt.Sonatype.sonatypeCentralHost
val scala213 = "2.13.16"
lazy val commonSettings = Seq(
organization := "nl.grons",
scalaVersion := scala213,
crossVersion := CrossVersion.binary,
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"org.mockito" % "mockito-core" % "5.15.2" % Test,
"org.slf4j" % "slf4j-simple" % "2.0.16" % 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("--release", "11", "-J-Xmx512m", "-J-Xms128m", "-J-Xss10m"),
javaOptions ++= Seq("-Xmx512m", "-Djava.awt.headless=true"),
scalacOptions ++= scalacTargets(scalaVersion.value) ++ Seq("-deprecation", "-unchecked"),
publishTo := sonatypePublishToBundle.value,
sonatypeCredentialHost := sonatypeCentralHost,
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, metricsAkka25, metricsAkka26, metricsPekko)
.settings(
crossScalaVersions := Nil,
publishArtifact := false,
publish / skip := true,
publish := {},
publishLocal := {},
name := "metrics4-scala-root",
sonatypeProfileName := "nl.grons",
mimaPreviousArtifacts := Set.empty,
)
lazy val metricsScala = project
.in(file("metrics-scala"))
.settings(
commonSettings,
crossScalaVersions := Seq("3.3.4", scala213, "2.12.20", "2.11.12"),
name := "metrics4-scala",
description := "metrics-scala for Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
"io.dropwizard.metrics" % "metrics-core" % "4.2.30",
"io.dropwizard.metrics" % "metrics-healthchecks" % "4.2.30"
),
mimaPreviousArtifacts := mimaPrevious(name.value, scalaVersion.value)
)
lazy val metricsScalaHdr = project
.in(file("metrics-scala-hdr"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("3.3.4", scala213, "2.12.20", "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.2.2"
),
mimaPreviousArtifacts := mimaPrevious(name.value, scalaVersion.value)
)
lazy val metricsPekko = project
.in(file("metrics-pekko"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("3.3.4", scala213, "2.12.20"),
name := "metrics4-pekko",
description := "metrics-scala for pekko 1.0 and Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-actor" % "1.1.3",
"org.apache.pekko" %% "pekko-testkit" % "1.1.3" % Test
),
sourceDirectory := baseDirectory.value.getParentFile / "metrics-pekko" / "src",
mimaPreviousArtifacts := Set("nl.grons" %% "metrics4-pekko" % "4.3.2")
)
lazy val metricsAkka26 = project
.in(file("metrics-akka-26"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq("3.3.4", scala213, "2.12.20"),
name := "metrics4-akka_a26",
description := "metrics-scala for Akka 2.6 and Scala " + CrossVersion.binaryScalaVersion(scalaVersion.value),
libraryDependencies ++= Seq(
// Stay on Akka 2.6, later versions are not open source:
// scala-steward:off
"com.typesafe.akka" %% "akka-actor" % "2.6.20",
"com.typesafe.akka" %% "akka-testkit" % "2.6.20" % Test
// scala-steward:on
),
sourceDirectory := baseDirectory.value.getParentFile / "metrics-akka" / "src",
mimaPreviousArtifacts := mimaPrevious(name.value, scalaVersion.value)
)
lazy val metricsAkka25 = project
.in(file("metrics-akka-25"))
.dependsOn(metricsScala)
.settings(
commonSettings,
crossScalaVersions := Seq(scala213, "2.12.20"),
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(name.value, 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(module: String, scalaVersion: String): Set[ModuleID] =
Set("nl.grons" %% module % "4.2.8")
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("-release:11")
else {
// Scala 3.3.0+
Seq("-java-output-version:11")
}
}
// Config for sbt-github-actions plugin
ThisBuild / crossScalaVersions := Seq(scala213)
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
ThisBuild / githubWorkflowJavaVersions := Seq(
JavaSpec.temurin("11"),
JavaSpec.temurin("17"),
JavaSpec.temurin("21")
)