-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.mill
More file actions
144 lines (129 loc) · 4.49 KB
/
build.mill
File metadata and controls
144 lines (129 loc) · 4.49 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
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
//| mill-version: 1.1.6
//| mill-jvm-version: 21
//| mvnDeps:
//| - com.lihaoyi::mill-contrib-scoverage:$MILL_VERSION
//| - com.lihaoyi::mill-contrib-sonatypecentral:$MILL_VERSION
//| - com.lihaoyi::mill-contrib-jmh:$MILL_VERSION
//| - org.scala-steward::scala-steward-mill-plugin::0.19.0
package build
import mill.*
import mill.scalalib.*
import mill.scalalib.publish.*
import mill.contrib.scoverage.ScoverageModule
import mill.contrib.jmh.JmhModule
import mill.util.VcsVersion
object `package` extends ScalaModule with ScoverageModule with SonatypeCentralPublishModule:
def scalaVersion = "3.8.3-RC1"
def scoverageVersion = "2.5.2"
override def scalacOptions = Seq(
"-deprecation",
"-feature",
// "-explain",
"-new-syntax",
"-unchecked",
"-language:noAutoTupling",
"-Vprofile",
"-Xprint-inline",
// "-Ycheck:all", // cannot be enabled when scoverage used :/
"-Ycheck:macros",
// "-Ydebug-error",
"-Ydebug-flags",
"-Ydebug-missing-refs",
"-Yexplain-lowlevel",
"-Yexplicit-nulls",
// "-Yprint-debug",
// "-Xprint:postInlining",
// "-Xprint-suspension",
// "-Vprint:typer",
"-Wsafe-init",
"-Yshow-suppressed-errors",
"-Yshow-var-bounds",
"-Werror",
"-Wunused:all",
"-experimental",
"-preview",
s"-Xmacro-settings:debugDirectory=$moduleDir/debug,enableVerboseNames=true",
// "-Xmacro-settings:trace=file",
// "-Yprofile-enabled",
// s"-Yprofile-trace:$moduleDir/debug/compile-trace.json",
)
override def scalaDocOptions = Task {
Seq(
"-project",
"alpaca",
"-project-version",
publishVersion(),
"-project-logo",
s"$moduleDir/docs/_assets/images/logo.png",
"-project-footer",
"made with ❤️ and coffee",
"-social-links:github::https://github.com/halotukozak/alpaca",
"-snippet-compiler:compile",
s"-source-links:$moduleDir=github://halotukozak/alpaca/master",
"-revision:master",
)
}
def artifactName = "alpaca"
def publishVersion = Task(VcsVersion.vcsState().format())
def pomSettings = PomSettings(
description = "Another Lexer Parser And Compiler Alpaca",
organization = "io.github.halotukozak",
url = "https://halotukozak.github.io/alpaca/docs/index.html",
licenses = Seq(License.MIT),
versionControl = VersionControl.github("halotukozak", "alpaca"),
developers = Seq(
Developer("halotukozak", "Bartłomiej Kozak", "https://github.com/halotukozak"),
Developer("Corvette653", "Bartosz Buczek", "https://github.com/Corvette653"),
),
)
def mvnDeps = Seq(
mvn"com.github.marianobarrios:dregex:0.9.0",
mvn"org.jparsec:jparsec:3.1",
mvn"org.slf4j:slf4j-api:2.0.17",
mvn"org.slf4j:slf4j-simple:2.0.17",
)
object test extends ScalaTests with TestModule.ScalaTest with ScoverageTests:
def scalaTestVersion = "3.2.19"
object benchmarks extends Module:
trait BenchmarkScalaModule extends ScalaModule with JmhModule:
def jmhCoreVersion = "1.37"
override def mvnDeps = super.mvnDeps() ++ Seq(mvn"org.openjdk.jmh:jmh-core:${jmhCoreVersion()}")
override def forkWorkingDir = Task(moduleDir / os.up)
object alpaca extends BenchmarkScalaModule with JmhModule:
def scalaVersion = build.scalaVersion()
override def scalacOptions = Seq("-experimental", "-preview", "-Yretain-trees")
def moduleDeps = Seq(build)
object fastparse extends BenchmarkScalaModule:
def scalaVersion = "3.8.3"
override def mvnDeps = super.mvnDeps() ++ Seq(mvn"com.lihaoyi::fastparse:3.0.2")
def runAll() = Task.Command {
val root = alpaca.moduleDir / os.up
os.call(("python3", "inputs/generate_tests.py"), cwd = root, stdout = os.Inherit)
os.call(
(
root / os.up / "mill",
"benchmarks.alpaca.runJmh",
"-rf",
"json",
"-rff",
(root / "outputs" / "alpaca_results.json").toString,
),
cwd = root / os.up,
stdout = os.Inherit,
)
os.call(
(
root / os.up / "mill",
"benchmarks.fastparse.runJmh",
"-rf",
"json",
"-rff",
(root / "outputs" / "fastparse_results.json").toString,
),
cwd = root / os.up,
stdout = os.Inherit,
)
os.call(("python3", "sly/benchmark.py"), cwd = root, stdout = os.Inherit)
os.call(("python3", "plot_results.py"), cwd = root, stdout = os.Inherit)
println("\n=== All benchmarks completed. Results in outputs/ ===")
}