-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
134 lines (122 loc) · 4.36 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
import sbt.Keys.publishArtifact
import ReleaseTransformations._
val monocleVersion = "2.1.0"
val doobieVersion = "1.0.0-RC2"
val influxDbVersion = "2.9"
val readme = "README.md"
val readmePath = file(".") / readme
val copyReadme =
taskKey[File](s"Copy readme file to project root")
val Scala213 = "2.13.3"
val baseSettings = Seq(
organization := "com.itv",
name := "servicebox",
scalaVersion := Scala213,
scalacOptions ++= Seq(
"-target:jvm-1.8",
"-encoding",
"UTF-8",
"-deprecation",
"-feature",
"-language:higherKinds",
"-Xfatal-warnings",
),
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.9.0",
"org.typelevel" %% "cats-effect" % "3.5.0",
"org.typelevel" %% "kittens" % "3.0.0",
"org.scalatest" %% "scalatest" % "3.2.15" % "test",
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion,
"ch.qos.logback" % "logback-classic" % "1.4.6",
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.5",
compilerPlugin("org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full)
)
)
val artefactSettings = baseSettings ++ Seq(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion,
pushChanges
),
releaseCrossBuild := true,
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ =>
false
},
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
pgpPublicRing := file("./ci/public.asc"),
pgpSecretRing := file("./ci/private.asc"),
pgpSigningKey := Some(-5373332187933973712L),
pgpPassphrase := Option(System.getenv("GPG_KEY_PASSPHRASE")).map(_.toArray),
homepage := Some(url("https://github.com/itv/servicebox")),
scmInfo := Some(ScmInfo(url("https://github.com/itv/servicebox"), "[email protected]:itv/servicebox.git")),
developers := List(Developer("afiore", "Andrea Fiore", "[email protected]", url("https://github.com/afiore"))),
licenses += ("ITV Open Source Software Licence", url("http://itv.com/itv-oss-licence-v1.0")),
publishMavenStyle := true,
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USER"))
password <- Option(System.getenv().get("SONATYPE_PASS"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
)
def withDeps(p: Project)(dep: Project*): Project = p.dependsOn(dep.map(_ % "compile->compile;test->test"): _*)
lazy val core = (project in file("core"))
.settings(
artefactSettings,
)
.settings(
moduleName := "servicebox-core"
)
lazy val docker = withDeps(
(project in file("docker"))
.settings(
artefactSettings ++ Seq(
moduleName := "servicebox-docker",
libraryDependencies ++= Seq(
"com.spotify" % "docker-client" % "8.16.0"
)
)))(core)
lazy val example = withDeps(
(project in file("example"))
.enablePlugins(MdocPlugin)
.settings(baseSettings ++ Seq(
libraryDependencies ++= Seq(
"org.flywaydb" % "flyway-core" % "4.2.0",
"org.postgresql" % "postgresql" % "42.5.4",
"org.tpolecat" %% "doobie-core" % doobieVersion,
"org.tpolecat" %% "doobie-postgres" % doobieVersion,
"org.influxdb" % "influxdb-java" % influxDbVersion
),
mdocIn := baseDirectory.value / "src" / "main" / "mdoc",
scalacOptions in Compile ~= {
// https://github.com/scalameta/mdoc/issues/210
_.filterNot(Set("-Xfatal-warnings"))
},
copyReadme := {
val mdocDir = mdocOut.value
val log = streams.value.log
log.info(s"Copying ${mdocDir / readme} to ${file(".") / readme}")
IO.copyFile(
mdocDir / readme,
readmePath
)
readmePath
}
)))(core, docker)
lazy val root = (project in file("."))
.aggregate(core, docker)
.settings(artefactSettings)