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