-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.mill
197 lines (160 loc) · 5.84 KB
/
build.mill
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import $ivy.`com.github.lolgab::mill-crossplatform::0.2.4`
import $ivy.`io.github.quafadas:millSite_mill0.12_2.13:0.0.36`
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.lihaoyi::mill-contrib-jmh:`
import de.tobiasroeser.mill.vcs.version._
import com.github.lolgab.mill.crossplatform._
import mill._, mill.scalalib._, mill.scalajslib._, mill.scalanativelib._
import io.github.quafadas.millSite._
import mill._, scalalib._, publish._
import mill.scalajslib.api._
import mill.scalanativelib._
import contrib.jmh.JmhModule
import mill.util.Jvm
import mill.api.Result
trait Common extends ScalaModule with PublishModule {
def scalaVersion = "3.3.4"
def publishVersion = VcsVersion.vcsState().format()
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"io.github.quafadas::narr::0.0.5"
)
override def scalacOptions: Target[Seq[String]] = super.scalacOptions() ++ Seq("-explain-cyclic")
override def pomSettings = T {
PomSettings(
description = "Making cross platform compute intense problems less vexing",
organization = "io.github.quafadas",
url = "https://github.com/Quafadas/vecxt",
licenses = Seq(License.`Apache-2.0`),
versionControl =
VersionControl.github("quafadas", "vecxt"),
developers = Seq(
Developer("quafadas", "Simon Parten", "https://github.com/quafadas")
)
)
}
}
val vecIncubatorFlag = Seq("""--add-modules=jdk.incubator.vector""")
trait CommonJS extends ScalaJSModule {
def scalaJSVersion = "1.17.0"
// def ivyDeps = super.ivyDeps() ++ Seq(ivy"com.raquo::ew::0.2.0")
// def moduleKind = ModuleKind.
}
trait CommonNative extends ScalaNativeModule {
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.ekrich::sblas::0.7.0"
)
def scalaNativeVersion: mill.T[String] = "0.5.5"
}
trait CommonTests extends TestModule.Munit {
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scalameta::munit::1.0.1",
)
}
object vecxt extends CrossPlatform {
trait Shared extends CrossPlatformScalaModule with Common {
// common `core` settings here
trait SharedTests extends CommonTests {
// common `core` test settings here
}
}
object jvm extends Shared {
override def javacOptions: T[Seq[String]] = super.javacOptions() ++ vecIncubatorFlag
def forkArgs = super.forkArgs() ++ vecIncubatorFlag
def ivyDeps = super.ivyDeps() ++ Agg(
ivy"dev.ludovic.netlib:blas:3.0.3"
)
object test extends ScalaTests with SharedTests {
def forkArgs = super.forkArgs() ++ vecIncubatorFlag
}
}
object js extends Shared with CommonJS {
// js specific settings here
object test extends ScalaJSTests with SharedTests {
def moduleKind = ModuleKind.CommonJSModule
}
}
object native extends Shared with CommonNative {
// native specific settings here
object test extends ScalaNativeTests with SharedTests
}
}
object vecxtensions extends CrossPlatform {
override def moduleDeps: Seq[CrossPlatform] = Seq(vecxt)
trait Shared extends CrossPlatformScalaModule with Common {
// common `core` settings here
trait SharedTests extends CommonTests {
// common `core` test settings here
}
}
object jvm extends Shared {
override def javacOptions: T[Seq[String]] = super.javacOptions() ++ vecIncubatorFlag
def forkArgs = super.forkArgs() ++ vecIncubatorFlag
def ivyDeps = super.ivyDeps() ++ Agg(
)
object test extends ScalaTests with SharedTests {
def forkArgs = super.forkArgs() ++ vecIncubatorFlag
}
}
object js extends Shared with CommonJS {
override def ivyDeps: Target[Agg[Dep]] = super.ivyDeps() ++ Agg(
ivy"com.lihaoyi::scalatags::0.13.1",
ivy"com.raquo::laminar::17.1.0"
)
// js specific settings here
object test extends ScalaJSTests with SharedTests {
def moduleKind = ModuleKind.CommonJSModule
}
}
object native extends Shared with CommonNative {
// native specific settings here
object test extends ScalaNativeTests with SharedTests
}
}
object benchmark extends JmhModule with ScalaModule {
def scalaVersion = vecxt.jvm.scalaVersion
def jmhCoreVersion = "1.37"
override def forkArgs: T[Seq[String]] = super.forkArgs() ++ vecIncubatorFlag
override def moduleDeps: Seq[JavaModule] = Seq(vecxt.jvm)
override def generateBenchmarkSources = T{
val dest = T.ctx().dest
val forkedArgs = forkArgs().toSeq
val sourcesDir = dest / "jmh_sources"
val resourcesDir = dest / "jmh_resources"
os.remove.all(sourcesDir)
os.makeDir.all(sourcesDir)
os.remove.all(resourcesDir)
os.makeDir.all(resourcesDir)
Jvm.runSubprocess(
"org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator",
(runClasspath() ++ generatorDeps()).map(_.path),
mainArgs = Seq(
compile().classes.path.toString,
sourcesDir.toString,
resourcesDir.toString,
"default"
),
jvmArgs = forkedArgs
)
(sourcesDir, resourcesDir)
}
}
object jsSite extends SiteJSModule {
override def moduleDeps = Seq(vecxt.js, vecxtensions.js)
override def scalaVersion = vecxt.js.scalaVersion
override def scalaJSVersion = vecxt.js.scalaJSVersion
override def moduleKind = ModuleKind.ESModule
override def ivyDeps = super.ivyDeps() ++ Agg(
ivy"org.scala-js::scalajs-dom::2.8.0",
ivy"com.lihaoyi::scalatags::0.13.1",
ivy"com.raquo::laminar::17.0.0"
)
}
// note that scastic won't work, as I don't think we can start a JVM with the incubator flag.
object site extends SiteModule {
override val jsSiteModule = jsSite
override def pathToImportMap = Some(PathRef(T.workspace / "importmap.json"))
override def forkArgs: T[Seq[String]] = super.forkArgs() ++ vecIncubatorFlag
def scalaVersion = vecxt.jvm.scalaVersion
override def moduleDeps = Seq(vecxt.jvm)
override def scalaDocOptions = super.scalaDocOptions
}