aboutsummaryrefslogtreecommitdiff
path: root/build.sc
blob: 997a960dedfb2b4a4d811988f21ed5ff1c3d18f1 (plain)
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
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:$MILL_VERSION`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import mill._
import mill.contrib.buildinfo.BuildInfo
import mill.scalalib._
import scalafmt._

object server extends ScalaModule with ScalafmtModule with BuildInfo {
  def scalaVersion = "2.13.14"

  def scalacOptions =
    Seq(
      // features
      "-encoding",
      "utf-8",
      "-explaintypes",
      "-language:higherKinds",
      // warnings
      "-deprecation",
      "-Xlint:unused",
      "-unchecked"
    )

  def ivyDeps =
    Agg(
      ivy"ch.qos.logback:logback-classic:1.5.6",
      ivy"com.github.pureconfig::pureconfig:0.17.7",
      ivy"com.github.scopt::scopt:4.1.0",
      ivy"org.apache.pekko::pekko-stream:1.0.3",
      ivy"org.bouncycastle:bcprov-jdk15to18:1.78.1",
      ivy"org.log4s::log4s:1.10.0"
    )

  val name = "spacebeans"
  def buildInfoMembers =
    Seq(
      BuildInfo.Value("name", name),
      BuildInfo.Value("version", VcsVersion.vcsState().format())
    )
  def buildInfoPackageName = "net.usebox.gemini.server"

  def assembly =
    T {
      val version = VcsVersion.vcsState().format()
      val spacePath = T.dest / (name + "-" + version + ".jar")
      os.move(super.assembly().path, spacePath)
      PathRef(spacePath)
    }

  object test extends ScalaTests with ScalafmtModule with TestModule.ScalaTest {
    def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.2.19")

    def forkEnv = super.forkEnv() ++
      Map("MILL_TEST_RESOURCE_FOLDER" -> resources().map(_.path).mkString(";"))
  }
}