-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.sbt
163 lines (143 loc) · 4.82 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
ThisBuild / organization := "com.thesamet.scalapb"
ThisBuild / scalacOptions ++= Seq("-deprecation", "-release:8")
ThisBuild / javacOptions ++= List("-target", "8", "-source", "8")
Global / concurrentRestrictions := Seq(
Tags.limit(Tags.Test, 1)
)
val Scala212 = "2.12.20"
val Scala213 = "2.13.15"
lazy val Spark35 = Spark("3.5.3")
lazy val Spark34 = Spark("3.4.4")
lazy val Spark33 = Spark("3.3.4")
lazy val Spark32 = Spark("3.2.3")
lazy val Spark31 = Spark("3.1.3")
lazy val ScalaPB0_11 = ScalaPB("0.11.17")
lazy val ScalaPB0_10 = ScalaPB("0.10.11")
lazy val framelessDatasetName = settingKey[String]("frameless-dataset-name")
lazy val framelessDatasetVersion = settingKey[String]("frameless-dataset-version")
lazy val spark = settingKey[Spark]("spark")
lazy val scalapb = settingKey[ScalaPB]("scalapb")
def scalapbPlugin(version: String) =
protocbridge.SandboxedJvmGenerator.forModule(
s"scala${version}",
protocbridge.Artifact(
"com.thesamet.scalapb",
"compilerplugin_2.12",
version
),
"scalapb.ScalaPbCodeGenerator$",
Nil
)
lazy val `sparksql-scalapb` = (projectMatrix in file("sparksql-scalapb"))
.defaultAxes()
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% framelessDatasetName.value % framelessDatasetVersion.value,
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.value.scalapbVersion,
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.value.scalapbVersion % "protobuf",
"org.apache.spark" %% "spark-sql" % spark.value.sparkVersion % "provided",
"org.apache.spark" %% "spark-sql" % spark.value.sparkVersion % "test",
"org.scalatest" %% "scalatest" % "3.2.19" % "test",
"org.scalatestplus" %% "scalacheck-1-17" % "3.2.18.0" % "test",
"com.github.alexarchambault" %% "scalacheck-shapeless_1.16" % "1.3.1" % "test"
),
spark := {
virtualAxes.value
.collectFirst { case x: Spark =>
x
}
.getOrElse(
throw new RuntimeException(
s"Could not find Spark version in virtualAxes. Got $virtualAxes"
)
)
},
scalapb := {
virtualAxes.value
.collectFirst { case x: ScalaPB =>
x
}
.getOrElse(
throw new RuntimeException(
s"Could not find ScalaPB version in virtualAxes. Got $virtualAxes"
)
)
},
framelessDatasetName := {
spark.value match {
case Spark35 | Spark34 | Spark33 => "frameless-dataset"
case Spark32 => "frameless-dataset-spark32"
case Spark31 => "frameless-dataset-spark31"
case _ => ???
}
},
framelessDatasetVersion := {
spark.value match {
case Spark35 | Spark34 | Spark33 => "0.16.0" // NPE in 3.4, 3.5 if older lib versions used
case Spark32 => "0.15.0" // Spark3.2 support dropped in ver > 0.15.0
case Spark31 => "0.14.0" // Spark3.1 support dropped in ver > 0.14.0
case _ => ???
}
},
name := s"sparksql${spark.value.majorVersion}${spark.value.minorVersion}-${scalapb.value.idSuffix}",
inConfig(Test)(
sbtprotoc.ProtocPlugin.protobufConfigSettings
),
Test / PB.targets := Seq(
scalapbPlugin(scalapb.value.scalapbVersion) -> (Test / sourceManaged).value
),
Test / run / fork := true,
Test / javaOptions ++= Seq("-Xmx2G")
)
.customRow(
scalaVersions = Seq(Scala212, Scala213),
axisValues = Seq(Spark35, ScalaPB0_11, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212, Scala213),
axisValues = Seq(Spark34, ScalaPB0_11, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212, Scala213),
axisValues = Seq(Spark33, ScalaPB0_11, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212, Scala213),
axisValues = Seq(Spark32, ScalaPB0_11, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212),
axisValues = Seq(Spark31, ScalaPB0_11, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212, Scala213),
axisValues = Seq(Spark33, ScalaPB0_10, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212, Scala213),
axisValues = Seq(Spark32, ScalaPB0_10, VirtualAxis.jvm),
settings = Seq()
)
.customRow(
scalaVersions = Seq(Scala212),
axisValues = Seq(Spark31, ScalaPB0_10, VirtualAxis.jvm),
settings = Seq()
)
ThisBuild / publishTo := sonatypePublishToBundle.value
lazy val root =
project
.in(file("."))
.settings(
publishArtifact := false,
publish := {},
publishLocal := {}
)
.aggregate(
`sparksql-scalapb`.projectRefs: _*
)