-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sbt
135 lines (120 loc) · 4.62 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
import explicitdeps.ExplicitDepsPlugin.autoImport.moduleFilterRemoveValue
ThisBuild / tlBaseVersion := "0.1"
ThisBuild / licenses := Seq(License.MIT)
ThisBuild / developers := List(
tlGitHubDev("christopherdavenport", "Christopher Davenport")
)
ThisBuild / tlCiReleaseBranches := Seq("main")
ThisBuild / tlSonatypeUseLegacyHost := false
ThisBuild / tlMimaPreviousVersions := Set()
val Scala212 = "2.12.20"
val Scala213 = "2.13.15"
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.4")
ThisBuild / scalaVersion := Scala213
// disable sbt-header plugin until we are not aligned on the license
ThisBuild / headerCheckAll := Nil
// temporarily disable dependency submissions in CI
ThisBuild / tlCiDependencyGraphJob := false
val catsV = "2.11.0"
val catsEffectV = "3.5.6"
val fs2V = "3.9.2"
val http4sV = "0.23.29"
val munitCatsEffectV = "2.0.0"
import scalapb.compiler.Version.scalapbVersion
// Projects
lazy val `http4s-grpc` = tlCrossRootProject
.aggregate(core, codeGenerator, codeGeneratorTesting, codeGeneratorPlugin)
.settings(
unusedCompileDependenciesFilter -= moduleFilter()
)
.disablePlugins(HeaderPlugin)
lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(
name := "http4s-grpc",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV,
"org.typelevel" %%% "cats-effect" % catsEffectV,
"co.fs2" %%% "fs2-core" % fs2V,
"co.fs2" %%% "fs2-io" % fs2V,
"co.fs2" %%% "fs2-scodec" % fs2V,
"org.http4s" %%% "http4s-dsl" % http4sV,
"org.http4s" %%% "http4s-client" % http4sV,
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectV % Test,
"com.thesamet.scalapb" %%% "scalapb-runtime" % scalapbVersion,
),
unusedCompileDependenciesFilter -= moduleFilter(),
)
.jsSettings(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) }
)
.disablePlugins(HeaderPlugin)
lazy val codeGenerator =
project
.in(file("codegen/generator"))
.settings(
name := "http4s-grpc-generator",
crossScalaVersions := Seq(Scala212),
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "compilerplugin" % scalapbVersion
),
unusedCompileDependenciesFilter -= moduleFilter(),
)
.disablePlugins(HeaderPlugin, ScalafixPlugin)
lazy val codegenFullName =
"org.http4s.grpc.generator.Http4sGrpcCodeGenerator"
lazy val codeGeneratorPlugin = project
.in(file("codegen/plugin"))
.enablePlugins(BuildInfoPlugin, SbtPlugin)
.settings(
name := "sbt-http4s-grpc",
crossScalaVersions := Seq(Scala212),
buildInfoPackage := "org.http4s.grpc.sbt",
buildInfoOptions += BuildInfoOption.PackagePrivate,
buildInfoKeys := Seq[BuildInfoKey](
version,
organization,
scalaBinaryVersion,
"codeGeneratorModule" -> (codeGenerator / name).value,
"coreModule" -> (core.jvm / name).value,
"codeGeneratorClass" -> codegenFullName,
),
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %% "compilerplugin" % scalapbVersion
),
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.7"),
addSbtPlugin("org.portable-scala" % "sbt-platform-deps" % "1.0.2"),
unusedCompileDependenciesFilter -= moduleFilter(),
)
.disablePlugins(HeaderPlugin, ScalafixPlugin)
lazy val codeGeneratorTesting = crossProject(JVMPlatform, JSPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("codegen/testing"))
.enablePlugins(LocalCodeGenPlugin, BuildInfoPlugin, NoPublishPlugin)
.dependsOn(core)
.settings(
tlFatalWarnings := false,
codeGenClasspath := (codeGenerator / Compile / fullClasspath).value,
Compile / PB.targets := Seq(
scalapb.gen(grpc = false) -> (Compile / sourceManaged).value / "scalapb",
genModule(codegenFullName + "$") -> (Compile / sourceManaged).value / "http4s-grpc",
),
Compile / PB.protoSources += baseDirectory.value.getParentFile / "src" / "main" / "protobuf",
libraryDependencies ++= Seq(
"com.thesamet.scalapb" %%% "scalapb-runtime" % scalapbVersion % "protobuf",
"org.typelevel" %%% "munit-cats-effect" % munitCatsEffectV % Test,
"org.typelevel" %%% "scalacheck-effect-munit" % "2.0.0-M2" % Test,
),
buildInfoPackage := "org.http4s.grpc.e2e.buildinfo",
buildInfoKeys := Seq[BuildInfoKey](
"sourceManaged" -> (Compile / sourceManaged).value / "http4s-grpc"
),
githubWorkflowArtifactUpload := false,
unusedCompileDependenciesFilter -= moduleFilter(),
)
.disablePlugins(HeaderPlugin, ScalafixPlugin)
lazy val site = project
.in(file("site"))
.enablePlugins(Http4sOrgSitePlugin)
.dependsOn(core.jvm)