Skip to content

Commit

Permalink
Merge pull request #249 from mkurz/scala3api
Browse files Browse the repository at this point in the history
Also generate Scala 3 scaladoc (requires tasty files)
  • Loading branch information
mkurz authored Jul 16, 2023
2 parents d117bca + bda0ad8 commit 4677155
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion project/OmnidocBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,25 @@ object OmnidocBuild {
// want to deal with bringing extra libraries into Omnidoc.
((s ** "*.scala") --- (s ** "JsMacroImpl.scala")).get
},
Compile / sources := (scaladoc / sources).value, // Needed for Scala 3 compilation, see comments below
Compile / dependencyClasspath := dependencyClasspath.value, // Needed for Scala 3 compilation, see comments below
scaladoc / target := target.value / "scaladoc",
scaladoc / scalacOptions := scaladocOptions.value,
scaladoc := rewriteSourceUrls(scaladoc.value, sourceUrls.value, "/src/main/scala", ".scala")
scaladoc := {
if (ScalaArtifacts.isScala3(scalaVersion.value)) {
// Scala 3 scaladoc ("dottydoc") does not support .scala files at the moment (unless Scala 2 scaladoc
// which does). It requires .tasty and/or .jar files to generate the scala doc. That means, when on Scala 3,
// we need to trigger a full compilation to generate those .tasty files.
// (This requires to set Compile / dependencyClasspath and Compile / sources)
// See
// https://github.com/lampepfl/dotty/issues/11454#issuecomment-1636872223
// https://github.com/lampepfl/dotty/pull/18215
(Compile / compile).value
} else {
// No compilation needed for Scala 2
}
rewriteSourceUrls(scaladoc.value, sourceUrls.value, "/src/main/scala", ".scala")
}
)

def javadocSettings: Seq[Setting[_]] = Defaults.docTaskSettings(javadoc) ++ Seq(
Expand Down

0 comments on commit 4677155

Please sign in to comment.