Repository navigation
Expand file tree
/
Copy pathbuild.sbt
More file actions
242 lines (224 loc) · 8.2 KB
/
Copy pathbuild.sbt
File metadata and controls
242 lines (224 loc) · 8.2 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
val scala3Version = "3.9.0"
val grpcVersion = "1.84.1"
val scalaProtobufRuntimeVersion = "0.8.16"
val zioBlocksSchemaVersion = "0.0.56"
val zioVersion = "2.1.26"
val fs2Version = "3.14.0"
val catsEffectVersion = "3.7.1"
val oxVersion = "1.0.9"
val kyoVersion = "1.0.0-RC7"
val chimneyVersion = "1.11.0"
val circeVersion = "0.14.17"
val zioSchemaVersion = "1.9.0"
val upickleVersion = "4.4.3"
val borerVersion = "1.18.0"
val fastparseVersion = "3.1.1"
val mainargsVersion = "0.7.8"
inThisBuild(
List(
scalaVersion := scala3Version,
organization := "com.github.ghostdogpr",
homepage := Some(url("https://github.com/ghostdogpr/proteus")),
licenses := List(License.Apache2),
scmInfo := Some(ScmInfo(url("https://github.com/ghostdogpr/proteus/"), "scm:git:git@github.com:ghostdogpr/proteus.git")),
developers := List(Developer("ghostdogpr", "Pierre Ricadat", "ghostdogpr@gmail.com", url("https://github.com/ghostdogpr"))),
resolvers += Resolver.sonatypeCentralSnapshots
)
)
name := "proteus"
addCommandAlias("fmt", "all scalafmtSbt scalafmt test:scalafmt")
addCommandAlias("check", "all scalafmtSbtCheck scalafmtCheck test:scalafmtCheck")
lazy val root = project
.in(file("."))
.settings(publish / skip := true)
.aggregate(core.jvm, core.js, tools.jvm, tools.js, diff, grpc, zioGrpc, fs2Grpc, oxGrpc, kyoGrpc, json.jvm, json.js, benchmarks, examples)
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(name := "proteus-core")
.settings(commonSettings)
.settings(
libraryDependencies ++=
Seq(
"dev.zio" %%% "zio-blocks-schema" % zioBlocksSchemaVersion,
"dev.zio" %%% "zio-test" % zioVersion % Test,
"dev.zio" %%% "zio-test-sbt" % zioVersion % Test
)
)
.jvmSettings(
libraryDependencies ++= Seq("io.grpc" % "grpc-protobuf" % grpcVersion)
)
.jsSettings(
dependencyOverrides += "org.scala-lang" %%% "scala3-library" % scalaVersion.value,
libraryDependencies ++= Seq("com.thesamet.scalapb" %%% "protobuf-runtime-scala" % scalaProtobufRuntimeVersion),
Test / fork := false
)
lazy val tools = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("tools"))
.settings(name := "proteus-tools")
.settings(commonSettings)
.settings(
libraryDependencies ++=
Seq(
"com.lihaoyi" %%% "fastparse" % fastparseVersion,
"dev.zio" %%% "zio-test" % zioVersion % Test,
"dev.zio" %%% "zio-test-sbt" % zioVersion % Test
)
)
.dependsOn(core % "compile->compile;test->test")
.jsSettings(Test / fork := false)
lazy val diff = project
.in(file("diff"))
.settings(name := "proteus-diff")
.settings(commonSettings)
.settings(publish / skip := true)
.settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %% "mainargs" % mainargsVersion,
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
)
)
.enablePlugins(JavaAppPackaging, NativeImagePlugin)
.settings(
Compile / mainClass := Some("proteus.diff.Main"),
executableScriptName := "proteus-diff",
nativeImageVersion := "25.0.1",
nativeImageJvm := "graalvm-community",
nativeImageJvmIndex := "cs",
// In CI, GRAALVM_HOME is set by graalvm/setup-graalvm and points to an arch-correct install.
// Prefer it to avoid Coursier cross-arch cache issues (notably on macos-15-intel).
nativeImageGraalHome := sys.env.get("GRAALVM_HOME").map(java.nio.file.Paths.get(_)).getOrElse(nativeImageGraalHome.value),
Global / excludeLintKeys ++= Set(nativeImageVersion, nativeImageJvm, nativeImageJvmIndex),
nativeImageOptions ++= Seq(
"--no-fallback",
"--initialize-at-build-time",
"--gc=epsilon",
"-O2"
),
Compile / resourceGenerators += Def.task {
val file = (Compile / resourceManaged).value / "proteus-version.txt"
IO.write(file, version.value)
Seq(file)
}
)
.dependsOn(tools.jvm)
lazy val grpc = project
.in(file("grpc"))
.settings(name := "proteus-grpc")
.settings(commonSettings)
.settings(
libraryDependencies ++=
Seq(
"io.grpc" % "grpc-stub" % grpcVersion,
"io.grpc" % "grpc-netty" % grpcVersion % Test,
"io.grpc" % "grpc-services" % grpcVersion % Test
)
)
.dependsOn(core.jvm % "compile->compile;test->test")
lazy val zioGrpc = project
.in(file("grpc-zio"))
.settings(name := "proteus-grpc-zio")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-streams" % zioVersion
)
)
.dependsOn(grpc % "compile->compile;test->test")
lazy val fs2Grpc = project
.in(file("grpc-fs2"))
.settings(name := "proteus-grpc-fs2")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % fs2Version,
"org.typelevel" %% "cats-effect" % catsEffectVersion
)
)
.dependsOn(grpc % "compile->compile;test->test")
lazy val oxGrpc = project
.in(file("grpc-ox"))
.settings(name := "proteus-grpc-ox")
.settings(commonSettings)
.settings(
libraryDependencies ++=
Seq(
"com.softwaremill.ox" %% "core" % oxVersion
)
)
.dependsOn(grpc % "compile->compile;test->test")
lazy val kyoGrpc = project
.in(file("grpc-kyo"))
.settings(name := "proteus-grpc-kyo")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
"io.getkyo" %% "kyo-core" % kyoVersion
)
)
.dependsOn(grpc % "compile->compile;test->test")
lazy val json = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("json"))
.settings(name := "proteus-json")
.settings(commonSettings)
.settings(libraryDependencies ++= Seq("io.circe" %%% "circe-core" % circeVersion))
.dependsOn(core % "compile->compile;test->test")
.jsSettings(Test / fork := false)
lazy val benchmarks = project
.in(file("benchmarks"))
.settings(commonSettings)
.settings(publish / skip := true)
.settings(
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf",
"io.scalaland" %% "chimney-protobufs" % chimneyVersion,
"dev.zio" %% "zio-schema-protobuf" % zioSchemaVersion,
"com.lihaoyi" %% "upickle" % upickleVersion,
"io.bullet" %% "borer-derivation" % borerVersion,
"io.getkyo" %% "kyo-schema-protobuf" % kyoVersion
),
Compile / PB.targets := Seq(
scalapb.gen(scala3Sources = true) -> (Compile / sourceManaged).value / "scalapb"
),
scalacOptions ++= Seq(
"-Wconf:msg=(discarded non-Unit):silent",
"-Wconf:msg=Implicit parameters should be provided with a `using` clause:s"
)
)
.dependsOn(core.jvm)
.enablePlugins(JmhPlugin)
lazy val generateProtos = taskKey[Unit]("Generate proto files")
lazy val examples = project
.in(file("examples"))
.settings(name := "proteus-examples")
.settings(commonSettings)
.settings(publish / skip := true)
.settings(
libraryDependencies ++=
Seq(
"io.grpc" % "grpc-netty" % grpcVersion,
"io.grpc" % "grpc-services" % grpcVersion,
"com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf",
"io.scalaland" %% "chimney-protobufs" % chimneyVersion
),
Compile / PB.targets := Seq(
scalapb.gen(scala3Sources = true) -> (Compile / sourceManaged).value / "scalapb"
),
scalacOptions ++= Seq("-Wconf:msg=(discarded non-Unit):silent"),
generateProtos := (Compile / runMain).toTask(" proteus.examples.greeter.ProtoGen").value
)
.dependsOn(zioGrpc, fs2Grpc, oxGrpc, kyoGrpc)
lazy val commonSettings = Def.settings(
scalacOptions ++= Seq(
"-deprecation",
"-Werror",
"-no-indent",
"-Wunused:imports,params,privates,implicits,explicits",
"-Wvalue-discard",
"-Xkind-projector"
),
Test / fork := true
)