-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathbuild.sbt
173 lines (157 loc) · 5.16 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
173
import sbt._
import Keys._
import spray.revolver.RevolverPlugin._
import com.typesafe.sbt.SbtGit.git
import Dependencies._, RhoPlugin._
lazy val rho = project
.in(file("."))
.disablePlugins(MimaPlugin)
.settings(buildSettings: _*)
.aggregate(`rho-core`, `rho-swagger`, `rho-swagger-ui`, `rho-examples`)
lazy val `rho-core` = project
.in(file("core"))
.settings(mimaConfiguration)
.settings(buildSettings)
.settings(
Compile / unmanagedSourceDirectories ++= {
val baseDir = baseDirectory.value
val mainSrcDir = "src/main/scala"
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, minor)) if minor <= 12 => Seq(baseDir / s"$mainSrcDir-2.12-")
case Some((2, minor)) if minor >= 13 => Seq(baseDir / s"$mainSrcDir-2.13+")
case _ => Nil
}
},
libraryDependencies ++= Seq("org.scala-lang.modules" %% "scala-collection-compat" % "2.13.0")
)
lazy val `rho-swagger` = project
.in(file("swagger"))
.settings(buildSettings :+ swaggerDeps: _*)
.settings(mimaConfiguration)
.dependsOn(`rho-core` % "compile->compile;test->test")
lazy val `rho-swagger-ui` = project
.in(file("swagger-ui"))
.settings(buildSettings :+ swaggerUiDeps: _*)
.settings(mimaConfiguration)
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey]("swaggerUiVersion" -> Dependencies.swaggerUi.revision),
buildInfoPackage := "org.http4s.rho.swagger.ui"
)
.dependsOn(`rho-swagger`)
lazy val docs = project
.in(file("docs"))
.settings(buildSettings)
.disablePlugins(MimaPlugin)
.enablePlugins(ScalaUnidocPlugin)
.enablePlugins(SiteScaladocPlugin)
.enablePlugins(GhpagesPlugin)
.settings(
dontPublish,
description := "Api Documentation",
autoAPIMappings := true,
(Compile / scalacOptions) := scaladocOptions(
(ThisBuild / baseDirectory).value,
version.value,
apiVersion.value
),
(ScalaUnidoc / unidoc / unidocProjectFilter) := inProjects(
`rho-core`,
`rho-swagger`
),
git.remoteRepo := "[email protected]:http4s/rho.git",
ghpagesCleanSite := VersionedGhPages.cleanSite0.value,
ghpagesSynchLocal := VersionedGhPages.synchLocal0.value,
(makeSite / mappings) := {
val (major, minor) = apiVersion.value
for {
(f, d) <- (ScalaUnidoc / packageDoc / mappings).value
} yield (f, s"api/$major.$minor/$d")
}
)
.dependsOn(`rho-core`, `rho-swagger`)
lazy val `rho-examples` = project
.in(file("examples"))
.disablePlugins(MimaPlugin)
.settings(buildSettings)
.settings(Revolver.settings)
.settings(
exampleDeps,
dontPublish
)
.dependsOn(`rho-swagger`, `rho-swagger-ui`)
lazy val disabledCompilerFlags = Seq( // TODO: Fix code and re-enable these.
"-Xlint:package-object-classes",
"-Ywarn-numeric-widen",
"-Wnumeric-widen",
"-Xlint:adapted-args",
"-Yno-adapted-args",
"-Wdead-code",
"-Ywarn-dead-code"
)
/* Don't publish setting */
lazy val dontPublish = packagedArtifacts := Map.empty
lazy val license = (ThisBuild / licenses) := Seq(
"Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")
)
lazy val buildSettings = publishing ++
Seq(
scalaVersion := scala_213,
crossScalaVersions := Seq(scala_213, scala_212),
scalacOptions --= disabledCompilerFlags,
resolvers += Resolver.sonatypeRepo("snapshots"),
(run / fork) := true,
(ThisBuild / organization) := "org.http4s",
(ThisBuild / homepage) := Some(url(homepageUrl)),
description := "A self documenting DSL build upon the http4s framework",
license,
libraryDependencies ++= Seq(
http4sServer % "provided",
logbackClassic % "test"
),
libraryDependencies ++= (if (scalaVersion.value.startsWith("2"))
Seq(
shapeless,
silencerPlugin,
silencerLib,
kindProjector,
`scala-reflect` % scalaVersion.value
)
else Seq.empty),
libraryDependencies ++= Seq(munit, munitCatsEffect, scalacheckMunit)
)
// to keep REPL usable
(Compile / console / scalacOptions) --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings")
lazy val publishing = Seq(
extras,
// Don't publish root pom. It's not needed.
(LocalRootProject / packagedArtifacts) := Map.empty,
(Test / publishArtifact) := false,
(ThisBuild / scmInfo) := {
val base = "github.com/http4s/rho"
Some(ScmInfo(url(s"https://$base"), s"scm:git:https://$base", Some(s"scm:git:git@$base")))
}
)
lazy val extras = (ThisBuild / pomExtra) := (
<developers>
<developer>
<id>brycelane</id>
<name>Bryce L. Anderson</name>
<email>bryce.anderson22@gmail.com</email>
</developer>
<developer>
<id>before</id>
<name>André Rouél</name>
</developer>
<developer>
<id>rossabaker</id>
<name>Ross A. Baker</name>
<email>ross@rossabaker.com</email>
</developer>
<developer>
<id>zarthross</id>
<name>Darren A Gibson</name>
<email>zarthross@gmail.com</email>
</developer>
</developers>
)