build.sc
changeset 26 4978df5ebf0a
parent 24 c9b64d8025ed
child 28 a36f63b5960c
equal deleted inserted replaced
25:da897e7419e7 26:4978df5ebf0a
     4 import mill.scalajslib._
     4 import mill.scalajslib._
     5 import mill.scalalib._
     5 import mill.scalalib._
     6 import mill.scalalib.publish._
     6 import mill.scalalib.publish._
     7 import mill.util.Loose
     7 import mill.util.Loose
     8 
     8 
     9 val appVersion = "18.12"
     9 val appVersion = "19.01-SNAPSHOT"
    10 
    10 
    11 val scalaJsVer = "0.6.25"
    11 val scalaJsVer = "0.6.25"
    12 val scalaVer = "2.12.7"
    12 val scalaVer = "2.12.7"
    13 val akkaVer = "2.4.20"
    13 val akkaVer = "2.4.20"
    14 
    14 
    50   )}
    50   )}
    51 
    51 
    52   def hgId: Input[String] = T.input {
    52   def hgId: Input[String] = T.input {
    53     os.proc("hg", "id", "-i").call().out.string.trim
    53     os.proc("hg", "id", "-i").call().out.string.trim
    54   }
    54   }
       
    55 
       
    56   def hgNum: Input[String] = T.input {
       
    57     os.proc("hg", "id", "-n").call().out.string.trim
       
    58   }
       
    59 
       
    60   def hgTag: Input[Option[String]] = T.input {
       
    61     os.proc("hg", "id", "-t").call().out.string.trim.split(' ').headOption
       
    62   }
       
    63 
    55 }
    64 }
    56 
    65 
    57 trait Versions {
    66 trait Versions {
    58   //val bootstrap = "4.1.3"
    67   //val bootstrap = "4.1.3"
    59   val bootstrap = "3.3.7"
    68   val bootstrap = "3.3.7"
   160   override def mainClass = Some("sqwl.cms.Main")
   169   override def mainClass = Some("sqwl.cms.Main")
   161 
   170 
   162   override def ivyDeps = Agg(
   171   override def ivyDeps = Agg(
   163     ivy"com.beachape::enumeratum:1.5.13"
   172     ivy"com.beachape::enumeratum:1.5.13"
   164   )
   173   )
       
   174 
       
   175   def assemblyName: Target[String] = T{
       
   176     val tg = hgTag().map(v => s"-${v.replace(".patch", "")}") getOrElse ""
       
   177     val ver = publishVersion().replace("SNAPSHOT", s"${hgNum()}-${hgId()}$tg")
       
   178     s"cms-$ver"
       
   179   }
       
   180 
       
   181   override def assembly: Target[PathRef] = T{
       
   182     val out = T.ctx().dest / s"${assemblyName()}.jar"
       
   183     os.move(super.assembly().path, out)
       
   184     PathRef(out)
       
   185   }
       
   186 
   165 }
   187 }
   166 
   188 
   167 object example extends Content {
   189 object example extends Content {
   168   def contentSources: Sources =
   190   def contentSources: Sources =
   169     T.sources{ millSourcePath / up / 'example / 'content }
   191     T.sources{ millSourcePath / up / 'example / 'content }
   170 }
   192 }
   171 
   193 
   172 object production extends Content {
   194 object production extends Content {
   173   def contentSources: Sources =
   195   def contentSources: Sources =
   174     T.sources{ millSourcePath / up / 'production / 'content }
   196     T.sources{ millSourcePath / up / 'production / 'content }
       
   197 
       
   198   def hgProdId: Input[String] = T.input {
       
   199     os.proc("hg", "id", "-i", "--cwd", "production").call().out.string.trim
       
   200   }
       
   201 
       
   202   override def assemblyName: Target[String] = T{
       
   203     s"${super.assemblyName()}-${hgProdId()}"
       
   204   }
   175 }
   205 }
   176 
   206 
   177 
   207 
   178 object js extends Common with ScalaJSModule {
   208 object js extends Common with ScalaJSModule {
   179   def scalaJSVersion: Target[String] = scalaJsVer
   209   def scalaJSVersion: Target[String] = scalaJsVer