-
Notifications
You must be signed in to change notification settings - Fork 74
/
ProjectPlugin.scala
154 lines (136 loc) · 5.34 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
import com.typesafe.sbt.site.jekyll.JekyllPlugin.autoImport._
import microsites._
import microsites.MicrositesPlugin.autoImport._
import sbt.Keys._
import sbt._
import sbtorgpolicies.model._
import sbtorgpolicies.OrgPoliciesKeys.orgBadgeListSetting
import sbtorgpolicies.OrgPoliciesPlugin
import sbtorgpolicies.OrgPoliciesPlugin.autoImport._
import sbtorgpolicies.templates.badges._
import sbtorgpolicies.runnable.syntax._
import scoverage.ScoverageKeys
import scoverage.ScoverageKeys._
import tut.TutPlugin.autoImport._
object ProjectPlugin extends AutoPlugin {
override def trigger: PluginTrigger = allRequirements
override def requires: Plugins = OrgPoliciesPlugin
object autoImport {
lazy val V = new {
val base64: String = "0.2.9"
val cats: String = "1.6.1"
val catsEffect: String = "1.1.0"
val circe: String = "0.11.1"
val paradise: String = "2.1.1"
val roshttp: String = "2.2.4"
val simulacrum: String = "0.19.0"
val scala211: String = "2.11.12"
val scala212: String = "2.12.8"
val scalaj: String = "2.4.2"
val scalamockScalatest: String = "3.6.0"
val scalaTest: String = "3.0.8"
val scalaz: String = "7.2.28"
}
lazy val micrositeSettings = Seq(
micrositeName := "Github4s",
micrositeDescription := "Github API wrapper written in Scala",
micrositeBaseUrl := "github4s",
micrositeDocumentationUrl := "/github4s/docs.html",
micrositeGithubOwner := "47deg",
micrositeGithubRepo := "github4s",
micrositeAuthor := "Github4s contributors",
micrositeOrganizationHomepage := "https://github.com/47deg/github4s/blob/master/AUTHORS.md",
micrositeExtraMdFiles := Map(
file("CHANGELOG.md") -> ExtraMdFileConfig(
"changelog.md",
"page",
Map("title" -> "Changelog", "section" -> "changelog", "position" -> "2")
)
),
includeFilter in Jekyll := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.md",
scalacOptions in Tut ~= (_ filterNot Set("-Ywarn-unused-import", "-Xlint").contains)
)
lazy val testSettings = Seq(
fork in Test := false
)
lazy val commonCrossDeps = Seq(
libraryDependencies ++= Seq(
%%("cats-core", V.cats),
%%("cats-free", V.cats),
%%("simulacrum", V.simulacrum),
%%("circe-core", V.circe),
%%("circe-generic", V.circe),
"io.circe" %% "circe-jackson28" % V.circe,
%%("base64", V.base64),
%%("circe-parser", V.circe) % Test,
%%("scalamockScalatest", V.scalamockScalatest) % Test,
%%("scalatest", V.scalaTest) % Test
)
)
lazy val standardCommonDeps = Seq(
libraryDependencies += compilerPlugin(%%("paradise", V.paradise) cross CrossVersion.full)
)
lazy val jvmDeps = Seq(
libraryDependencies ++= Seq(
%%("scalaj", V.scalaj),
"org.mock-server" % "mockserver-netty" % "3.10.8" % Test excludeAll ExclusionRule(
"com.twitter")
)
)
lazy val jsDeps: Def.Setting[Seq[ModuleID]] = libraryDependencies += %%%("roshttp", V.roshttp)
lazy val docsDependencies: Def.Setting[Seq[ModuleID]] = libraryDependencies += %%(
"scalatest",
V.scalaTest)
lazy val scalazDependencies: Def.Setting[Seq[ModuleID]] =
libraryDependencies += %%("scalaz-concurrent", V.scalaz)
lazy val catsEffectDependencies = Seq(
libraryDependencies ++= Seq(
%%("cats-effect", V.catsEffect),
%%("scalatest", V.scalaTest) % Test
)
)
def toCompileTestList(sequence: Seq[ProjectReference]): List[String] = sequence.toList.map {
p =>
val project: String = p.asInstanceOf[LocalProject].project
s"$project/test"
}
}
import autoImport.V
override def projectSettings: Seq[Def.Setting[_]] =
Seq(
name := "github4s",
orgProjectName := "Github4s",
description := "Github API wrapper written in Scala",
startYear := Option(2016),
resolvers += Resolver.sonatypeRepo("snapshots"),
scalaVersion := V.scala212,
crossScalaVersions := Seq(V.scala211, V.scala212),
scalacOptions ~= (_ filterNot Set("-Xlint").contains),
orgGithubTokenSetting := "GITHUB4S_ACCESS_TOKEN",
resolvers += Resolver.bintrayRepo("hmil", "maven"),
orgBadgeListSetting := List(
TravisBadge.apply(_),
GitterBadge.apply(_),
CodecovBadge.apply(_),
MavenCentralBadge.apply(_),
LicenseBadge.apply(_),
ScalaLangBadge.apply(_),
ScalaJSBadge.apply(_),
GitHubIssuesBadge.apply(_)
),
orgSupportedScalaJSVersion := Some("0.6.21"),
orgScriptTaskListSetting ++= List(
(ScoverageKeys.coverageAggregate in Test).asRunnableItemFull,
"docs/tut".asRunnableItem
),
coverageExcludedPackages := "<empty>;github4s\\.scalaz\\..*",
// This is necessary to prevent packaging the BuildInfo with
// sensible information like the Github token. Do not remove.
mappings in (Compile, packageBin) ~= { (ms: Seq[(File, String)]) =>
ms filter {
case (_, toPath) =>
!toPath.startsWith("github4s/BuildInfo")
}
}
) ++ shellPromptSettings
}