Skip to content

Commit

Permalink
consolidate skip 210 doc settings
Browse files Browse the repository at this point in the history
  • Loading branch information
kailuowang committed May 22, 2016
1 parent b106f1d commit 04bfb7b
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ lazy val commonJvmSettings = Seq(
// JVM settings. https://github.com/tkawachi/sbt-doctest/issues/52
) ++ catsDoctestSettings

lazy val catsSettings = buildSettings ++ commonSettings ++ publishSettings ++ scoverageSettings ++ skip210DocSettings
lazy val catsSettings = buildSettings ++ commonSettings ++ publishSettings ++ scoverageSettings ++ javadocSettings

lazy val scalacheckVersion = "1.12.5"

Expand All @@ -95,29 +95,27 @@ lazy val testingDependencies = Seq(
libraryDependencies += "org.typelevel" %%% "catalysts-macros" % "0.0.2" % "test",
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.0-M7" % "test")


/**
* Remove 2.10 projects from doc generation, as the macros used in the projects
* cause problems generating the documentation on scala 2.10. As the APIs for 2.10
* and 2.11 are the same this has no effect on the resultant documentation, though
* it does mean that the scaladocs cannot be generated when the build is in 2.10 mode.
*/
def noDocProjects(sv: String): Seq[ProjectReference] = CrossVersion.partialVersion(sv) match {
case Some((2, 10)) => Seq[ProjectReference](coreJVM)
case _ => Nil
* Remove 2.10 projects from doc generation, as the macros used in the projects
* cause problems generating the documentation on scala 2.10. As the APIs for 2.10
* and 2.11 are the same this has no effect on the resultant documentation, though
* it does mean that the scaladocs cannot be generated when the build is in 2.10 mode.
*/
def docsSourcesAndProjects(sv: String): (Boolean, Seq[ProjectReference]) =
CrossVersion.partialVersion(sv) match {
case Some((2, 10)) => (false, Nil)
case _ => (true, Seq(coreJVM, freeJVM))
}

lazy val skip210DocSettings = Seq(
sources in (Compile, doc) := (
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 10)) => Nil
case _ => (sources in (Compile, doc)).value
})
lazy val javadocSettings = Seq(
sources in (Compile, doc) := (if (docsSourcesAndProjects(scalaVersion.value)._1) (sources in (Compile, doc)).value else Nil)
)

lazy val docSettings = Seq(
autoAPIMappings := true,
unidocProjectFilter in (ScalaUnidoc, unidoc) :=
inProjects(coreJVM, freeJVM) -- inProjects(noDocProjects(scalaVersion.value): _*),
inProjects(docsSourcesAndProjects(scalaVersion.value)._2:_*),
site.addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), "api"),
site.addMappingsToSiteDir(tut, "_tut"),
ghpagesNoJekyll := false,
Expand Down

0 comments on commit 04bfb7b

Please sign in to comment.