forked from scalapb/zio-grpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
153 lines (139 loc) · 5 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
import Settings.stdSettings
val Scala3 = "3.1.1"
val Scala213 = "2.13.7"
val Scala212 = "2.12.15"
val ScalaVersions = Seq(Scala212, Scala213, Scala3)
ThisBuild / resolvers += Resolver.sonatypeRepo("snapshots")
publish / skip := true
sonatypeProfileName := "com.thesamet"
inThisBuild(
List(
organization := "com.thesamet.scalapb.zio-grpc",
homepage := Some(url("https://github.com/scalapb/zio-grpc")),
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
),
developers := List(
Developer(
"thesamet",
"Nadav Samet",
url("https://www.thesamet.com")
)
)
)
)
lazy val core = projectMatrix
.in(file("core"))
.defaultAxes()
.settings(stdSettings)
.settings(
name := "zio-grpc-core",
libraryDependencies ++= Seq(
"dev.zio" %%% "zio" % Version.zio,
"dev.zio" %%% "zio-streams" % Version.zio,
"dev.zio" %%% "zio-test" % Version.zio % "test",
"dev.zio" %%% "zio-test-sbt" % Version.zio % "test"
)
)
.jvmPlatform(
ScalaVersions,
Seq(
libraryDependencies ++= Seq(
"io.grpc" % "grpc-services" % Version.grpc
)
)
)
.customRow(
true,
Seq(Scala212, Scala213),
Seq(VirtualAxis.js),
_.enablePlugins(ScalaJSPlugin, ScalaJSBundlerPlugin)
.settings(
libraryDependencies ++= Seq(
"com.thesamet.scalapb.grpcweb" %%% "scalapb-grpcweb" % "0.6.4",
"io.github.cquiroz" %%% "scala-java-time" % "2.3.0" % "test"
),
Compile / npmDependencies += "grpc-web" -> "1.2.1"
)
)
lazy val codeGen = projectMatrix
.in(file("code-gen"))
.defaultAxes()
.enablePlugins(BuildInfoPlugin)
.settings(stdSettings)
.settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "scalapb.zio_grpc",
name := "zio-grpc-codegen",
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "compilerplugin" % scalapb.compiler.Version.scalapbVersion
)
)
.jvmPlatform(scalaVersions = ScalaVersions)
lazy val codeGenJVM212 = codeGen.jvm(Scala212)
lazy val protocGenZio = protocGenProject("protoc-gen-zio", codeGenJVM212)
.settings(
Compile / mainClass := Some("scalapb.zio_grpc.ZioCodeGenerator"),
scalaVersion := Scala212,
assembly / assemblyMergeStrategy := {
case PathList("scala", "annotation", "nowarn.class" | "nowarn$.class") =>
MergeStrategy.first
case x =>
(assembly / assemblyMergeStrategy).value.apply(x)
}
)
lazy val e2e =
projectMatrix
.in(file("e2e"))
.dependsOn(core)
.defaultAxes()
.enablePlugins(LocalCodeGenPlugin)
.jvmPlatform(ScalaVersions)
.settings(stdSettings)
.settings(
publish / skip := true,
libraryDependencies ++= Seq(
"dev.zio" %% "zio-test" % Version.zio % "test",
"dev.zio" %% "zio-test-sbt" % Version.zio % "test",
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion,
"io.grpc" % "grpc-netty" % Version.grpc
),
Compile / PB.targets := Seq(
scalapb.gen(grpc = true) -> (Compile / sourceManaged).value,
genModule(
"scalapb.zio_grpc.ZioCodeGenerator$"
) -> (Compile / sourceManaged).value
),
PB.protocVersion := "3.13.0",
codeGenClasspath := (codeGenJVM212 / Compile / fullClasspath).value,
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework")
)
lazy val docs = project
.enablePlugins(LocalCodeGenPlugin)
.in(file("zio-grpc-docs"))
.dependsOn(core.jvm(Scala213))
.settings(
scalaVersion := Scala213,
publish / skip := true,
moduleName := "zio-grpc-docs",
mdocVariables := Map(
"sbtProtocVersion" -> "1.0.2",
"grpcVersion" -> "1.41.2",
"zioGrpcVersion" -> "0.5.0",
"scalapbVersion" -> scalapb.compiler.Version.scalapbVersion
),
libraryDependencies ++= Seq(
"io.grpc" % "grpc-netty" % Version.grpc,
"com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion
),
libraryDependencySchemes += "com.thesamet.scalapb" %% "scalapb-runtime" % "always",
Compile / PB.targets := Seq(
scalapb.gen(grpc = true) -> (Compile / sourceManaged).value,
genModule(
"scalapb.zio_grpc.ZioCodeGenerator$"
) -> (Compile / sourceManaged).value
),
codeGenClasspath := (codeGenJVM212 / Compile / fullClasspath).value
)
.enablePlugins(MdocPlugin, DocusaurusPlugin)