-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sbt
198 lines (183 loc) · 6.51 KB
/
build.sbt
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
198
inThisBuild(
List(
organization := "dev.zio",
homepage := Some(url("https://zio.dev/zio-parser/")),
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"jdegoes",
"John De Goes",
url("http://degoes.net")
),
Developer(
"vigoo",
"Daniel Vigovszky",
url("https://github.com/vigoo")
)
),
pgpPassphrase := sys.env.get("PGP_PASSWORD").map(_.toArray),
pgpPublicRing := file("/tmp/public.asc"),
pgpSecretRing := file("/tmp/secret.asc")
)
)
// Versions
val scala212 = "2.12.20"
val scala213 = "2.13.15"
val scala3 = "3.3.4"
val javaPlatform = "11"
val zioVersion = "2.1.12"
// Command aliases for convenience and for CI
addCommandAlias("fmt", s"++$scala213; scalafmtSbt; scalafmtAll")
addCommandAlias("check", s"++$scala213; scalafmtSbtCheck; scalafmtCheckAll")
addCommandAlias("testJVM", ";zioParserJVM/test; calibanParser/test")
addCommandAlias("testJS", ";zioParserJS/test")
addCommandAlias("testNative", ";zioParserNative/test")
addCommandAlias("testJVM_212", s"++$scala212 ;zioParserJVM/test; calibanParser/test")
addCommandAlias("testJS_212", s"++$scala212 ;zioParserJS/test")
addCommandAlias("testNative_212", s"++$scala212 ;zioParserNative/test")
addCommandAlias("testJVM_213", s"++$scala213 ;zioParserJVM/test; calibanParser/test; benchmarks/test")
addCommandAlias("testJS_213", s"++$scala213 ;zioParserJS/test")
addCommandAlias("testNative_213", s"++$scala213 ;zioParserNative/test")
addCommandAlias("testJVM_3", s"++$scala3 ;zioParserJVM/test; calibanParser/test")
addCommandAlias("testJS_3", s"++$scala3 ;zioParserJS/test")
addCommandAlias("testNative_3", s"++$scala3 ;zioParserNative/test")
// Common settings for all projects
lazy val commonSettings = Seq(
crossScalaVersions := Seq(scala212, scala213, scala3),
scalaVersion := scala3,
Test / parallelExecution := true,
scalacOptions ++= Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-unchecked",
"-language:experimental.macros",
s"-release:$javaPlatform"
) ++ (CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
Seq(
"-language:higherKinds",
"-language:existentials",
"-explaintypes",
"-Yrangepos",
"-Xsource:2.13"
)
case Some((2, 13)) =>
Seq(
"-language:higherKinds",
"-language:existentials",
"-explaintypes",
"-Yrangepos"
)
case Some((3, _)) =>
Seq(
"-Xfatal-warnings",
"-Xcheck-macros",
"-language:implicitConversions",
"-Xignore-scala2-macros"
)
case _ => Seq()
})
)
lazy val root = (project in file("."))
.aggregate(
zioParserJVM,
zioParserJS,
zioParserNative,
calibanParser,
docs
)
.settings(
crossScalaVersions := Nil,
publish / skip := true
)
lazy val zioParser = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("zio-parser"))
.settings(commonSettings)
.settings(
name := "zio-parser",
libraryDependencies ++=
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) =>
Seq.empty
case _ =>
Seq(
compilerPlugin("org.typelevel" % "kind-projector" % "0.13.3" cross CrossVersion.full),
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided
)
}),
libraryDependencies ++= Seq(
"dev.zio" %%% "zio" % zioVersion,
"dev.zio" %%% "zio-streams" % zioVersion,
"dev.zio" %%% "zio-test" % zioVersion % Test,
"dev.zio" %%% "zio-test-sbt" % zioVersion % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
lazy val zioParserJVM = zioParser.jvm
lazy val zioParserJS = zioParser.js
.settings(
scalaJSUseMainModuleInitializer := true,
libraryDependencies ++= Seq(
("org.scala-js" %% "scalajs-test-interface" % scalaJSVersion).cross(CrossVersion.for3Use2_13)
)
)
lazy val zioParserNative = zioParser.native
.settings(
libraryDependencies ++= Seq("org.scala-native" %%% "test-interface" % nativeVersion)
)
lazy val calibanParser = project
.in(file("zio-parser-caliban"))
.settings(commonSettings)
.settings(
name := "zio-parser-caliban",
publish / skip := true,
libraryDependencies ++= Seq(
"com.github.ghostdogpr" %% "caliban" % "2.4.3",
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.dependsOn(zioParserJVM)
lazy val benchmarks = (project in file("benchmarks"))
.settings(
scalaVersion := scala213,
publish / skip := true,
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-parse" % "1.0.0",
"com.lihaoyi" %% "fastparse" % "3.0.2",
"org.tpolecat" %% "atto-core" % "0.9.5",
"org.parboiled" %% "parboiled" % "2.5.1",
"org.http4s" %% "parsley" % "1.5.0-M3",
"org.spartanz" %% "parserz" % "0.2.4",
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
),
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
.enablePlugins(JmhPlugin)
.dependsOn(zioParserJVM)
lazy val docs = project
.in(file("zio-parser-docs"))
.settings(
name := "zio-parser",
scalaVersion := scala3,
publish / skip := true,
moduleName := "zio-parser-docs",
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
projectName := "ZIO Parser",
mainModuleName := (zioParserJVM / moduleName).value,
projectStage := ProjectStage.Development,
docsPublishBranch := "master",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(zioParserJVM)
)
.dependsOn(zioParserJVM)
.enablePlugins(WebsitePlugin)