forked from stripe/rainier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
193 lines (174 loc) · 5.76 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
189
190
191
192
193
lazy val root = project.
in(file(".")).
aggregate(rainierCore, rainierPlot, rainierCats, rainierScalacheck).
aggregate(rainierDocs, rainierExample).
aggregate(rainierBenchmark, rainierTests).
aggregate(shadedAsm).
settings(commonSettings).
settings(unpublished)
scalafmtOnCompile in ThisBuild := true
lazy val commonSettings = Seq(
organization:= "com.stripe",
scalaVersion := "2.12.4",
crossScalaVersions := List("2.11.12", "2.12.4"),
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
homepage := Some(url("https://github.com/stripe/rainier")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
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")
},
autoAPIMappings := true,
apiURL := Some(url("https://stripe.github.io/rainier/api/")),
scmInfo := Some(
ScmInfo(
url("https://github.com/stripe/rainier"),
"scm:git:[email protected]:stripe/rainier.git"
)
),
developers := List(
Developer("avibryant", "Avi Bryant", "", url("https://twitter.com/avibryant"))
),
)
lazy val unpublished = Seq(publish := {}, publishLocal := {}, publishArtifact := false)
// evilplot is 2.12 only, so these settings are needed for projects
// depending on evilplot
lazy val evilPlotCrossSettings = Seq(
crossScalaVersions ~= { _.filter(_.startsWith("2.12")) })
/* dependency versions */
lazy val V = new {
val asm = "6.0"
val cats = "1.1.0"
val evilplot = "0.2.0"
val scalacheck = "1.14.0"
val scalatest = "3.0.5"
}
// primary modules
lazy val rainierCore = project.
in(file("rainier-core")).
settings(name := "rainier-core").
dependsOn(shadedAsm).
settings(commonSettings)
lazy val rainierPlot = project.
in(file("rainier-plot")).
settings(name := "rainier-plot").
dependsOn(rainierCore).
settings(commonSettings).
settings(evilPlotCrossSettings).
settings(
resolvers += Resolver.bintrayRepo("cibotech", "public"),
libraryDependencies += "com.cibo" %% "evilplot" % V.evilplot)
lazy val rainierCats = project.
in(file("rainier-cats")).
settings(name := "rainier-cats").
dependsOn(rainierCore).
dependsOn(rainierScalacheck % "test").
settings(commonSettings).
settings(libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % V.cats))
lazy val rainierScalacheck = project.
in(file("rainier-scalacheck")).
settings(name := "rainier-scalacheck").
dependsOn(rainierCore).
settings(commonSettings).
settings(libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % V.cats,
"org.scalacheck" %% "scalacheck" % V.scalacheck))
// documentation modules
lazy val rainierDocs = project.
in(file("rainier-docs")).
settings(name := "rainier-docs").
enablePlugins(TutPlugin).
dependsOn(rainierCore).
settings(commonSettings).
settings(
scalacOptions in Tut ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Yno-predef", "-Ywarn-unused:imports"))
},
// todo: uncomment once docs generation is deterministic
// tutTargetDirectory := (baseDirectory in LocalRootProject).value / "docs"
).
settings(unpublished)
lazy val rainierExample = project.
in(file("rainier-example")).
settings(name := "rainier-example").
dependsOn(
rainierCore,
rainierPlot,
).
settings(commonSettings).
settings(evilPlotCrossSettings).
settings(unpublished)
// test modules
lazy val rainierBenchmark = project.
in(file("rainier-benchmark")).
settings(name := "rainier-benchmark").
enablePlugins(JmhPlugin).
settings(
scalacOptions ~= (_.filterNot(Set(
"-Ywarn-value-discard")))).
dependsOn(rainierCore).
settings(commonSettings).
settings(unpublished)
lazy val rainierTests = project.
in(file("rainier-tests")).
settings(name := "rainier-tests").
dependsOn(
rainierCore,
rainierCats,
rainierScalacheck,
).
settings(commonSettings).
settings(libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % V.scalatest,
"org.scalacheck" %% "scalacheck" % V.scalacheck,
"org.typelevel" %% "cats-laws" % V.cats,
"org.typelevel" %% "cats-testkit" % V.cats)).
settings(unpublished)
// shaded asm dep trickery
/* publishable project with the shaded deps */
lazy val shadedAsm = project.
in(file(".rainier-shaded-asm")).
settings(name := "rainier-shaded-asm").
settings(commonSettings).
settings(
// note: bump version suffix when the shaded asm jar needs to be
// republished for a particular version of the underlying asm lib
version := s"${V.asm}_0",
crossPaths := false,
autoScalaLibrary := false,
exportJars := true,
packageBin in Compile := (assembly in asmDeps).value,
releaseVersion := { ver => ver }
)
/* phantom project to bundle deps for shading */
lazy val asmDeps = project.
in(file(".asm-deps")).
settings(libraryDependencies ++= Seq(
"org.ow2.asm" % "asm" % V.asm,
"org.ow2.asm" % "asm-tree" % V.asm)).
settings(commonSettings).
settings(
crossPaths := false,
autoScalaLibrary := false,
assemblyOption in assembly := (assemblyOption in assembly).value.copy(
includeBin = false,
includeDependency = true,
includeScala = false),
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("org.objectweb.asm.**" -> "com.stripe.rainier.internal.asm.@1").inAll),
assemblyMergeStrategy in assembly := {
case "module-info.class" => MergeStrategy.discard
case other =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(other)
},
).
settings(unpublished)