forked from cb372/scalacache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
188 lines (170 loc) · 5.62 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
inThisBuild(
List(
organization := "com.github.cb372",
homepage := Some(url("https://github.com/cb372/scalacache")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"cb372",
"Chris Birchall",
url("https://twitter.com/cbirchall")
)
)
)
)
scalafmtOnCompile in ThisBuild := true
lazy val root: Project = Project(id = "scalacache", base = file("."))
.settings(
commonSettings,
publishArtifact := false
)
.aggregate(
core,
memcached,
redis,
caffeine,
circe,
tests
)
lazy val core =
Project(id = "core", file("modules/core"))
.settings(commonSettings)
.settings(
moduleName := "scalacache-core",
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.slf4j" % "slf4j-api" % "1.7.30",
"org.typelevel" %% "cats-effect" % "3.0.2",
scalatest,
scalacheck
),
coverageMinimum := 60,
coverageFailOnMinimum := true
)
def createModule(name: String) =
Project(id = name, base = file(s"modules/$name"))
.settings(commonSettings)
.settings(
moduleName := s"scalacache-$name",
libraryDependencies += scalatest
)
.dependsOn(core)
lazy val memcached = createModule("memcached")
.settings(
libraryDependencies ++= Seq(
"net.spy" % "spymemcached" % "2.12.3"
)
)
lazy val redis = createModule("redis")
.settings(
libraryDependencies ++= Seq(
"redis.clients" % "jedis" % "2.10.2"
),
coverageMinimum := 56,
coverageFailOnMinimum := true
)
lazy val caffeine = createModule("caffeine")
.settings(
libraryDependencies ++= Seq(
"com.github.ben-manes.caffeine" % "caffeine" % "2.9.0",
"org.typelevel" %% "cats-effect-testkit" % "3.0.2" % Test,
"com.google.code.findbugs" % "jsr305" % "3.0.2" % Provided
),
coverageMinimum := 80,
coverageFailOnMinimum := true
)
lazy val circe = createModule("circe")
.settings(
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % "0.13.0",
"io.circe" %% "circe-parser" % "0.13.0",
"io.circe" %% "circe-generic" % "0.13.0" % Test,
scalacheck,
scalatestplus
),
coverageMinimum := 80,
coverageFailOnMinimum := true
)
lazy val tests = createModule("tests")
.settings(publishArtifact := false)
.dependsOn(caffeine, memcached, redis, circe)
lazy val docs = createModule("docs")
.enablePlugins(MicrositesPlugin)
.settings(
publishArtifact := false,
micrositeName := "ScalaCache",
micrositeAuthor := "Chris Birchall",
micrositeDescription := "A facade for the most popular cache implementations, with a simple, idiomatic Scala API.",
micrositeBaseUrl := "/scalacache",
micrositeDocumentationUrl := "/scalacache/docs",
micrositeHomepage := "https://github.com/cb372/scalacache",
micrositeGithubOwner := "cb372",
micrositeGithubRepo := "scalacache",
micrositeGitterChannel := true,
micrositeTwitterCreator := "@cbirchall",
micrositeShareOnSocial := true,
mdocIn := (sourceDirectory in Compile).value / "mdoc"
)
.dependsOn(
core,
memcached,
redis,
caffeine,
circe
)
lazy val benchmarks = createModule("benchmarks")
.enablePlugins(JmhPlugin)
.settings(
publishArtifact := false,
fork in (Compile, run) := true,
javaOptions in Jmh ++= Seq("-server", "-Xms2G", "-Xmx2G", "-XX:+UseG1GC", "-XX:-UseBiasedLocking"),
javaOptions in (Test, run) ++= Seq(
"-XX:+UnlockCommercialFeatures",
"-XX:+FlightRecorder",
"-XX:StartFlightRecording=delay=20s,duration=60s,filename=memoize.jfr",
"-server",
"-Xms2G",
"-Xmx2G",
"-XX:+UseG1GC",
"-XX:-UseBiasedLocking"
)
)
.dependsOn(caffeine)
lazy val scalatest = "org.scalatest" %% "scalatest" % "3.2.8" % Test
lazy val scalacheck = "org.scalacheck" %% "scalacheck" % "1.15.3" % Test
lazy val scalatestplus = "org.scalatestplus" %% "scalacheck-1-15" % "3.2.5.0" % Test
lazy val commonSettings =
mavenSettings ++
Seq(
organization := "com.github.cb372",
scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-language:higherKinds"),
parallelExecution in Test := false
)
lazy val mavenSettings = Seq(
publishArtifact in Test := false,
pomIncludeRepository := { _ =>
false
}
)
val Scala213 = "2.13.3"
val Scala212 = "2.12.12"
val Jdk11 = "[email protected]"
ThisBuild / scalaVersion := Scala213
ThisBuild / crossScalaVersions := Seq(Scala213, Scala212)
ThisBuild / githubWorkflowJavaVersions := Seq(Jdk11)
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("scalafmtCheckAll"), name = Some("Check Formatting")),
WorkflowStep.Run(List("docker-compose up -d"), name = Some("Setup Dependencies")),
WorkflowStep.Sbt(List("test"), name = Some("Run Tests")),
WorkflowStep.Sbt(List("docs/mdoc"), name = Some("Compile Docs")),
WorkflowStep.Sbt(List("benchmarks/compile"), name = Some("Compile Benchmarks"))
)
//sbt-ci-release settings
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v")))
ThisBuild / githubWorkflowPublishPreamble := Seq(WorkflowStep.Use(UseRef.Public("olafurpg", "setup-gpg", "v3")))
ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("ci-release")))
ThisBuild / githubWorkflowEnv ++= List("PGP_PASSPHRASE", "PGP_SECRET", "SONATYPE_PASSWORD", "SONATYPE_USERNAME").map { envKey =>
envKey -> s"$${{ secrets.$envKey }}"
}.toMap