-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sc
140 lines (130 loc) · 5.09 KB
/
build.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import $file.utils
import mill._
import mill.scalalib._
import mill.scalalib.api.ZincWorkerUtil.scalaNativeBinaryVersion
import mill.scalalib.publish._
import $ivy.`com.lihaoyi::mill-contrib-buildinfo:`
import mill.contrib.buildinfo.BuildInfo
import $ivy.`de.tototec::de.tobiasroeser.mill.integrationtest::0.7.1`
import de.tobiasroeser.mill.integrationtest._
import $ivy.`com.goyeau::mill-scalafix::0.4.0`
import com.goyeau.mill.scalafix.ScalafixModule
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import de.tobiasroeser.mill.vcs.version.VcsVersion
import $ivy.`com.github.lolgab::mill-mima::0.1.1`
import com.github.lolgab.mill.mima._
import os.Path
import scala.util.Try
val latestMillDevVersion: Option[String] = {
sys.env
.get("GITHUB_EVENT_NAME")
.filter(_ == "workflow_dispatch")
.map(_ => utils.findLatestDevVersion())
}
val millVersions = latestMillDevVersion match {
case None => Seq("0.9.12", "0.10.0", "0.11.0")
case Some(version) => Seq(version)
}
val itestMillVersions = latestMillDevVersion match {
case None => Seq("0.9.12", "0.10.0", "0.10.12", "0.11.0")
case Some(version) => Seq(version)
}
val millBinaryVersions = millVersions.map(millBinaryVersion)
def millBinaryVersion(millVersion: String) = {
if (latestMillDevVersion.contains(millVersion)) millVersion
else scalaNativeBinaryVersion(millVersion)
}
def millVersion(binaryVersion: String) =
millVersions.find(v => millBinaryVersion(v) == binaryVersion).get
trait Common extends ScalaModule with PublishModule with ScalafixModule {
def pomSettings = PomSettings(
description = "MiMa Mill Plugin",
organization = "com.github.lolgab",
url = "https://github.com/lolgab/mill-mima",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("lolgab", "mill-mima"),
developers = Seq(
Developer("lolgab", "Lorenzo Gabriele", "https://github.com/lolgab")
)
)
def publishVersion = VcsVersion.vcsState().format()
def scalaVersion = "2.13.14"
def scalacOptions =
super.scalacOptions() ++ Seq("-Ywarn-unused", "-deprecation")
def scalafixIvyDeps = Agg(ivy"com.github.liancheng::organize-imports:0.6.0")
}
object `mill-mima` extends Cross[MillMimaCross](millBinaryVersions)
trait MillMimaCross
extends Common
with BuildInfo
with Mima
with Cross.Module[String] {
val millBinaryVersion = crossValue
override def moduleDeps = super.moduleDeps ++ Seq(`mill-mima-worker-api`)
override def artifactName = s"mill-mima_mill$millBinaryVersion"
def mimaPreviousVersions = Seq("0.0.17")
override def sources = T.sources(
super.sources() ++ Seq(
millSourcePath / s"src-mill${millVersion(millBinaryVersion).split('.').take(2).mkString(".")}"
)
.map(PathRef(_))
)
override def compileIvyDeps = super.compileIvyDeps() ++ Agg(
ivy"com.lihaoyi::mill-scalalib:${millVersion(millBinaryVersion)}"
)
override def buildInfoMembers = Seq(
BuildInfo.Value("publishVersion", publishVersion())
)
override def buildInfoObjectName = "MimaBuildInfo"
override def buildInfoPackageName = "com.github.lolgab.mill.mima.worker"
}
object `mill-mima-worker-api` extends Common
object `mill-mima-worker-impl` extends Common {
override def moduleDeps = super.moduleDeps ++ Seq(`mill-mima-worker-api`)
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"com.typesafe::mima-core:1.1.3"
)
}
object itest extends Cross[itestCross](itestMillVersions)
trait itestCross extends MillIntegrationTestModule with Cross.Module[String] {
val millVersion = crossValue
def millTestVersion = millVersion
def pluginsUnderTest = Seq(`mill-mima`(millBinaryVersion(millVersion)))
def temporaryIvyModules = Seq(
`mill-mima-worker-impl`,
`mill-mima-worker-api`
)
def testBase = millSourcePath / "src"
override def testInvocations: T[Seq[(PathRef, Seq[TestInvocation.Targets])]] =
T {
Seq(
PathRef(testBase / "simple") -> Seq(
TestInvocation.Targets(Seq("prepare")),
TestInvocation.Targets(Seq("verify"), expectedExitCode = 1)
),
PathRef(testBase / "filters") -> Seq(
TestInvocation.Targets(Seq("prepare")),
TestInvocation.Targets(Seq("verify"))
),
PathRef(testBase / "previous-versions") -> Seq(
TestInvocation.Targets(Seq("prepare")),
TestInvocation.Targets(Seq("verify")),
TestInvocation.Targets(Seq("verifyFail"), expectedExitCode = 1),
TestInvocation.Targets(Seq("verifyFailJs"), expectedExitCode = 1)
),
PathRef(testBase / "multi-previous-versions") -> Seq(
TestInvocation.Targets(Seq("prepare")),
TestInvocation.Targets(Seq("verify")),
TestInvocation.Targets(Seq("verifyFail"), expectedExitCode = 1)
),
PathRef(testBase / "java") -> Seq(
TestInvocation.Targets(Seq("prepare")),
TestInvocation.Targets(Seq("verify"), expectedExitCode = 1)
),
PathRef(testBase / "not-publish-module") -> Seq(
TestInvocation.Targets(Seq("prepare")),
TestInvocation.Targets(Seq("verify"), expectedExitCode = 1)
)
)
}
}