| author | Tomas Zeman <tomas@functionals.cz> |
| Thu, 19 Sep 2019 13:07:16 +0200 | |
| changeset 6 | 7146cc2c4b81 |
| parent 3 | a6bf3dddbb7c |
| child 7 | d101f632cc8d |
| permissions | -rw-r--r-- |
|
3
a6bf3dddbb7c
Mill upgrade -> 0.5.1. Updated project links.
Tomas Zeman <tomas@functionals.cz>
parents:
1
diff
changeset
|
1 |
// mill 0.5.1 |
| 1 | 2 |
|
3 |
import ammonite.ops._ |
|
4 |
import mill._ |
|
5 |
import mill.define.{Input, Sources, Target}
|
|
6 |
import mill.scalajslib._ |
|
7 |
import mill.scalalib._ |
|
8 |
import mill.scalalib.publish._ |
|
9 |
||
10 |
import scala.language.postfixOps |
|
11 |
||
12 |
object V {
|
|
13 |
val spss4s = "0.1-SNAPSHOT" |
|
14 |
val scalaJs = "0.6.26" |
|
15 |
val scala211 = "2.11.12" |
|
16 |
val scala212 = "2.12.8" |
|
17 |
} |
|
18 |
||
19 |
object D {
|
|
20 |
val spssReader = ivy"com.bedatadriven.spss:spss-reader:1.2" |
|
21 |
} |
|
22 |
||
23 |
trait Common extends CrossScalaModule with PublishModule {
|
|
24 |
||
|
6
7146cc2c4b81
Set proper artifact names.
Tomas Zeman <tomas@functionals.cz>
parents:
3
diff
changeset
|
25 |
override def artifactName: T[String] = "spss4s" |
|
7146cc2c4b81
Set proper artifact names.
Tomas Zeman <tomas@functionals.cz>
parents:
3
diff
changeset
|
26 |
|
| 1 | 27 |
def publishVersion: Input[String] = T.input{
|
28 |
val tv = hgTag() map(v => "-" + v.replace(".patch", "")) getOrElse ""
|
|
29 |
V.spss4s.replace("SNAPSHOT", s"${hgNum()}-${hgId()}$tv")
|
|
30 |
} |
|
31 |
||
32 |
def pomSettings = PomSettings( |
|
33 |
description = "SPSS reader for Scala", |
|
34 |
organization = "net.tz", |
|
|
3
a6bf3dddbb7c
Mill upgrade -> 0.5.1. Updated project links.
Tomas Zeman <tomas@functionals.cz>
parents:
1
diff
changeset
|
35 |
url = "https://hg.functionals.cz/spss4s", |
| 1 | 36 |
licenses = Seq(License.`Apache-2.0`), |
37 |
versionControl = VersionControl(developerConnection = Some( |
|
|
3
a6bf3dddbb7c
Mill upgrade -> 0.5.1. Updated project links.
Tomas Zeman <tomas@functionals.cz>
parents:
1
diff
changeset
|
38 |
"https://hg.functionals.cz/spss4s")), |
| 1 | 39 |
developers = Seq( |
40 |
Developer("tzeman", "Tomas Zeman", "")
|
|
41 |
) |
|
42 |
) |
|
43 |
||
44 |
override def scalacOptions = T{Seq(
|
|
45 |
"-deprecation", // Emit warning and location for usages of deprecated APIs. |
|
46 |
"-encoding", "utf-8", // Specify character encoding used by source files. |
|
47 |
"-explaintypes", // Explain type errors in more detail. |
|
48 |
"-feature", // Emit warning and location for usages of features that should be imported explicitly. |
|
49 |
"-language:higherKinds", // Allow higher-kinded types |
|
50 |
"-language:implicitConversions", // Allow definition of implicit functions called views |
|
51 |
"-language:reflectiveCalls", |
|
52 |
"-language:postfixOps", |
|
53 |
"-unchecked", // Enable additional warnings where generated code depends on assumptions. |
|
54 |
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. |
|
55 |
"-Xfuture", // Turn on future language features. |
|
56 |
"-target:jvm-1.8", |
|
57 |
)} |
|
58 |
||
59 |
def hgId: Input[String] = T.input {
|
|
60 |
os.proc("hg", "id", "-i").call().out.string.trim
|
|
61 |
} |
|
62 |
||
63 |
def hgNum: Input[String] = T.input {
|
|
64 |
os.proc("hg", "id", "-n").call().out.string.trim
|
|
65 |
} |
|
66 |
||
67 |
def hgTag: Input[Option[String]] = T.input {
|
|
68 |
os.proc("hg", "id", "-t").call().out.string.trim.split(' ').headOption
|
|
69 |
} |
|
70 |
||
71 |
override def sources: Sources = T.sources( |
|
72 |
millSourcePath / 'src, millSourcePath / 'shared |
|
73 |
) |
|
74 |
||
75 |
} |
|
76 |
||
77 |
class JvmModule(val crossScalaVersion: String) extends Common {
|
|
78 |
||
79 |
override def ivyDeps = Agg(D.spssReader) |
|
80 |
||
81 |
} |
|
82 |
||
83 |
class JsModule(val crossScalaVersion: String) extends ScalaJSModule |
|
84 |
with Common {
|
|
85 |
override def scalaJSVersion: Target[String] = V.scalaJs |
|
86 |
} |
|
87 |
||
88 |
object jvm extends Cross[JvmModule](V.scala211, V.scala212) |
|
89 |
object js extends Cross[JsModule](V.scala211, V.scala212) |
|
90 |
||
91 |
def publishLocal(): define.Command[Unit] = T.command{
|
|
92 |
jvm(V.scala212).publishLocal()() |
|
93 |
js(V.scala212).publishLocal()() |
|
94 |
jvm(V.scala211).publishLocal()() |
|
95 |
js(V.scala211).publishLocal()() |
|
96 |
} |
|
97 |
||
98 |
// vim: et ts=2 sw=2 syn=scala |