-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.sbt
172 lines (158 loc) · 5.2 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
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
ThisBuild / organization := "io.circe"
ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.6")
ThisBuild / githubWorkflowPublishTargetBranches := Nil
ThisBuild / githubWorkflowJobSetup := {
(ThisBuild / githubWorkflowJobSetup).value.toList.map {
case step @ WorkflowStep.Use(UseRef.Public("actions", "checkout", "v2"), _, _, _, _, _) =>
step.copy(params = step.params.updated("submodules", "recursive"))
case other => other
}
}
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Use(
UseRef.Public(
"codecov",
"codecov-action",
"v1"
)
)
)
val compilerOptions = Seq(
"-deprecation",
"-encoding",
"UTF-8",
"-feature",
"-language:existentials",
"-language:higherKinds",
"-unchecked",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)
val circeVersion = "0.14.1"
val everitVersion = "1.14.3"
val previousCirceJsonSchemaVersion = "0.1.0"
val scala212 = "2.12.12"
val scala213 = "2.13.7"
ThisBuild / crossScalaVersions := Seq(scala213, scala212)
def priorTo2_13(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 => true
case _ => false
}
val baseSettings = Seq(
resolvers += "jitpack".at("https://jitpack.io"),
scalacOptions ++= compilerOptions,
scalacOptions ++= (
if (priorTo2_13(scalaVersion.value))
Seq(
"-Xfuture",
"-Yno-adapted-args",
"-Ywarn-unused-import"
)
else
Seq(
"-Ywarn-unused:imports"
)
),
Compile / console / scalacOptions ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))
},
Test / console / scalacOptions ~= {
_.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))
},
coverageHighlighting := true,
(Compile / scalastyleSources) ++= (Compile / unmanagedSourceDirectories).value
)
val allSettings = baseSettings ++ publishSettings
val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")
val root = project.in(file(".")).settings(allSettings).settings(noPublishSettings).aggregate(schema).dependsOn(schema)
lazy val schema = project
.in(file("schema"))
.settings(allSettings)
.settings(
moduleName := "circe-json-schema",
mimaPreviousArtifacts := Set("io.circe" %% "circe-json-schema" % previousCirceJsonSchemaVersion),
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion % Test,
"io.circe" %% "circe-jawn" % circeVersion % Test,
"io.circe" %% "circe-testing" % circeVersion % Test,
"com.github.everit-org.json-schema" % "org.everit.json.schema" % everitVersion,
"org.scalatest" %% "scalatest-flatspec" % "3.2.17" % Test,
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.11.0" % Test
),
ghpagesNoJekyll := true,
docMappingsApiDir := "api",
addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir)
)
lazy val publishSettings = Seq(
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
homepage := Some(url("https://github.com/circe/circe-json-schema")),
licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
publishMavenStyle := true,
Test / publishArtifact := false,
pomIncludeRepository := { _ =>
false
},
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots".at(nexus + "content/repositories/snapshots"))
else
Some("releases".at(nexus + "service/local/staging/deploy/maven2"))
},
autoAPIMappings := true,
apiURL := Some(url("https://circe.github.io/circe-json-schema/api/")),
scmInfo := Some(
ScmInfo(
url("https://github.com/circe/circe-json-schema"),
"scm:git:[email protected]:circe/circe-json-schema.git"
)
),
developers := List(
Developer(
"travisbrown",
"Travis Brown",
url("https://twitter.com/travisbrown")
)
)
)
lazy val noPublishSettings = Seq(
publish := {},
publishLocal := {},
publishArtifact := false
)
credentials ++= (
for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
username,
password
)
).toSeq
ThisBuild / githubWorkflowJavaVersions := Seq("[email protected]")
// No auto-publish atm. Remove this line to generate publish stage
ThisBuild / githubWorkflowPublishTargetBranches := Seq.empty
ThisBuild / githubWorkflowJobSetup := {
(ThisBuild / githubWorkflowJobSetup).value.toList.map {
case step @ WorkflowStep.Use(UseRef.Public("actions", "checkout", "v2"), _, _, _, _, _) =>
step.copy(params = step.params.updated("submodules", "recursive"))
case other => other
}
}
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(
List("clean", "coverage", "test", "coverageReport", "scalastyle", "scalafmtCheckAll"),
id = None,
name = Some("Test")
),
WorkflowStep.Use(
UseRef.Public("codecov", "codecov-action", "e156083f13aff6830c92fc5faa23505779fbf649"), // v1.2.1
name = Some("Upload code coverage")
)
)