1 // mill 0.5.1 |
1 // mill 0.7.4 |
2 |
2 |
3 import ammonite.ops._ |
|
4 import coursier.Repository |
3 import coursier.Repository |
5 import coursier.maven.MavenRepository |
4 import coursier.maven.MavenRepository |
6 import mill._ |
5 import mill._ |
7 import mill.define.{Input, Sources, Target} |
6 import mill.define.{Input, Sources, Target} |
8 import mill.scalajslib._ |
7 import mill.scalajslib._ |
9 import mill.scalalib._ |
8 import mill.scalalib._ |
10 import mill.scalalib.publish._ |
9 import mill.scalalib.publish._ |
11 import $ivy.`de.tototec::de.tobiasroeser.mill.publishM2:0.1.0` |
|
12 import de.tobiasroeser.mill.publishM2._ |
|
13 |
10 |
14 import scala.language.postfixOps |
11 import scala.language.postfixOps |
15 |
12 |
16 object V { |
13 object V { |
17 val spss4s = "0.1-SNAPSHOT" |
14 val spss4s = "0.1-SNAPSHOT" |
18 val scalaJs = "0.6.26" |
15 val scalaJs = "0.6.33" |
19 val scala211 = "2.11.12" |
16 val scala211 = "2.11.12" |
20 val scala212 = "2.12.8" |
17 val scala212 = "2.12.12" |
21 } |
18 } |
22 |
19 |
23 object D { |
20 object D { |
24 val spssReader = ivy"com.bedatadriven.spss:spss-reader:1.3-SNAPSHOT" |
21 val spssReader = ivy"com.bedatadriven.spss:spss-reader:1.3-SNAPSHOT" |
25 } |
22 } |
26 |
23 |
27 trait Common extends CrossScalaModule with PublishM2Module { |
24 trait Common extends CrossScalaModule with PublishModule { |
28 |
25 |
29 override def artifactName: T[String] = "spss4s" |
26 override def artifactName: T[String] = "spss4s" |
30 |
27 |
31 override def repositories: Seq[Repository] = super.repositories ++ Seq( |
28 override def repositories: Seq[Repository] = super.repositories ++ Seq( |
32 MavenRepository("https://maven.functionals.cz/m2/") |
29 MavenRepository("https://maven.functionals.cz/m2/") |
35 def publishVersion: Input[String] = T.input{ |
32 def publishVersion: Input[String] = T.input{ |
36 val tv = hgTag() map(v => "-" + v.replace(".patch", "")) getOrElse "" |
33 val tv = hgTag() map(v => "-" + v.replace(".patch", "")) getOrElse "" |
37 V.spss4s.replace("SNAPSHOT", s"${hgNum()}-${hgId()}$tv") |
34 V.spss4s.replace("SNAPSHOT", s"${hgNum()}-${hgId()}$tv") |
38 } |
35 } |
39 |
36 |
40 def pomSettings = PomSettings( |
37 def pomSettings: Target[PomSettings] = PomSettings( |
41 description = "SPSS reader for Scala", |
38 description = "SPSS reader for Scala", |
42 organization = "net.tz", |
39 organization = "net.tz", |
43 url = "https://hg.functionals.cz/spss4s", |
40 url = "https://hg.functionals.cz/spss4s", |
44 licenses = Seq(License.`Apache-2.0`), |
41 licenses = Seq(License.`Apache-2.0`), |
45 versionControl = VersionControl(developerConnection = Some( |
42 versionControl = VersionControl(developerConnection = Some( |
63 "-Xfuture", // Turn on future language features. |
60 "-Xfuture", // Turn on future language features. |
64 "-target:jvm-1.8", |
61 "-target:jvm-1.8", |
65 )} |
62 )} |
66 |
63 |
67 def hgId: Input[String] = T.input { |
64 def hgId: Input[String] = T.input { |
68 os.proc("hg", "id", "-i").call().out.string.trim |
65 os.proc("hg", "id", "-i").call().out.text.trim |
69 } |
66 } |
70 |
67 |
71 def hgNum: Input[String] = T.input { |
68 def hgNum: Input[String] = T.input { |
72 os.proc("hg", "id", "-n").call().out.string.trim |
69 os.proc("hg", "id", "-n").call().out.text.trim |
73 } |
70 } |
74 |
71 |
|
72 private val maskedTags = Set("tip", "qtip", "qbase") |
75 def hgTag: Input[Option[String]] = T.input { |
73 def hgTag: Input[Option[String]] = T.input { |
76 os.proc("hg", "id", "-t").call().out.string.trim.split(' ').headOption |
74 os.proc("hg", "id", "-t").call().out.text.trim.split(' ').filterNot(v => |
|
75 maskedTags contains v).headOption |
77 } |
76 } |
78 |
77 |
79 override def sources: Sources = T.sources( |
78 override def sources: Sources = T.sources( |
80 millSourcePath / 'src, millSourcePath / 'shared |
79 millSourcePath / 'src, millSourcePath / 'shared |
81 ) |
80 ) |
102 jvm(V.scala211).publishLocal()() |
101 jvm(V.scala211).publishLocal()() |
103 js(V.scala211).publishLocal()() |
102 js(V.scala211).publishLocal()() |
104 } |
103 } |
105 |
104 |
106 def publishM2Local(p: os.Path): define.Command[Unit] = T.command{ |
105 def publishM2Local(p: os.Path): define.Command[Unit] = T.command{ |
107 jvm(V.scala212).publishM2Local(p)() |
106 jvm(V.scala212).publishM2Local(p.toString)() |
108 js(V.scala212).publishM2Local(p)() |
107 js(V.scala212).publishM2Local(p.toString)() |
109 jvm(V.scala211).publishM2Local(p)() |
108 jvm(V.scala211).publishM2Local(p.toString)() |
110 js(V.scala211).publishM2Local(p)() |
109 js(V.scala211).publishM2Local(p.toString)() |
111 () |
110 () |
112 } |
111 } |
113 |
112 |
114 // vim: et ts=2 sw=2 syn=scala |
113 // vim: et ts=2 sw=2 syn=scala |