-
Notifications
You must be signed in to change notification settings - Fork 55
/
build.sbt
320 lines (302 loc) · 10.2 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/*
* Copyright 2016 Spotify AB.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import sbt._
import Keys._
val algebirdVersion = "0.13.10"
// Keep in sync with Scio: https://github.com/spotify/scio/blob/v0.14.0/build.sbt
val scioVersion = "0.14.3"
val avroVersion = avroCompilerVersion // keep in sync with scio
val beamVersion = "2.54.0" // keep in sync with scio
val beamVendorVersion = "0.1" // keep in sync with scio
val bigqueryVersion = "v2-rev20230812-2.0.0" // keep in sync with scio
val floggerVersion = "0.8" // keep in sync with scio + beam
val guavaVersion = "32.1.2-jre" // keep in sync with scio + beam
val hadoopVersion = "3.2.4" // keep in sync with scio
val jodaTimeVersion = "2.10.10" // keep in sync with scio
val parquetVersion = "1.13.1" // keep in sync with scio
val protoBufVersion = "3.25.1" // keep in sync with scio
val scalaTestVersion = "3.2.18"
val scalaCheckVersion = "1.18.1"
val scalaCollectionCompatVersion = "2.12.0"
val scoptVersion = "4.1.0"
val shapelessVersion = "2.3.10" // keep in sync with scio
val sourcecodeVersion = "0.4.2"
val slf4jVersion = "1.7.30" // keep in sync with scio
def isScala213x: Def.Initialize[Boolean] = Def.setting {
scalaBinaryVersion.value == "2.13"
}
val commonSettings = Sonatype.sonatypeSettings ++ releaseSettings ++ Seq(
organization := "com.spotify",
name := "ratatool",
description := "A tool for random data sampling and generation",
scalaVersion := "2.12.18",
crossScalaVersions := Seq("2.12.18", "2.13.12"),
resolvers ++= Resolver.sonatypeOssRepos("public"),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"), // @Todo remove when 0.14.0 released
scalacOptions ++= Seq("-target:8", "-deprecation", "-feature", "-unchecked", "-Yrangepos"),
scalacOptions ++= {
if (isScala213x.value) {
Seq("-Ymacro-annotations", "-Ywarn-unused")
} else {
Seq()
}
},
libraryDependencies ++= {
if (isScala213x.value) {
Seq()
} else {
Seq(
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion
)
}
},
excludeDependencies += "org.apache.beam" % "beam-sdks-java-io-kafka",
javacOptions ++= Seq("--release", "8", "-Xlint:unchecked"),
fork := true
)
ThisBuild / PB.protocVersion := protoBufVersion
lazy val protoBufSettings = Seq(
libraryDependencies ++= Seq(
"com.google.protobuf" % "protobuf-java" % protoBufVersion % "protobuf",
"com.google.protobuf" % "protobuf-java" % protoBufVersion
)
) ++ Seq(Compile, Test).flatMap(c =>
inConfig(c)(
Def.settings(
PB.targets := Seq(
PB.gens.java -> (ThisScope.copy(config = Zero) / sourceManaged).value /
"compiled_proto" /
Defaults.nameForSrc(configuration.value.name)
),
managedSourceDirectories ++= PB.targets.value.map(_.outputPath)
)
)
)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
lazy val releaseSettings = Seq(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishMavenStyle := true,
Test / publishArtifact := false,
publishTo := Some(
if (isSnapshot.value) Opts.resolver.sonatypeSnapshots else Opts.resolver.sonatypeStaging
),
sonatypeProfileName := "com.spotify",
licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/spotify/ratatool")),
scmInfo := Some(
ScmInfo(
url("https://github.com/spotify/ratatool.git"),
"scm:git:[email protected]:spotify/ratatool.git"
)
),
developers := List(
// current maintainers
Developer(
id = "anne-decusatis",
name = "Anne DeCusatis",
email = "[email protected]",
url = url("https://twitter.com/precisememory")
),
Developer(
id = "catherinejelder",
name = "Catherine Elder",
email = "[email protected]",
url = url("https://twitter.com/siegeelder")
),
Developer(
id = "idreeskhan",
name = "Idrees Khan",
email = "[email protected]",
url = url("https://twitter.com/idreesxkhan")
),
// past contributors
Developer(
id = "sinisa_lyh",
name = "Neville Li",
email = "[email protected]",
url = url("https://twitter.com/sinisa_lyh")
),
Developer(
id = "ravwojdyla",
name = "Rafal Wojdyla",
email = "[email protected]",
url = url("https://twitter.com/ravwojdyla")
),
Developer(
id = "benk",
name = "Ben Konz",
email = "[email protected]",
url = url("https://benkonz.github.io/")
)
)
)
lazy val ratatoolCommon = project
.in(file("ratatool-common"))
.settings(commonSettings)
.settings(
name := "ratatool-common",
libraryDependencies ++= Seq(
"org.apache.avro" % "avro" % avroVersion,
"com.google.guava" % "guava" % guavaVersion,
"com.google.apis" % "google-api-services-bigquery" % bigqueryVersion % Test,
"org.apache.avro" % "avro" % avroVersion % Test,
"org.apache.avro" % "avro" % avroVersion % Test classifier "tests",
"org.slf4j" % "slf4j-simple" % slf4jVersion % Test
)
)
.settings(protoBufSettings)
lazy val ratatoolSampling = project
.in(file("ratatool-sampling"))
.settings(commonSettings)
.settings(
name := "ratatool-sampling",
libraryDependencies ++= Seq(
"com.spotify" %% "scio-core" % scioVersion,
"com.spotify" %% "scio-avro" % scioVersion,
"com.spotify" %% "scio-parquet" % scioVersion,
"com.spotify" %% "scio-google-cloud-platform" % scioVersion,
"com.twitter" %% "algebird-core" % algebirdVersion,
"joda-time" % "joda-time" % jodaTimeVersion,
"org.apache.beam" % "beam-runners-google-cloud-dataflow-java" % beamVersion % Provided,
"com.spotify" %% "scio-test" % scioVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"org.scalatestplus" %% "scalacheck-1-17" % s"$scalaTestVersion.0" % Test
),
Test / parallelExecution := false
)
.dependsOn(
ratatoolCommon % "compile->compile;test->test",
ratatoolScalacheck % "test"
)
.settings(protoBufSettings)
lazy val ratatoolDiffy = project
.in(file("ratatool-diffy"))
.settings(commonSettings)
.settings(
name := "ratatool-diffy",
libraryDependencies ++= Seq(
"com.spotify" %% "scio-core" % scioVersion,
"com.spotify" %% "scio-parquet" % scioVersion,
"com.twitter" %% "algebird-core" % algebirdVersion,
"joda-time" % "joda-time" % jodaTimeVersion,
"com.spotify" %% "scio-test" % scioVersion % Test,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"org.apache.beam" % "beam-runners-google-cloud-dataflow-java" % beamVersion % Test
),
Test / parallelExecution := false,
libraryDependencies ++= {
if (isScala213x.value) {
Seq()
} else {
Seq(
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)
}
}
)
.dependsOn(
ratatoolCommon % "compile->compile;test->test",
ratatoolSampling % "compile->compile;test->test",
ratatoolScalacheck % "test"
)
.settings(protoBufSettings)
lazy val ratatoolShapeless = project
.in(file("ratatool-shapeless"))
.settings(commonSettings)
.settings(
name := "ratatool-shapeless",
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"org.scalacheck" %% "scalacheck" % scalaCheckVersion,
"org.scalatest" %% "scalatest" % scalaTestVersion % "test"
),
Test / parallelExecution := false
)
.dependsOn(
ratatoolDiffy,
ratatoolSampling
)
lazy val ratatoolCli = project
.in(file("ratatool-cli"))
.settings(commonSettings ++ noPublishSettings)
.settings(
name := "ratatool-cli",
libraryDependencies ++= Seq(
"com.github.scopt" %% "scopt" % scoptVersion,
"org.apache.beam" % "beam-runners-direct-java" % beamVersion,
"org.apache.beam" % "beam-runners-google-cloud-dataflow-java" % beamVersion,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
)
)
.enablePlugins(PackPlugin)
.dependsOn(
ratatoolCommon % "compile->compile;test->test",
ratatoolSampling,
ratatoolDiffy
)
.settings(protoBufSettings)
lazy val ratatoolScalacheck = project
.in(file("ratatool-scalacheck"))
.settings(commonSettings)
.settings(
name := "ratatool-scalacheck",
libraryDependencies ++= Seq(
"org.apache.avro" % "avro" % avroVersion,
"joda-time" % "joda-time" % jodaTimeVersion,
"org.scalacheck" %% "scalacheck" % scalaCheckVersion,
"com.lihaoyi" %% "sourcecode" % sourcecodeVersion,
"com.google.apis" % "google-api-services-bigquery" % bigqueryVersion % Provided,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test,
"org.scalatestplus" %% "scalacheck-1-17" % s"$scalaTestVersion.0" % Test
)
)
.dependsOn(ratatoolCommon % "compile->compile;test->test")
.settings(protoBufSettings)
lazy val ratatoolExamples = project
.in(file("ratatool-examples"))
.settings(commonSettings ++ noPublishSettings)
.settings(
name := "ratatool-examples",
libraryDependencies ++= Seq(
"com.google.apis" % "google-api-services-bigquery" % bigqueryVersion,
"com.spotify" %% "scio-test" % scioVersion % Test,
"org.scalatestplus" %% "scalacheck-1-17" % s"$scalaTestVersion.0" % Test
)
)
.dependsOn(
ratatoolCommon % "compile->test",
ratatoolScalacheck,
ratatoolDiffy
)
.settings(protoBufSettings)
val root = project
.in(file("."))
.settings(commonSettings ++ noPublishSettings)
.aggregate(
ratatoolCommon,
ratatoolScalacheck,
ratatoolDiffy,
ratatoolSampling,
ratatoolShapeless,
ratatoolCli,
ratatoolExamples
)