-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sc
141 lines (114 loc) · 4.12 KB
/
build.sc
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
import mill._
import mill.scalalib._
import mill.scalalib.publish._
import mill.scalalib.scalafmt._
import mill.modules.Assembly
import mill.modules.Assembly.Rule.ExcludePattern
import $file.antlr
class LigaModule(majorVersion: String) extends CrossScalaModule with PublishModule with ScalafmtModule with antlr.AntlrModule {
override def crossScalaVersion: String = majorVersion match {
case "2.12" => "2.12.16"
case "2.13" => "2.13.8"
case _ => ???
}
def sparkVersion: String = {
sys.env.get("SPARK_VERSION") match {
case Some(v) => v
case None => "3.2.1"
}
}
override def publishVersion = "0.3.0"
override def artifactId = s"liga-spark_${majorVersion}"
override def pomSettings = PomSettings(
description = "Liga",
organization = "net.xmacs.liga",
licenses = Seq(License.Common.Apache2),
url = "https://github.com/komprenilo/liga",
versionControl = VersionControl.github("komprenilo", "liga"),
developers = Seq(
Developer("da-tubi", "Darcy Shen", "https://github.com/da-tubi")
)
)
def scalacOptions = majorVersion match {
case "2.12" =>
super.scalacOptions()
case "2.13" =>
Seq("-Ymacro-annotations", "-language:postfixOps")
case _ => ???
}
override def compileIvyDeps = majorVersion match {
case "2.12" => Agg(
ivy"org.apache.spark::spark-sql:${sparkVersion}",
ivy"org.antlr:antlr4-runtime:4.8",
ivy"org.apache.httpcomponents:httpclient:4.5.14",
ivy"org.scalamacros:::paradise:2.1.1",
ivy"com.thoughtworks.enableIf::enableif:1.1.8",
)
case "2.13" => Agg(
ivy"org.apache.spark::spark-sql:${sparkVersion}",
ivy"org.antlr:antlr4-runtime:4.8",
ivy"org.apache.httpcomponents:httpclient:4.5.14",
ivy"com.thoughtworks.enableIf::enableif:1.1.8",
)
case _ => ???
}
def scalacPluginIvyDeps = majorVersion match {
case "2.12" =>
super.scalacPluginIvyDeps() ++ Agg(
ivy"org.scalamacros:::paradise:2.1.1"
)
case "2.13" =>
super.scalacPluginIvyDeps()
case _ => ???
}
override def antlrGenerateVisitor: Boolean = true
override def antlrPackage: Option[String] = Some("net.xmacs.liga.spark.parser")
override def antlrGrammarSources = T.sources {
Seq(millSourcePath / "resources" / "antlr4").map(PathRef(_))
}
def assemblyRules = Assembly.defaultRules ++ Seq(ExcludePattern("scala/.*"))
object test extends Tests with TestModule.ScalaTest {
override def ivyDeps = Agg(
ivy"org.apache.spark::spark-sql:${sparkVersion}",
ivy"org.antlr:antlr4-runtime:4.8",
ivy"org.scalatest::scalatest:3.2.0",
ivy"org.apache.httpcomponents:httpclient:4.5.14",
ivy"ch.qos.logback:logback-classic:1.2.3",
)
override def forkEnv = Map("LOG_LEVEL" -> "ERROR")
}
}
object liga extends mill.Cross[LigaModule]("2.12", "2.13")
class ImageModule(majorVersion: String) extends CrossScalaModule with PublishModule with ScalafmtModule {
def moduleDeps = Seq(liga())
override def crossScalaVersion: String = majorVersion match {
case "2.12" => "2.12.13"
case "2.13" => "2.13.7"
case _ => ???
}
override def publishVersion = "0.3.1"
override def artifactId = s"liga-image_${majorVersion}"
override def pomSettings = PomSettings(
description = "Image related UDT/UDF on Apache Spark",
organization = "net.xmacs.liga",
licenses = Seq(License.Common.Apache2),
url = "https://github.com/komprenilo/liga-vision",
versionControl = VersionControl.github("komprenilo", "liga-vision"),
developers = Seq(
Developer("da-tubi", "Darcy Shen", "https://github.com/da-tubi")
)
)
override def compileIvyDeps = Agg(
ivy"org.apache.spark::spark-sql:3.3.1",
)
def assemblyRules = Assembly.defaultRules ++ Seq(ExcludePattern("scala/.*"))
object test extends Tests with TestModule.ScalaTest {
override def ivyDeps = Agg(
ivy"org.apache.spark::spark-sql:3.3.1",
ivy"org.scalatest::scalatest:3.0.8",
ivy"ch.qos.logback:logback-classic:1.2.3",
)
override def forkEnv = Map("LOG_LEVEL" -> "ERROR")
}
}
object image extends mill.Cross[ImageModule]("2.12", "2.13")