-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectPlugin.scala
More file actions
141 lines (128 loc) · 4.76 KB
/
ProjectPlugin.scala
File metadata and controls
141 lines (128 loc) · 4.76 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
import com.typesafe.sbt.site.SitePlugin.autoImport._
import mdoc.MdocPlugin.autoImport._
import microsites.{CdnDirectives, ConfigYml}
import microsites.MicrositesPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt.Keys._
import sbt._
object ProjectPlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
object autoImport {
lazy val commonCrossDependencies =
Seq(
libraryDependencies ++=
Seq(
"org.typelevel" %%% "cats-effect" % "3.6.3",
"co.fs2" %% "fs2-core" % "3.12.2",
"org.typelevel" %%% "munit-cats-effect" % "2.1.0" % "test"
)
)
lazy val fs2Dependencies =
Seq(
libraryDependencies ++=
Seq(
"co.fs2" %% "fs2-core" % "3.12.2"
)
)
lazy val doobieDependencies = Seq(
libraryDependencies ++= Seq(
"org.tpolecat" %% "doobie-core" % "1.0.0-RC6"
)
)
lazy val http4sDependencies =
Seq(
libraryDependencies ++=
Seq(
"org.http4s" %%% "http4s-client" % "1.0.0-M44"
)
)
lazy val http4s023Dependencies =
Seq(
libraryDependencies ++=
Seq(
"org.http4s" %%% "http4s-client" % "0.23.30"
)
)
lazy val micrositeSettings: Seq[Def.Setting[_]] = Seq(
micrositeName := "Fetchless",
micrositeDescription := "Automatic data batching for Scala",
micrositeBaseUrl := "fetchless",
micrositeDocumentationUrl := "/fetchless/docs",
micrositeHighlightTheme := "tomorrow",
micrositeExternalLayoutsDirectory := (Compile / resourceDirectory).value / "microsite" / "_layouts",
micrositeExternalIncludesDirectory := (Compile / resourceDirectory).value / "microsite" / "_includes",
micrositeDataDirectory := (Compile / resourceDirectory).value / "microsite" / "_data",
micrositeTheme := "pattern",
micrositePalette := Map(
"brand-primary" -> "#DD4949",
"brand-secondary" -> "#104051",
"brand-tertiary" -> "#EFF2F3",
"gray-dark" -> "#48474C",
"gray" -> "#8D8C92",
"gray-light" -> "#E3E2E3",
"gray-lighter" -> "#F4F3F9",
"white-color" -> "#FFFFFF"
),
makeSite / includeFilter := "*.html" | "*.css" | "*.png" | "*.svg" | "*.jpg" | "*.gif" | "*.js" | "*.json" | "*.swf" | "*.md",
micrositeGithubToken := Option(System.getenv().get("GITHUB_TOKEN")),
micrositePushSiteWith := GitHub4s,
micrositeConfigYaml := ConfigYml(
yamlPath = Some((Compile / resourceDirectory).value / "microsite" / "custom-config.yml")
),
micrositeCDNDirectives := CdnDirectives(
cssList = List(
"css/custom.css"
)
)
)
lazy val docsSettings: Seq[Def.Setting[_]] =
micrositeSettings ++ Seq(
scalacOptions ~= (_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-dead-code"))),
doc / aggregate := true
)
lazy val examplesSettings = Seq(
libraryDependencies ++= Seq(
"io.circe" %% "circe-generic" % "0.14.1",
"org.tpolecat" %% "doobie-core" % "1.0.0-RC6",
"org.tpolecat" %% "doobie-h2" % "1.0.0-RC2",
"org.tpolecat" %% "atto-core" % "0.9.5",
"org.http4s" %% "http4s-blaze-client" % "0.23.8",
"org.http4s" %% "http4s-circe" % "0.23.8",
"redis.clients" % "jedis" % "4.1.0"
)
) ++ commonCrossDependencies
}
override def projectSettings: Seq[Def.Setting[_]] =
Seq(
scalacOptions := {
val withStripedLinter = scalacOptions.value filterNot Set("-Xlint", "-Xfuture").contains
(scalaBinaryVersion.value match {
case "2.13" => withStripedLinter :+ "-Ymacro-annotations"
case _ => withStripedLinter
}) :+ "-language:higherKinds"
},
libraryDependencies ++= (scalaBinaryVersion.value match {
case "3" =>
Seq.empty
case _ =>
Seq(
compilerPlugin(
"org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full
),
compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1")
)
}),
scalacOptions := Seq(
"-unchecked",
"-deprecation",
"-feature",
"-language:higherKinds",
"-language:existentials",
"-language:postfixOps"
) ++ (scalaBinaryVersion.value match {
case "3" => Seq("-source:3.0-migration", "-Ykind-projector")
case "2.13" => Seq("-Ywarn-dead-code")
case "2.12" => Seq("-Ywarn-dead-code", "-Ypartial-unification")
})
)
}