forked from TouK/influxdb-reporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
170 lines (157 loc) · 6.53 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
import sbt.Keys._
import sbtrelease.Version
val defaultScalaVersion = "3.3.1"
val scalaVersions = Seq("2.11.12", "2.12.18", "2.13.12", defaultScalaVersion)
val asyncHttpClientV = "2.12.3"
val dropwizardMetricsV = "4.0.2"
val findbugsV = "3.0.1"
val hikariCPV = "3.2.0"
val junitV = "4.12"
val logbackV = "1.2.11"
val nettyV = "4.1.104.Final"
val scalaCompatV = "2.11.0"
val scalaLoggingV = "3.9.5"
val scalaTestV = "3.2.17"
val scalaTestMockitoV = "3.2.10.0"
val typesafeConfigV = "1.4.3"
val wiremockV = "2.27.2"
val commonSettings =
Seq(
crossScalaVersions := scalaVersions,
scalaVersion := defaultScalaVersion,
organization := "pl.touk",
javacOptions ++= Seq("-source", "1.8", "-target", "1.8"),
scalacOptions := forScalaVersion(scalaVersion.value)(
forScala3 = Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-Ysafe-init", "-Xfatal-warnings", "-feature"),
forScala2 = Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-Xcheckinit", "-Xfatal-warnings", "-feature"),
),
licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/touk/influxdb-reporter")),
parallelExecution in Test := false
)
val sonatypePublishSettings = Seq(
isSnapshot := version(Version(_).get.qualifier.exists(_ == "-SNAPSHOT")).value,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishMavenStyle := true,
publishTo in ThisBuild := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
sonatypePublishToBundle.value
},
publishArtifact in Test := false,
pomExtra in Global := {
<scm>
<connection>scm:git:github.com/touk/influxdb-reporter.git</connection>
<developerConnection>scm:git:[email protected]:touk/influxdb-reporter.git</developerConnection>
<url>github.com/touk/influxdb-reporter</url>
</scm>
<developers>
<developer>
<id>coutoPL</id>
<name>Mateusz Kołodziejczyk</name>
<url>https://github.com/coutoPL</url>
</developer>
</developers>
}
)
import ReleaseTransformations._
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
lazy val root = (project in file("."))
.settings(name := "influx-reporter")
.settings(commonSettings)
.settings(
publish := {},
publishLocal := {}
)
.aggregate(core, httpClient, httpClientJavaWrapper, hikariCPTracker)
lazy val core = project.in(file("core"))
.settings(commonSettings)
.settings(sonatypePublishSettings)
.settings(
name := "influxdb-reporter-core",
libraryDependencies ++= {
Seq(
"io.dropwizard.metrics" % "metrics-core" % dropwizardMetricsV,
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCompatV,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingV,
"ch.qos.logback" % "logback-classic" % logbackV % Test,
"org.scalatest" %% "scalatest" % scalaTestV % Test,
"org.scalatestplus" %% "mockito-3-4" % scalaTestMockitoV % Test
)
})
lazy val httpClient = project.in(file("http-client"))
.settings(commonSettings)
.settings(sonatypePublishSettings)
.settings(
name := "influxdb-reporter-http-client",
libraryDependencies ++= {
Seq(
"com.typesafe" % "config" % typesafeConfigV,
"org.asynchttpclient" % "async-http-client" % asyncHttpClientV,
// async-http-client 2.12.3 uses netty 4.1.60.Final, which has known security vulnerabilities,
// this project depends directly on netty 4.1.75.Final
"io.netty" % "netty-common" % nettyV,
"io.netty" % "netty-buffer" % nettyV,
"io.netty" % "netty-codec" % nettyV,
"io.netty" % "netty-codec-dns" % nettyV,
"io.netty" % "netty-codec-http" % nettyV,
"io.netty" % "netty-codec-socks" % nettyV,
"io.netty" % "netty-handler" % nettyV,
"io.netty" % "netty-handler-proxy" % nettyV,
"io.netty" % "netty-resolver" % nettyV,
"io.netty" % "netty-resolver-dns" % nettyV,
"io.netty" % "netty-transport" % nettyV,
"ch.qos.logback" % "logback-classic" % logbackV % Test,
"org.scalatest" %% "scalatest" % scalaTestV % Test,
"com.github.tomakehurst" % "wiremock" % wiremockV % Test
)
}
)
.dependsOn(core)
lazy val httpClientJavaWrapper = project.in(file("http-client-java-wrapper"))
.settings(commonSettings)
.settings(sonatypePublishSettings)
.settings(
name := "influxdb-reporter-http-client-java-wrapper",
javacOptions in doc := Seq("-source", "1.8"),
libraryDependencies ++= {
Seq(
"com.google.code.findbugs" % "jsr305" % findbugsV,
"junit" % "junit" % junitV % Test
)
}
)
.dependsOn(httpClient)
lazy val hikariCPTracker = project.in(file("hikariCP-tracker"))
.settings(commonSettings)
.settings(sonatypePublishSettings)
.settings(
name := "influxdb-reporter-hikariCP-tracker",
javacOptions in doc := Seq("-source", "1.8"),
libraryDependencies ++= {
Seq(
"com.zaxxer" % "HikariCP" % hikariCPV
)
}
)
.dependsOn(httpClientJavaWrapper)
def forScalaVersion[T](scalaV: String)(forScala3: T, forScala2: T): T = CrossVersion.partialVersion(scalaV) match {
case Some((3, _)) => forScala3
case Some((2, _)) => forScala2
case _ => throw new Exception(s"Not supported Scala version $scalaV")
}