Skip to content

Commit

Permalink
Make unidoc generate external javadoc links (#477)
Browse files Browse the repository at this point in the history
* make unidoc generate external javadoc links (#353)

* Move code of updating apiMappings
  • Loading branch information
ydash authored Jul 10, 2023
1 parent 17403a4 commit 2b2d325
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions project/Doc.scala
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,24 @@ object UnidocRoot extends AutoPlugin {
Seq(
ScalaUnidoc / unidocProjectFilter := unidocRootProjectFilter(unidocRootIgnoreProjects.value),
JavaUnidoc / unidocProjectFilter := unidocRootProjectFilter(unidocRootIgnoreProjects.value),
Compile / doc / apiMappings ++= {
val entries: Seq[Attributed[File]] = (LocalProject("slf4j") / Compile / fullClasspath).value

def mappingsFor(organization: String, names: List[String], location: String,
revision: String => String = identity): Seq[(File, URL)] = {
for {
entry: Attributed[File] <- entries
module: ModuleID <- entry.get(moduleID.key)
if module.organization == organization
if names.exists(module.name.startsWith)
} yield entry.data -> url(location.format(module.revision))
}

val mappings: Seq[(File, URL)] =
mappingsFor("org.slf4j", List("slf4j-api"), "https://www.javadoc.io/doc/org.slf4j/slf4j-api/%s/")

mappings.toMap
},
ScalaUnidoc / apiMappings := (Compile / doc / apiMappings).value) ++
UnidocRoot.CliOptions.genjavadocEnabled
.ifTrue(Seq(JavaUnidoc / unidocAllSources ~= { v =>
Expand Down

0 comments on commit 2b2d325

Please sign in to comment.