-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
158 lines (147 loc) · 4.38 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
import Dependencies._
import sbtrelease.ReleaseStateTransformations._
import sbtrelease.ReleasePlugin.autoImport._
lazy val scala2_13 = "2.13.6"
lazy val supportedScalaVersions = List(scala2_13)
ThisBuild / scalaVersion := scala2_13
lazy val fdb4s = project
.in(file("."))
.settings(commonSettings: _*)
.settings(publish / skip := true, crossScalaVersions := Nil)
.aggregate(akkaStreams, core, example, schema)
lazy val core = project
.in(file("core"))
.settings(
commonSettings,
name := "core",
libraryDependencies ++= allCoreDependencies,
crossScalaVersions := supportedScalaVersions
)
lazy val schema = project
.in(file("schema"))
.dependsOn(core % "compile->compile;test->test")
.settings(
commonSettings,
name := "schema",
libraryDependencies ++= allSchemaDependencies,
crossScalaVersions := supportedScalaVersions
)
lazy val akkaStreams = project
.in(file("akka-streams"))
.dependsOn(core % "compile->compile;test->test")
.settings(
commonSettings,
name := "akka-streams",
libraryDependencies ++= allAkkaStreamsDependencies,
crossScalaVersions := supportedScalaVersions
)
lazy val example = project
.in(file("example"))
.dependsOn(schema)
.settings(
commonSettings,
name := "example",
publish / skip := true,
crossScalaVersions := supportedScalaVersions,
coverageEnabled := false
)
lazy val commonSettings = ossPublishSettings ++ Seq(
organization := "com.github.pwliwanow.foundationdb4s",
scalaVersion := scala2_13,
scalafmtOnCompile := true,
parallelExecution := false,
fork := true,
scalacOptions ++= {
List(
"-unchecked",
"-deprecation",
"-encoding",
"UTF-8",
"-explaintypes",
"-feature",
"-language:higherKinds",
"-language:implicitConversions",
"-Xlint:inaccessible",
"-Xlint:infer-any",
"-Ywarn-dead-code",
"-Ywarn-unused:imports",
"-Ywarn-unused:locals",
"-Ywarn-unused:patvars",
"-Ywarn-unused:privates",
"-Xfatal-warnings"
)
},
Compile / doc / scalacOptions ++= Seq(
"-no-link-warnings"
)
)
lazy val ossPublishSettings = Seq(
publishTo := {
if (isSnapshot.value) Some(Opts.resolver.sonatypeSnapshots)
else sonatypePublishToBundle.value
},
Test / publishArtifact := false,
publishMavenStyle := true,
sonatypeProfileName := "com.github.pwliwanow",
pomIncludeRepository := { _ =>
false
},
credentials += Credentials(Path.userHome / ".sbt" / ".credentials"),
organizationHomepage := Some(url("https://github.com/pwliwanow/foundationdb4s")),
homepage := Some(url("https://github.com/pwliwanow/foundationdb4s")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
scmInfo := Some(
ScmInfo(
url("https://github.com/pwliwanow/foundationdb4s"),
"scm:git:https://github.com/pwliwanow/foundationdb4s.git"
)
),
autoAPIMappings := true,
developers := List(
Developer(
id = "pwliwanow",
name = "Pawel Iwanow",
email = "pwliwanow@gmail.com",
url = new URL("https://github.com/pwliwanow/")
)
),
// sbt-release
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseIgnoreUntrackedFiles := true,
releaseProcess := Seq(
checkSnapshotDependencies,
inquireVersions,
// publishing locally so that the pgp password prompt is displayed early
// in the process
releaseStepCommandAndRemaining("+publishLocalSigned"),
releaseStepCommandAndRemaining("+clean"),
releaseStepCommandAndRemaining("+test"),
setReleaseVersion,
releaseStepTask(updateVersionInReadme),
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
)
lazy val updateVersionInReadme =
taskKey[Unit]("Updates version in README.md to the one present in version.sbt")
updateVersionInReadme := {
import java.io.PrintWriter
import scala.io.Source
val pattern = """val fdb4sVersion = "([^\"]*)""""
val source = Source.fromFile("README.md")
val updatedReadme = source
.getLines()
.map { line =>
if (line.matches(pattern)) s"""val fdb4sVersion = "${version.value}""""
else line
}
.mkString("\n") + "\n"
source.close()
new PrintWriter("README.md") { write(updatedReadme); close() }
}