build.sc
changeset 35 b7cfac7cff27
parent 34 2b907c14fdcb
child 36 dfc839004878
equal deleted inserted replaced
34:2b907c14fdcb 35:b7cfac7cff27
     1 /*
     1 /*
     2  * REPL:
     2  * REPL:
     3  *
     3  *
     4  * ./mill -i -w
     4  * ./mill --repl -w
     5  *
     5  *
     6  * Generate Idea project:
     6  * Generate Idea project:
     7  *
     7  *
     8  * ./mill mill.scalalib.GenIdea/idea
     8  * ./mill mill.scalalib.GenIdea/idea
     9  *
     9  *
    13 import mill.api.Loose
    13 import mill.api.Loose
    14 import mill.define.{Input, Sources, Target}
    14 import mill.define.{Input, Sources, Target}
    15 import mill.scalajslib._
    15 import mill.scalajslib._
    16 import mill.scalalib._
    16 import mill.scalalib._
    17 import mill.scalalib.publish._
    17 import mill.scalalib.publish._
    18 import $ivy.`de.tototec::de.tobiasroeser.mill.publishM2:0.1.0`
       
    19 import de.tobiasroeser.mill.publishM2._
       
    20 
    18 
    21 import scala.language.postfixOps
    19 import scala.language.postfixOps
    22 
    20 
    23 object V {
    21 object V {
    24   val fatags = "0.6-SNAPSHOT"
    22   val fatags = "0.6-SNAPSHOT"
    39     case Nil => Nil
    37     case Nil => Nil
    40   }
    38   }
    41   inner(s toList) mkString ""
    39   inner(s toList) mkString ""
    42 }
    40 }
    43 
    41 
    44 trait Common extends CrossSbtModule with PublishM2Module {
    42 trait Common extends CrossSbtModule with PublishModule {
    45 
    43 
    46   override def artifactName = "fatags"
    44   override def artifactName = "fatags"
    47 
    45 
    48   def publishVersion: Target[String] = V.fatags
    46   def publishVersion: Target[String] = V.fatags
    49 
    47 
    69     "-language:reflectiveCalls",
    67     "-language:reflectiveCalls",
    70     "-language:postfixOps",
    68     "-language:postfixOps",
    71     "-unchecked",                        // Enable additional warnings where generated code depends on assumptions.
    69     "-unchecked",                        // Enable additional warnings where generated code depends on assumptions.
    72     "-Xcheckinit",                       // Wrap field accessors to throw an exception on uninitialized access.
    70     "-Xcheckinit",                       // Wrap field accessors to throw an exception on uninitialized access.
    73     "-Xfuture",                          // Turn on future language features.
    71     "-Xfuture",                          // Turn on future language features.
    74     "-target:jvm-1.8",
    72     "-target:jvm-1.8"
    75   )}
    73   )}
    76 
    74 
    77   def hgId: Input[String] = T.input {
    75   def hgId: Input[String] = T.input {
    78     os.proc("hg", "id", "-i").call().out.string.trim
    76     os.proc("hg", "id", "-i").call().out.text.trim
    79   }
    77   }
    80 
    78 
    81   def hgNum: Input[String] = T.input {
    79   def hgNum: Input[String] = T.input {
    82     os.proc("hg", "id", "-n").call().out.string.trim
    80     os.proc("hg", "id", "-n").call().out.text.trim
    83   }
    81   }
    84 
    82 
    85   def hgTag: Input[Option[String]] = T.input {
    83   def hgTag: Input[Option[String]] = T.input {
    86     os.proc("hg", "id", "-t").call().out.string.trim.split(' ').headOption
    84     os.proc("hg", "id", "-t").call().out.text.trim.split(' ').headOption
    87   }
    85   }
    88 
    86 
    89   override def ivyDeps: Target[Loose.Agg[Dep]] = Agg(D.scalatags)
    87   override def ivyDeps: Target[Loose.Agg[Dep]] = Agg(D.scalatags)
    90 
    88 
    91   override def sources: Sources = T.sources{
    89   override def sources: Sources = T.sources{
   153   jvm(V.scala211).publishLocal()()
   151   jvm(V.scala211).publishLocal()()
   154   js(V.scala211).publishLocal()()
   152   js(V.scala211).publishLocal()()
   155 }
   153 }
   156 
   154 
   157 def publishM2Local(p: os.Path): define.Command[Unit] = T.command{
   155 def publishM2Local(p: os.Path): define.Command[Unit] = T.command{
   158   jvm(V.scala212).publishM2Local(p)()
   156   jvm(V.scala212).publishM2Local(p.toString)()
   159   js(V.scala212).publishM2Local(p)()
   157   js(V.scala212).publishM2Local(p.toString)()
   160   jvm(V.scala211).publishM2Local(p)()
   158   jvm(V.scala211).publishM2Local(p.toString)()
   161   js(V.scala211).publishM2Local(p)()
   159   js(V.scala211).publishM2Local(p.toString)()
   162   ()
   160   ()
   163 }
   161 }
   164 
   162 
   165 object example extends ScalaModule with ScalaJSModule {
   163 object example extends ScalaModule with ScalaJSModule {
   166   override def scalaVersion: Target[String] = T{V.scala212}
   164   override def scalaVersion: Target[String] = T{V.scala212}