diff --git a/build.sbt b/build.sbt index 935d953264..e52b23a6fa 100644 --- a/build.sbt +++ b/build.sbt @@ -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 +lazy val catsSettings = buildSettings ++ commonSettings ++ publishSettings ++ scoverageSettings ++ javadocSettings lazy val scalacheckVersion = "1.12.5" @@ -95,21 +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 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,