import mill._ import mill.scalalib._ import scalafmt._ import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:0.1.1` import de.tobiasroeser.mill.vcs.version.VcsVersion 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"ch.qos.logback:logback-classic:1.2.3", ivy"com.github.pureconfig::pureconfig:0.14.1", ivy"com.github.scopt::scopt:4.0.0", ivy"com.typesafe.akka::akka-stream:2.6.13", ivy"org.bouncycastle:bcprov-jdk15to18:1.68", ivy"org.log4s::log4s:1.9.0" ) override def compile = T { reformat().apply() super.compile() } val name = "spacebeans" def buildInfoMembers: T[Map[String, String]] = T { Map( "name" -> name, "version" -> VcsVersion.vcsState().format() ) } def buildInfoPackageName = Some("net.usebox.gemini.server") def assembly = T { val version = VcsVersion.vcsState().format() val spacePath = T.ctx.dest / (name + "-" + version + ".jar") os.move(super.assembly().path, spacePath) PathRef(spacePath) } object test extends Tests with ScalafmtModule { def ivyDeps = Agg(ivy"org.scalatest::scalatest:3.2.5") 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: _*) } } }