-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathProjectPlugin.scala
179 lines (154 loc) · 5.93 KB
/
ProjectPlugin.scala
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
import sbt.Keys._
import sbt._
import higherkindness.mu.rpc.srcgen.Model._
import higherkindness.mu.rpc.srcgen.SrcGenPlugin.autoImport._
import scala.language.reflectiveCalls
object ProjectPlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
object autoImport {
object V {
val catsEffect: String = "3.5.6"
val circe: String = "0.14.10"
val doobie: String = "1.0.0-RC5"
val fs2: String = "3.11.0"
val kindProjector: String = "0.13.3"
val log4cats: String = "2.7.0"
val log4s: String = "1.10.0"
val logback: String = "1.5.12"
val mu: String = "0.33.0"
val natchez: String = "0.3.7"
val pureconfig: String = "0.17.8"
val scala213: String = "2.13.15"
val scopt: String = "4.1.0"
val slf4j: String = "2.0.16"
}
def mu(module: String) = "io.higherkindness" %% module % V.mu
lazy val macroSettings: Seq[Setting[_]] = {
Seq(
libraryDependencies ++= Seq(
scalaOrganization.value % "scala-compiler" % scalaVersion.value % Provided
),
scalacOptions ++= Seq("-Ymacro-annotations")
)
}
lazy val healthCheckSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "log4cats-core" % V.log4cats,
"org.typelevel" %% "log4cats-slf4j" % V.log4cats,
"org.slf4j" % "slf4j-simple" % V.slf4j,
"co.fs2" %% "fs2-core" % V.fs2,
"org.typelevel" %% "cats-effect" % V.catsEffect
)
)
lazy val exampleRouteguideRuntimeSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"co.fs2" %% "fs2-core" % V.fs2
)
)
lazy val exampleRouteguideProtocolSettings: Seq[Def.Setting[_]] = Seq(
muSrcGenIdlType := IdlType.Proto,
muSrcGenIdiomaticEndpoints := true
)
lazy val exampleRouteguideCommonSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % V.circe,
"io.circe" %% "circe-generic" % V.circe,
"io.circe" %% "circe-parser" % V.circe,
"org.log4s" %% "log4s" % V.log4s,
"ch.qos.logback" % "logback-classic" % V.logback
)
)
lazy val exampleSeedLogSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % V.logback,
"org.typelevel" %% "log4cats-core" % V.log4cats,
"org.typelevel" %% "log4cats-slf4j" % V.log4cats
)
)
lazy val exampleSeedConfigSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % V.catsEffect,
"com.github.pureconfig" %% "pureconfig" % V.pureconfig
)
)
lazy val exampleSeedProtobufProtocolSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
mu("mu-rpc-fs2"),
mu("mu-rpc-service")
),
muSrcGenIdlType := IdlType.Proto,
muSrcGenIdiomaticEndpoints := true,
scalacOptions += "-Wconf:src=src_managed/.*:silent"
)
lazy val exampleSeedAvroProtocolSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
mu("mu-rpc-service")
),
muSrcGenIdlType := IdlType.Avro,
muSrcGenIdiomaticEndpoints := true,
scalacOptions += "-Wconf:src=src_managed/.*:silent"
)
lazy val exampleSeedClientAppSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"com.github.scopt" %% "scopt" % V.scopt
)
)
lazy val exampleTodolistCommonSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-core" % V.doobie,
"org.tpolecat" %% "doobie-h2" % V.doobie,
"org.tpolecat" %% "doobie-hikari" % V.doobie,
"org.typelevel" %% "log4cats-core" % V.log4cats,
"org.typelevel" %% "log4cats-slf4j" % V.log4cats,
"ch.qos.logback" % "logback-classic" % V.logback
)
)
lazy val tracingProtocolSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
mu("mu-rpc-service"),
mu("mu-rpc-fs2")
),
muSrcGenIdlType := IdlType.Proto,
muSrcGenIdiomaticEndpoints := true
)
lazy val tracingServerASettings: Seq[Def.Setting[_]] = Seq(
fork := true,
libraryDependencies ++= Seq(
mu("mu-rpc-server"),
mu("mu-rpc-client-netty"),
"org.tpolecat" %% "natchez-jaeger" % V.natchez,
"org.slf4j" % "slf4j-simple" % V.slf4j
).map(_.exclude("org.slf4j", "slf4j-jdk14"))
)
lazy val tracingServerBSettings: Seq[Def.Setting[_]] = Seq(
fork := true,
libraryDependencies ++= Seq(
mu("mu-rpc-server"),
"org.tpolecat" %% "natchez-jaeger" % V.natchez,
"org.slf4j" % "slf4j-simple" % V.slf4j
).map(_.exclude("org.slf4j", "slf4j-jdk14"))
)
lazy val tracingClientSettings: Seq[Def.Setting[_]] = Seq(
libraryDependencies ++= Seq(
mu("mu-rpc-client-netty"),
"org.tpolecat" %% "natchez-jaeger" % V.natchez,
"org.slf4j" % "slf4j-simple" % V.slf4j
)
)
}
import autoImport._
override def projectSettings: Seq[Def.Setting[_]] =
Seq(
description := "mu-scala-examples https://github.com/higherkindness/mu-scala",
scalacOptions --= Seq("-Xfuture", "-Xfatal-warnings"),
scalacOptions ++= Seq(
"-Xlint:-missing-interpolator",
"-Xlint:-byname-implicit",
// "-P:silencer:pathFilters=.*[/]src_managed[/].*",
"-Wconf:src=src_managed/.*:silent"
), // per https://github.com/scala/bug/issues/12072, we need to disable the warnings from doobie
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % V.kindProjector cross CrossVersion.full
)
) ++ macroSettings
}