sbt / sbt-unidoc

sbt plugin to create a unified Scaladoc or Javadoc API document across multiple subprojects.
Apache License 2.0
124 stars 27 forks source link

Duplicate symbols when referring to a project that uses cross-build JVM / JS #82

Open Sciss opened 3 years ago

Sciss commented 3 years ago

https://github.com/Sciss/UnidocCrossProblem

val audioFileURI = uri("https://github.com/Sciss/AudioFile.git#v2.3.1")
val lAudioFile   = ProjectRef(audioFileURI, "rootJVM")

val root = project.in(file("."))
  .enablePlugins(ScalaUnidocPlugin)
  .aggregate(lAudioFile)

When running sbt ++2.13.4! unidoc, basically I am just getting error as if every symbol was already found:

[info] Main Scala API documentation to /data/temp/UnidocCrossProblem/target/scala-2.13/unidoc...
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/jvm/src/main/scala/de/sciss/audiofile/AudioFilePlatform.scala:23:7: AudioFilePlatform is already defined as trait AudioFilePlatform
[error] trait AudioFilePlatform {
[error]       ^
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/jvm/src/main/scala/de/sciss/audiofile/AudioFileTypePlatform.scala:21:7: AudioFileTypePlatform is already defined as trait AudioFileTypePlatform | => root / Scalaunidoc / doc 1s
[error] trait AudioFileTypePlatform {
[error]       ^
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/jvm/src/main/scala/de/sciss/audiofile/ReaderFactoryPlatform.scala:19:7: ReaderFactoryPlatform is already defined as trait ReaderFactoryPlatform | => root / Scalaunidoc / doc 1s
[error] trait ReaderFactoryPlatform {
[error]       ^
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/jvm/target/scala-2.13/src_managed/main/sbt-buildinfo/BuildInfo.scala:7:13: BuildInfo is already defined as case class BuildInfo
[error] case object BuildInfo {
[error]             ^
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/shared/src/main/scala/de/sciss/audiofile/AsyncAudioFile.scala:21:7: AsyncAudioFile is already defined as trait AsyncAudioFile
[error] trait AsyncAudioFile extends AudioFileBase with AsyncChannel {
[error]       ^
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/shared/src/main/scala/de/sciss/audiofile/AsyncBufferHandler.scala:26:26: AsyncBufferHandler is already defined as trait AsyncBufferHandler
[error] private[audiofile] trait AsyncBufferHandler extends BufferHandler {
[error]                          ^
[error] /home/hhrutz/.sbt/1.0/staging/a9131e4c8070a18aff25/audiofile/shared/src/main/scala/de/sciss/audiofile/AsyncBufferHandler.scala:30:26: AsyncBufferReader is already defined as trait AsyncBufferReader
[error] private[audiofile] trait AsyncBufferReader extends AsyncBufferHandler {
[error]                          ^

etc.

I don't know where this comes from. Why does scaladoc/unidoc say all these symbols were already defined? Is there a workaround?

Sciss commented 3 years ago

Ok. Despite aggregate only containing the JVM projects, it seems that the JS projects are still referred to. If they are explicitly removed, it seems to work:

val audioFileURI = uri("https://github.com/Sciss/AudioFile.git#v2.3.1")
val lAudioFile   = ProjectRef(audioFileURI, "rootJVM")
val xAudioFile   = ProjectRef(audioFileURI, "rootJS")

val root = project.in(file("."))
  .enablePlugins(ScalaUnidocPlugin)
  .aggregate(lAudioFile)
  .settings(
    scalaVersion := "2.13.4",
    unidocProjectFilter in (ScalaUnidoc, unidoc) := inAnyProject -- inProjects(xAudioFile)  // !
  )

Should this be documented?