-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sc
74 lines (64 loc) · 2.5 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
import mill.scalalib._
import mill.scalalib.api.Util
import mill.scalalib.publish._
object jsonquote extends mill.Cross[JsonQuote]("2.11.12", "2.12.10", "2.13.1")
class JsonQuote(crossVersion: String) extends mill.Module {
trait Module extends CrossSbtModule with PublishModule {
def publishVersion = "0.6.1"
def pomSettings = PomSettings(
description = "Build json using scala string interpolation",
organization = "net.maffoo",
url = "https://github.com/maffoo/jsonquote",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("maffoo", "jsonquote"),
developers = Seq(
Developer("maffoo", "Matthew Neeley","https://github.com/maffoo")
)
)
def crossScalaVersion = crossVersion
def scalacOptions = Seq("-feature", "-deprecation")
def testModuleDeps: Seq[TestModule] = Nil
object test extends Tests {
def moduleDeps = super.moduleDeps ++ testModuleDeps
def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.0.8")
def testFrameworks = Seq("org.scalatest.tools.Framework")
}
}
object core extends Module {
override def millSourcePath = super.millSourcePath / os.up / os.up / "core"
def artifactName = "jsonquote-core"
def ivyDeps = Agg(ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}")
}
class Interop(name: String, ivyDeps0: Dep*)(implicit ctx: mill.define.Ctx) extends Module {
override def millSourcePath = super.millSourcePath / os.up / os.up / name
def artifactName = s"jsonquote-$name"
def moduleDeps = Seq(core)
def testModuleDeps = Seq(core.test)
def ivyDeps = Agg.from(ivyDeps0)
def scalaBinaryVersion = mill.T { Util.scalaBinaryVersion(scalaVersion()) }
}
object json4s extends Interop("json4s", ivy"org.json4s::json4s-native:3.6.7")
object lift extends Interop("lift", ivy"net.liftweb::lift-json:3.4.0")
object play extends Interop("play") {
def ivyDeps = mill.T {
val playVersion = scalaBinaryVersion() match {
case "2.11" => "2.7.4"
case _ => "2.8.0"
}
Agg(ivy"com.typesafe.play::play-json:${playVersion}")
}
}
object spray extends Interop("spray", ivy"io.spray::spray-json:1.3.5")
object upickle extends Interop("upickle") {
def ivyDeps = mill.T {
val upickleVersion = scalaBinaryVersion() match {
case "2.11" => "0.7.4"
case _ => "0.8.0"
}
Agg(
ivy"com.lihaoyi::upickle-core:${upickleVersion}",
ivy"com.lihaoyi::upickle:${upickleVersion}"
)
}
}
}