-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
84 lines (79 loc) · 3.08 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
import ReleaseTransformations._
scalaVersion := Version.Scala
lazy val `vitess` =
project
.in(file("."))
.enablePlugins(AutomateHeaderPlugin, GitVersioning)
.settings(Build.preventPublication)
.settings(Build.commonSettings)
.aggregate(`vitess-shade`, `vitess-quill`, `vitess-client`)
lazy val `vitess-client` =
project
.in(file("vitess-client"))
.enablePlugins(AutomateHeaderPlugin)
.enablePlugins(CrossPerProjectPlugin)
.settings(Build.commonSettings)
.settings(
PB.targets in Compile := Seq(
scalapb.gen(singleLineToString = true) -> (sourceManaged in Compile).value
),
libraryDependencies ++= Library.Client.dependenciesToShade ++ Library.Client.nonShadedDependencies ++ Seq(
Library.scalaTest % Test
)
)
lazy val `vitess-shade` =
project
.in(file("vitess-shade"))
.enablePlugins(AutomateHeaderPlugin)
.enablePlugins(CrossPerProjectPlugin)
.settings(Build.commonSettings)
.settings(
// Just get whatever asset is built in vitess-client
exportedProducts in Compile := (exportedProducts in Compile in `vitess-client`).value,
// This is the total classpath stolen from the non shaded version
fullClasspath in assembly := {
val f = (externalDependencyClasspath in Compile in `vitess-client`).value
val e = (exportedProducts in Compile in `vitess-client`).value
f ++ e
},
// fullClasspath in assembly := (fullClasspath in Compile).value,
// Protobuf is already included so we only add slf4j
libraryDependencies ++= Seq(Library.slf4j),
assemblyOption in assembly := (assemblyOption in assembly).value
.copy(includeScala = false, includeDependency = true),
// We only really need to rename netty because of shitty 4.0 vs 4.1 issues.
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("io.netty.**" -> "shadenetty.@1").inAll
),
assemblyMergeStrategy in assembly := {
case x if x.endsWith("io.netty.versions.properties") => MergeStrategy.first
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
},
publishArtifact in (Compile, packageBin) := false,
assemblyExcludedJars in assembly := {
val cp = (fullClasspath in assembly).value
cp filter {
// We keep google protobuf and slf4j since they work with most stuff
case f if f.data.getName.startsWith("protobuf-java") => true
case f if f.data.getName.startsWith("slf4j") => true
// Include the rest
case f => false
}
},
addArtifact(artifact in Compile, assembly)
)
lazy val `vitess-quill` =
project
.in(file("vitess-quill"))
.enablePlugins(AutomateHeaderPlugin)
.enablePlugins(CrossPerProjectPlugin)
.settings(Build.commonSettings)
.settings(
libraryDependencies ++= Seq(
Library.`quill-sql`
),
crossScalaVersions := Seq(Version.Scala211),
unmanagedJars in Compile := Seq((assembly in (`vitess-shade`, assembly)).value).classpath
)