forked from anatoliykmetyuk/utest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sc
116 lines (103 loc) · 3.86 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
import mill._, scalalib._, scalajslib._, scalanativelib._, publish._
trait UtestModule extends PublishModule {
def artifactName = "utest"
def publishVersion = "0.7.5"
def pomSettings = PomSettings(
description = artifactName(),
organization = "com.lihaoyi",
url = "https://github.com/lihaoyi/utest",
licenses = Seq(License.MIT),
scm = SCM(
"git://github.com/lihaoyi/utest.git",
"scm:git://github.com/lihaoyi/utest.git"
),
developers = Seq(
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
)
)
}
trait UtestMainModule extends CrossScalaModule {
def millSourcePath = super.millSourcePath / offset
def offset: os.RelPath = os.rel
def sources = T.sources(
super.sources()
.flatMap(source =>
Seq(
PathRef(source.path / os.up / source.path.last),
PathRef(source.path / os.up / os.up / source.path.last),
)
)
)
}
trait UtestTestModule extends ScalaModule with TestModule {
def crossScalaVersion: String
def testFrameworks = Seq("test.utest.CustomFramework")
def offset: os.RelPath = os.rel
def millSourcePath = super.millSourcePath / os.up
def sources = T.sources(
super.sources()
.++(CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s" ))
.flatMap(source =>
Seq(
PathRef(source.path / os.up / "test" / source.path.last),
PathRef(source.path / os.up / os.up / "test" / source.path.last),
)
)
.distinct
)
}
object utest extends Module {
val dottyVersion = Option(sys.props("dottyVersion"))
object jvm extends Cross[JvmUtestModule]((List("2.11.12", "2.12.8", "2.13.0", "3.0.0-M3") ++ dottyVersion): _*)
class JvmUtestModule(val crossScalaVersion: String)
extends UtestMainModule with ScalaModule with UtestModule {
def ivyDeps = Agg(
ivy"org.scala-sbt:test-interface::1.0"
) ++ (if (crossScalaVersion.startsWith("2")) Agg(
ivy"org.portable-scala::portable-scala-reflect::0.1.1",
ivy"org.scala-lang:scala-reflect:$crossScalaVersion"
) else Agg())
object test extends Tests with UtestTestModule{
val crossScalaVersion = JvmUtestModule.this.crossScalaVersion
}
override def docJar =
if (crossScalaVersion.startsWith("2")) super.docJar
else T {
val outDir = T.ctx().dest
val javadocDir = outDir / 'javadoc
os.makeDir.all(javadocDir)
mill.api.Result.Success(mill.modules.Jvm.createJar(Agg(javadocDir))(outDir))
}
}
object js extends Cross[JsUtestModule](
("2.12.10", "0.6.31"), ("2.13.1", "0.6.31"), ("2.12.10", "1.0.0"), ("2.13.1", "1.0.0")
)
class JsUtestModule(val crossScalaVersion: String, crossJSVersion: String)
extends UtestMainModule with ScalaJSModule with UtestModule {
def offset = os.up
def ivyDeps = Agg(
ivy"org.scala-js::scalajs-test-interface:$crossJSVersion",
ivy"org.portable-scala::portable-scala-reflect::0.1.1",
ivy"org.scala-lang:scala-reflect:$crossScalaVersion"
)
def scalaJSVersion = crossJSVersion
object test extends Tests with UtestTestModule{
def offset = os.up
val crossScalaVersion = JsUtestModule.this.crossScalaVersion
}
}
object native extends Cross[NativeUtestModule](("2.11.12", "0.3.9"), ("2.11.12", "0.4.0-M2"))
class NativeUtestModule(val crossScalaVersion: String, crossScalaNativeVersion: String)
extends UtestMainModule with ScalaNativeModule with UtestModule {
def offset = os.up
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scala-native::test-interface::$crossScalaNativeVersion",
ivy"org.scala-lang:scala-reflect:$crossScalaVersion",
)
def scalaNativeVersion = crossScalaNativeVersion
object test extends Tests with UtestTestModule{
def offset = os.up
val crossScalaVersion = NativeUtestModule.this.crossScalaVersion
}
}
}