From b106f1d11f6156f4aea8c3d3ff34fbfa923ae16a Mon Sep 17 00:00:00 2001 From: Kailuo Wang Date: Fri, 20 May 2016 21:44:47 -0400 Subject: [PATCH 1/2] skip javadoc compilation for 2.10 --- build.sbt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 935d953264..4e7f648fff 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 ++ skip210DocSettings lazy val scalacheckVersion = "1.12.5" @@ -106,6 +106,14 @@ def noDocProjects(sv: String): Seq[ProjectReference] = CrossVersion.partialVersi case _ => Nil } +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 docSettings = Seq( autoAPIMappings := true, unidocProjectFilter in (ScalaUnidoc, unidoc) := From 04bfb7bf90d0b58f23acb32c64ecca7f9a9740ea Mon Sep 17 00:00:00 2001 From: Kailuo Wang Date: Sat, 21 May 2016 09:13:59 -0400 Subject: [PATCH 2/2] consolidate skip 210 doc settings --- build.sbt | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index 4e7f648fff..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 ++ skip210DocSettings +lazy val catsSettings = buildSettings ++ commonSettings ++ publishSettings ++ scoverageSettings ++ javadocSettings lazy val scalacheckVersion = "1.12.5" @@ -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,