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