-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathbuild.mill
More file actions
96 lines (84 loc) · 3.09 KB
/
Copy pathbuild.mill
File metadata and controls
96 lines (84 loc) · 3.09 KB
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
package build
import mill.*
import mill.api.BuildCtx
import mill.scalalib.*
import publish.*
import mill.util.{Version, VcsVersion}
object Deps {
val scala211: Seq[String] = Seq("2.11.12")
val scala212: Seq[String] = 9.to(21).map("2.12." + _)
val scala213: Seq[String] = 3.to(18).map("2.13." + _)
val scala33: Seq[String] = 0.to(7).map("3.3." + _)
val scala34: Seq[String] = 0.to(3).map("3.4." + _)
val scala35: Seq[String] = 0.to(2).map("3.5." + _)
val scala36: Seq[String] = 0.to(4).map("3.6." + _)
val scala37: Seq[String] = 0.to(4).map("3.7." + _)
val scala38: Seq[String] = 0.to(3).map("3.8." + _)
val unreleased: Seq[String] = scala33 ++ scala34 ++ scala35 ++ scala36 ++ scala37 ++ scala38
def scalaCompiler(scalaVersion: String): Dep =
if scalaVersion.startsWith("3.")
then mvn"org.scala-lang::scala3-compiler:$scalaVersion"
else mvn"org.scala-lang:scala-compiler:$scalaVersion"
val utest = mvn"com.lihaoyi::utest:0.8.2"
}
val crosses: Seq[String] = sys.env.get("SCALA_VERSION")
.map(_.trim)
.filter(_.nonEmpty)
.map(Seq(_))
.getOrElse(
Deps.scala211 ++
Deps.scala212 ++
Deps.scala213 ++
Deps.scala33 ++
Deps.scala34 ++
Deps.scala35 ++
Deps.scala36 ++
Deps.scala37 ++
Deps.scala38
)
object acyclic extends Cross[AcyclicModule](crosses)
trait AcyclicModule extends CrossScalaModule with SonatypeCentralPublishModule {
override def crossFullScalaVersion = true
override def artifactName = "acyclic"
override def publishVersion: T[String] = VcsVersion.vcsState().format()
override def pomSettings: T[PomSettings] = PomSettings(
description = artifactName(),
organization = "com.lihaoyi",
url = "https://github.com/com-lihaoyi/acyclic",
licenses = Seq(License.MIT),
versionControl = VersionControl.github(owner = "com-lihaoyi", repo = "acyclic"),
developers = Seq(
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
)
)
override def compileMvnDeps: T[Seq[Dep]] =
Seq(Deps.scalaCompiler(crossScalaVersion))
override def javacOptions: T[Seq[String]] = Seq(
"-source",
"8",
"-target",
"8",
"-encoding",
"UTF-8"
)
override def scalacOptions: T[Seq[String]] = {
val sv = Version.parse(crossScalaVersion)
implicit val ord = Version.IgnoreQualifierOrdering
if (sv.major == 2) Seq("-target:jvm-1.8")
else if(!sv.isAtLeast(Version.parse("2.8"))) Seq("-java-output-version", "8")
else Seq("-java-output-version", "17")
}
object test extends ScalaTests with TestModule.Utest {
private def customSources: T[Seq[PathRef]] = Task.Sources("resources")
override def sources: T[Seq[PathRef]] = Task { super.sources() ++ customSources() }
override def mvnDeps: T[Seq[Dep]] = Seq(
Deps.utest,
Deps.scalaCompiler(crossScalaVersion)
)
override def scalacPluginMvnDeps: T[Seq[Dep]] = Seq.empty[Dep]
override def forkEnv: T[Map[String, String]] = super.forkEnv() ++ Map(
"MILL_WORKSPACE_ROOT" -> BuildCtx.workspaceRoot.toString,
"TEST_ACYCLIC_TEST_RESOURCES" -> (moduleDir / "resources").toString
)
}
}