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
|
import mill._
import mill.scalalib._
import scalafmt._
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:$MILL_VERSION`
import mill.contrib.buildinfo.BuildInfo
object server extends ScalaModule with ScalafmtModule with BuildInfo {
def scalaVersion = "2.13.5"
def scalacOptions = Seq(
// features
"-encoding", "utf-8",
"-explaintypes",
"-language:higherKinds",
// warnings
"-deprecation",
"-Xlint:unused",
"-unchecked",
)
def ivyDeps = Agg(
ivy"com.github.pureconfig::pureconfig:0.14.0",
ivy"com.monovore::decline:1.3.0",
ivy"org.log4s::log4s:1.8.2",
ivy"ch.qos.logback:logback-classic:1.2.3",
ivy"com.typesafe.akka::akka-stream:2.6.12",
ivy"org.bouncycastle:bcprov-jdk15to18:1.68"
)
override def compile = T {
reformat().apply()
super.compile()
}
def gitHead = T.input { os.proc('git, "rev-parse", "HEAD").call().out.trim }
def getVersion = T.input {
val tag = try Option(
os.proc('git, 'describe, "--exact-match", "--tags", "--always", gitHead()).call().out.trim
)
catch { case e => None }
tag match {
case Some(t) => t
case None =>
val latestTaggedVersion = os.proc('git, 'describe, "--abbrev=0", "--always", "--tags").call().out.trim
val latestCommit = gitHead().take(6)
s"$latestTaggedVersion-$latestCommit"
}
}
val name = "spacebeans"
def buildInfoMembers: T[Map[String, String]] = T {
Map(
"name" -> name,
"version" -> getVersion()
)
}
def buildInfoPackageName = Some("net.usebox.gemini.server")
object test extends Tests with ScalafmtModule {
def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.2.2")
def testFrameworks = Seq("org.scalatest.tools.Framework")
override def compile = T {
reformat().apply()
super.compile()
}
def testOnly(args: String*) = T.command {
super.runMain("org.scalatest.run", args: _*)
}
}
}
|