-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathProjectPlugin.scala
More file actions
127 lines (116 loc) · 4.92 KB
/
ProjectPlugin.scala
File metadata and controls
127 lines (116 loc) · 4.92 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
import com.typesafe.sbt.site.SitePlugin.autoImport._
import microsites._
import microsites.MicrositesPlugin.autoImport._
import sbt.Keys._
import sbt._
import scoverage.ScoverageKeys._
import sbtunidoc.ScalaUnidocPlugin.autoImport._
import mdoc.MdocPlugin.autoImport._
object ProjectPlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
object autoImport {
lazy val V = new {
val bm4 = "0.3.1"
val cats: String = "2.10.0"
val circe: String = "0.14.7"
val expecty = "0.16.0"
val http4s: String = "0.23.26"
val http4sBlazeClient: String = "0.23.16"
val paradise: String = "2.1.1"
val scalacheck = "1.18.0"
val scalacheckShapeless = "1.3.0"
val scalacheckPlusScalatest = "3.2.14.0"
val scalatest: String = "3.2.18"
val shapeless3 = "3.4.1"
}
lazy val docsMappingsAPIDir: SettingKey[String] =
settingKey[String]("Name of subdirectory in site target directory for api docs")
lazy val micrositeSettings = Seq(
micrositeName := "Github4s",
micrositeDescription := "Github API wrapper written in Scala",
micrositeBaseUrl := "github4s",
micrositeDocumentationUrl := "docs",
micrositeAuthor := "Github4s contributors",
micrositeGithubToken := Option(System.getenv().get("GITHUB_TOKEN")),
micrositePushSiteWith := GitHub4s,
micrositeOrganizationHomepage := "https://github.com/47degrees/github4s/blob/main/AUTHORS.md",
micrositePalette := Map(
"brand-primary" -> "#3D3832",
"brand-secondary" -> "#f90",
"white-color" -> "#FFFFFF"
),
micrositeExtraMdFiles := Map(
file("CHANGELOG.md") -> ExtraMdFileConfig(
"changelog.md",
"page",
Map(
"title" -> "Changelog",
"section" -> "home",
"position" -> "3",
"permalink" -> "changelog"
)
)
),
micrositeExtraMdFilesOutput := mdocIn.value,
makeSite / includeFilter := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.md" | "*.svg",
scalacOptions ~= (_ filterNot Set(
"-Ywarn-unused-import",
"-Xlint",
"-Xfatal-warnings"
).contains),
ScalaUnidoc / docsMappingsAPIDir := "api",
addMappingsToSiteDir(
ScalaUnidoc / packageDoc / mappings,
ScalaUnidoc / docsMappingsAPIDir
)
)
lazy val coreDeps = Seq(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % V.cats,
"io.circe" %% "circe-core" % V.circe,
"io.circe" %% "circe-generic" % V.circe,
"org.http4s" %% "http4s-client" % V.http4s,
"org.http4s" %% "http4s-circe" % V.http4s,
"io.circe" %% "circe-parser" % V.circe % Test,
"com.eed3si9n.expecty" %% "expecty" % V.expecty % Test,
"org.scalatest" %% "scalatest" % V.scalatest % Test,
"org.http4s" %% "http4s-blaze-client" % V.http4sBlazeClient % Test,
"org.http4s" %% "http4s-dsl" % V.http4s % Test,
"org.http4s" %% "http4s-server" % V.http4s % Test,
"org.scalacheck" %% "scalacheck" % V.scalacheck % Test,
"org.scalatestplus" %% "scalacheck-1-16" % V.scalacheckPlusScalatest % Test
),
libraryDependencies ++= on(2, 12)(
compilerPlugin("org.scalamacros" %% "paradise" % V.paradise cross CrossVersion.full)
).value,
libraryDependencies ++= on(2)(
"com.github.alexarchambault" %% "scalacheck-shapeless_1.15" % V.scalacheckShapeless % Test
).value,
libraryDependencies ++= on(2)(
compilerPlugin("com.olegpy" %% "better-monadic-for" % V.bm4)
).value,
libraryDependencies ++= on(3)(
"org.typelevel" %% "shapeless3-deriving" % V.shapeless3 % Test
).value
)
}
override def projectSettings: Seq[Def.Setting[_]] =
Seq(
scalacOptions ++= on(2, 13)("-Ymacro-annotations").value,
coverageFailOnMinimum := true
)
def on[A](major: Int, minor: Int)(a: A): Def.Initialize[Seq[A]] =
Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some(v) if v == (major, minor) => Seq(a)
case _ => Nil
}
}
def on[A](major: Int)(a: A): Def.Initialize[Seq[A]] =
Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some(v) if v._1 == major => Seq(a)
case _ => Nil
}
}
}