|
1 import mill._ |
|
2 import mill.api.Loose |
|
3 import mill.define.{Command, Input, Sources, Target} |
|
4 import mill.scalajslib._ |
|
5 import mill.scalalib._ |
|
6 import mill.scalalib.publish._ |
|
7 |
|
8 object V { |
|
9 val app = "0.2-SNAPSHOT" |
|
10 val scalaJs = "0.6.28" |
|
11 val scala211 = "2.11.12" |
|
12 val scala212 = "2.12.9" |
|
13 } |
|
14 |
|
15 object D { |
|
16 val scalatags = ivy"com.lihaoyi::scalatags::0.6.8" |
|
17 } |
|
18 |
|
19 trait Common extends CrossSbtModule with PublishModule { |
|
20 |
|
21 def publishVersion: Target[String] = V.app |
|
22 |
|
23 def pomSettings = PomSettings( |
|
24 description = "Scalatags DSL for purecss.io framework", |
|
25 organization = "functionals.cz", |
|
26 url = "https://hg.functionals.cz/purecss", |
|
27 licenses = Seq(License.`Apache-2.0`), |
|
28 versionControl = VersionControl(developerConnection = Some( |
|
29 "https://hg.functionals.cz/purecss")), |
|
30 developers = Seq( |
|
31 Developer("tzeman", "Tomas Zeman", "https://functionals.cz") |
|
32 ) |
|
33 ) |
|
34 |
|
35 override def artifactName = "purecss" |
|
36 |
|
37 override def scalacOptions = T{Seq( |
|
38 "-deprecation", // Emit warning and location for usages of deprecated APIs. |
|
39 "-encoding", "utf-8", // Specify character encoding used by source files. |
|
40 "-explaintypes", // Explain type errors in more detail. |
|
41 "-feature", // Emit warning and location for usages of features that should be imported explicitly. |
|
42 "-language:higherKinds", // Allow higher-kinded types |
|
43 "-language:implicitConversions", // Allow definition of implicit functions called views |
|
44 "-language:reflectiveCalls", |
|
45 "-language:postfixOps", |
|
46 "-unchecked", // Enable additional warnings where generated code depends on assumptions. |
|
47 "-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. |
|
48 "-Xfuture", // Turn on future language features. |
|
49 "-target:jvm-1.8", |
|
50 )} |
|
51 |
|
52 def hgId: Input[String] = T.input { |
|
53 os.proc("hg", "id", "-i").call().out.string.trim |
|
54 } |
|
55 |
|
56 def hgNum: Input[String] = T.input { |
|
57 os.proc("hg", "id", "-n").call().out.string.trim |
|
58 } |
|
59 |
|
60 private val maskedTags = Set("tip", "qtip", "qbase") |
|
61 def hgTag: Input[Option[String]] = T.input { |
|
62 os.proc("hg", "id", "-t").call().out.string.trim.split(' ').filterNot(v => |
|
63 maskedTags contains v).headOption |
|
64 } |
|
65 |
|
66 override def ivyDeps: Target[Loose.Agg[Dep]] = Agg(D.scalatags) |
|
67 |
|
68 override def sources: Sources = T.sources{ |
|
69 super.sources() :+ PathRef(millSourcePath / 'shared / 'src / 'main / 'scala) |
|
70 } |
|
71 |
|
72 } |
|
73 |
|
74 class JvmModule(val crossScalaVersion: String) extends Common |
|
75 class JsModule(val crossScalaVersion: String) extends ScalaJSModule |
|
76 with Common { |
|
77 override def scalaJSVersion: Target[String] = V.scalaJs |
|
78 } |
|
79 |
|
80 object jvm extends Cross[JvmModule](V.scala211, V.scala212) |
|
81 object js extends Cross[JsModule](V.scala211, V.scala212) |
|
82 |
|
83 def publishLocal(): Command[Unit] = T.command{ |
|
84 jvm(V.scala212).publishLocal()() |
|
85 js(V.scala212).publishLocal()() |
|
86 jvm(V.scala211).publishLocal()() |
|
87 js(V.scala211).publishLocal()() |
|
88 () |
|
89 } |
|
90 |
|
91 def publishM2Local(p: os.Path): Command[Unit] = T.command{ |
|
92 jvm(V.scala212).publishM2Local(p.toString)() |
|
93 js(V.scala212).publishM2Local(p.toString)() |
|
94 jvm(V.scala211).publishM2Local(p.toString)() |
|
95 js(V.scala211).publishM2Local(p.toString)() |
|
96 () |
|
97 } |
|
98 |
|
99 // vim: et ts=2 sw=2 syn=scala |