From e4e7743c99d5f2d60b806e60f803ceee31536304 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 18 Sep 2023 10:09:24 +0200 Subject: [PATCH] Add external mappings for scaladoc External mappings allow linking to other project's documentation, which makes it easier for users to understand the API. --- build.sc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/build.sc b/build.sc index 13f8c9d2..bc276d50 100644 --- a/build.sc +++ b/build.sc @@ -89,6 +89,23 @@ trait OsModule extends OsLibModule { outer => def ivyDeps = Agg(Deps.geny) def artifactName = "os-lib" + + val scalaDocExternalMappings = Seq( + ".*scala.*::scaladoc3::https://scala-lang.org/api/3.x/", + ".*java.*::javadoc::https://docs.oracle.com/javase/8/docs/api/", + s".*geny.*::scaladoc3::https://javadoc.io/doc/com.lihaoyi/geny_3/${Deps.geny.dep.version}/", + ).mkString(",") + + def conditionalScalaDocOptions: T[Seq[String]] = T { + if (ZincWorkerUtil.isDottyOrScala3(scalaVersion())) + Seq( + s"-external-mappings:${scalaDocExternalMappings}" + ) + else Seq() + } + + def scalaDocOptions = super.scalaDocOptions() ++ conditionalScalaDocOptions() + } object os extends Module {