build.sc
changeset 19 945e8df36800
parent 17 13abcbe6368b
child 21 0f9e22d7dc55
equal deleted inserted replaced
18:82080374cb75 19:945e8df36800
    15 object D {
    15 object D {
    16   val scalatags = ivy"com.lihaoyi::scalatags::0.6.8"
    16   val scalatags = ivy"com.lihaoyi::scalatags::0.6.8"
    17 }
    17 }
    18 
    18 
    19 trait Common extends CrossSbtModule with PublishModule {
    19 trait Common extends CrossSbtModule with PublishModule {
    20 
       
    21   def publishVersion: Target[String] = V.app
       
    22 
    20 
    23   def pomSettings = PomSettings(
    21   def pomSettings = PomSettings(
    24     description = "Scalatags DSL for purecss.io framework",
    22     description = "Scalatags DSL for purecss.io framework",
    25     organization = "functionals.cz",
    23     organization = "functionals.cz",
    26     url = "https://hg.functionals.cz/purecss",
    24     url = "https://hg.functionals.cz/purecss",
    48     "-Xfuture",                          // Turn on future language features.
    46     "-Xfuture",                          // Turn on future language features.
    49     "-target:jvm-1.8",
    47     "-target:jvm-1.8",
    50   )}
    48   )}
    51 
    49 
    52   def hgId: Input[String] = T.input {
    50   def hgId: Input[String] = T.input {
    53     os.proc("hg", "id", "-i").call().out.string.trim
    51     os.proc("hg", "id", "-i").call().out.text.trim
    54   }
    52   }
    55 
    53 
    56   def hgNum: Input[String] = T.input {
    54   def hgNum: Input[String] = T.input {
    57     os.proc("hg", "id", "-n").call().out.string.trim
    55     os.proc("hg", "id", "-n").call().out.text.trim
    58   }
    56   }
    59 
    57 
    60   private val maskedTags = Set("tip", "qtip", "qbase")
    58   private val maskedTags = Set("tip", "qtip", "qbase")
    61   def hgTag: Input[Option[String]] = T.input {
    59   def hgTag: Input[Option[String]] = T.input {
    62     os.proc("hg", "id", "-t").call().out.string.trim.split(' ').filterNot(v =>
    60     os.proc("hg", "id", "-t").call().out.text.trim.split(' ').filterNot(v =>
    63       maskedTags contains v).headOption
    61       maskedTags contains v).headOption
    64   }
    62   }
    65 
    63 
    66   override def ivyDeps: Target[Loose.Agg[Dep]] = Agg(D.scalatags)
    64   override def ivyDeps: Target[Loose.Agg[Dep]] = Agg(D.scalatags)
    67 
    65 
    68   override def sources: Sources = T.sources{
    66   override def sources: Sources = T.sources{
    69     super.sources() :+ PathRef(millSourcePath / 'shared / 'src / 'main / 'scala)
    67     super.sources() :+ PathRef(millSourcePath / 'shared / 'src / 'main / 'scala)
    70   }
    68   }
    71 
    69 
       
    70   override def publishVersion: Input[String] = T.input{
       
    71     val tv = hgTag() map(v => "-" + v.replace(".patch", "")) getOrElse ""
       
    72     V.app.replace("SNAPSHOT", s"${hgNum()}-${hgId()}$tv")
       
    73   }
    72 }
    74 }
    73 
    75 
    74 class JvmModule(val crossScalaVersion: String) extends Common
    76 class JvmModule(val crossScalaVersion: String) extends Common
    75 class JsModule(val crossScalaVersion: String) extends ScalaJSModule
    77 class JsModule(val crossScalaVersion: String) extends ScalaJSModule
    76   with Common {
    78   with Common {