-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
204 lines (182 loc) · 5.14 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
199
200
201
202
203
204
import laika.ast.Image
import sbtcrossproject.CrossProject
ThisBuild / tlBaseVersion := "0.3"
ThisBuild / organization := "dev.hnaderi"
ThisBuild / organizationName := "Hossein Naderi"
ThisBuild / startYear := Some(2023)
ThisBuild / licenses := Seq(License.Apache2)
ThisBuild / developers := List(
tlGitHubDev("hnaderi", "Hossein Naderi")
)
ThisBuild / tlSonatypeUseLegacyHost := false
ThisBuild / tlSitePublishBranch := Some("main")
ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / tlFatalWarnings := false
val Scala212 = "2.12.20"
val Scala213 = "2.13.15"
val Scala3 = "3.3.4"
ThisBuild / scalaVersion := Scala212
ThisBuild / crossScalaVersions := Seq(Scala3, Scala213, Scala212)
lazy val root = tlCrossRootProject.aggregate(
core,
libyaml,
jsyaml,
snakeyaml,
backend,
tests,
circe,
`spray-json`,
`play-json`,
json4s,
`zio-json`,
docs,
unidocs
)
def module(mname: String): CrossProject => CrossProject =
_.in(file(s"modules/$mname"))
.settings(
name := s"module-$mname",
moduleName := s"yaml4s-$mname"
)
lazy val core = module("core") {
crossProject(NativePlatform, JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.settings(
description := "yaml4s core"
)
}
lazy val libyaml = module("libyaml") {
crossProject(NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core, tests % Test)
.settings(
description := "yaml4s Native parser using libyaml"
)
}
lazy val jsyaml = module("jsyaml") {
crossProject(JSPlatform)
.crossType(CrossType.Pure)
.dependsOn(core, tests % Test)
.settings(
description := "yaml4s JS parser using js-yaml",
Compile / npmDependencies ++= Seq("js-yaml" -> "4.1.0"),
scalaJSUseMainModuleInitializer := true,
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
.enablePlugins(ScalaJSBundlerPlugin)
}
lazy val snakeyaml = module("snake") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.dependsOn(core, tests % Test)
.settings(
description := "yaml4s JVM parser using snake yaml engine",
libraryDependencies += "org.snakeyaml" % "snakeyaml-engine" % "2.8"
)
}
lazy val tests = module("tests") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.enablePlugins(NoPublishPlugin)
.settings(
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "1.0.0",
"org.scalameta" %%% "munit-scalacheck" % "1.0.0"
)
)
}
lazy val backend = module("backend") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.jsConfigure(_.dependsOn(jsyaml.js))
.jvmConfigure(_.dependsOn(snakeyaml.jvm))
.nativeConfigure(_.dependsOn(libyaml.native))
}
lazy val circe = module("circe") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(
description := "yaml4s integration with circe",
libraryDependencies += "io.circe" %%% "circe-core" % "0.14.10"
)
}
lazy val `spray-json` = module("spray-json") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(
description := "yaml4s integration with spray-json",
libraryDependencies +=
"io.spray" %%% "spray-json" % "1.3.6"
)
}
lazy val `play-json` = module("play-json") {
crossProject(JVMPlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(
description := "yaml4s integration with play-json",
libraryDependencies +=
("org.playframework" %%% "play-json" % "3.0.4")
.cross(CrossVersion.for3Use2_13)
)
}
lazy val json4s = module("json4s") {
crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(
description := "yaml4s integration with json4s",
libraryDependencies += "org.json4s" %%% "json4s-ast" % "4.0.7"
)
}
lazy val `zio-json` = module("zio-json") {
crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
.settings(
description := "yaml4s integration with zio-json",
libraryDependencies += "dev.zio" %%% "zio-json" % "0.7.3"
)
}
lazy val docs = project
.in(file("site"))
.dependsOn(
backend.jvm,
circe.jvm,
json4s.jvm,
`play-json`.jvm,
`zio-json`.jvm,
`spray-json`.jvm
)
.enablePlugins(Yaml4sSitePlugin)
lazy val unidocs = project
.in(file("unidocs"))
.enablePlugins(TypelevelUnidocPlugin)
.settings(
name := "yaml4s-docs",
description := "unified docs for yaml4s",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(
core.jvm,
libyaml.native,
snakeyaml.jvm,
jsyaml.js,
backend.jvm,
circe.jvm,
`play-json`.jvm,
json4s.jvm,
`spray-json`.jvm,
`zio-json`.jvm
)
)
val vcpkgBaseDir = "C:/vcpkg/"
ThisBuild / nativeConfig ~= { c =>
if (BuildEnv.isWindows) { // vcpkg-installed curl
c.withCompileOptions(
c.compileOptions :+ s"-I${vcpkgBaseDir}/installed/x64-windows/include/"
).withLinkingOptions(
c.linkingOptions :+ s"-L${vcpkgBaseDir}/installed/x64-windows/lib/"
)
} else c
}