build.sc
author Tomas Zeman <tzeman@volny.cz>
Thu, 08 Nov 2018 19:12:42 +0100
changeset 2 eb0fb99d0289
parent 1 5a1fe2302fb4
child 3 48479e4b89d4
permissions -rw-r--r--
Ignore idea_modules, added scalatags dep.

import java.io.File

import ammonite.ops._
import coursier.maven.MavenRepository
import mill._
import mill.define.{Command, Input, Sources, Target}
import mill.scalajslib._
import mill.scalalib._
import mill.scalalib.publish._
import mill.util.Loose

import scala.sys

val appVersion = "18.12-SNAPSHOT"

val scalaJsVer = "0.6.25"
val scalaVer = "2.12.7"
val akkaVer = "2.4.20"

trait Common extends ScalaModule with PublishModule {
  val scalaVersion = scalaVer

  def publishVersion = appVersion 

  def pomSettings = PomSettings(
    description = "Content management system for SQWL",
    organization = "net.tz",
    url = "http://kvalitapracovnihozivota.vubp.cz",
    licenses = Seq(License.`Apache-2.0`),
    versionControl = VersionControl(developerConnection = Some(
      "ssh://hg@bitbucket.org/tzeman/sqwl-cms")),
    developers = Seq(
      Developer("tzeman", "Tomas Zeman", "")
    )
  )

  override def artifactName = T{
    super.artifactName.map(_.flatMap(c =>
      if (c.isUpper) Seq('-', c.toLower) else Seq(c) ))
  }

  override def scalacOptions = T{Seq(
    "-deprecation",                      // Emit warning and location for usages of deprecated APIs.
    "-encoding", "utf-8",                // Specify character encoding used by source files.
    "-explaintypes",                     // Explain type errors in more detail.
    "-feature",                          // Emit warning and location for usages of features that should be imported explicitly.
    "-language:higherKinds",             // Allow higher-kinded types
    "-language:implicitConversions",     // Allow definition of implicit functions called views
    "-language:reflectiveCalls",
    "-language:postfixOps",
    "-unchecked",                        // Enable additional warnings where generated code depends on assumptions.
    "-Xcheckinit",                       // Wrap field accessors to throw an exception on uninitialized access.
    "-Xfuture",                          // Turn on future language features.
    "-target:jvm-1.8",
    "--illegal-access=warn"
  )}
}

object jvm extends Common {
  override def scalacPluginIvyDeps: Target[Loose.Agg[Dep]] = super.scalacPluginIvyDeps() ++ Agg(
    ivy"org.scalamacros:::paradise:2.1.0"
  )

  override def ivyDeps = Agg(
    ivy"com.wacai::config-annotation:0.3.6",
    ivy"de.heikoseeberger::akka-http-json4s:1.22.0",
    ivy"com.typesafe.akka::akka-slf4j:$akkaVer",
    ivy"org.json4s::json4s-native:3.6.2",
    ivy"ch.qos.logback:logback-classic:1.2.3",
    ivy"com.lihaoyi::scalatags:0.6.7"
  )

  override def scalacOptions = T{super.scalacOptions.map(_ :+
    "-Xmacro-settings:conf.output.dir=jvm/src/main/resources"
  )}

  override def mainClass = Some("sqwl.cms.Server")

}

object js extends Common with ScalaJSModule {
  def scalaJSVersion: Target[String] = scalaJsVer
}

// vim: et ts=2 sw=2 syn=scala