scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

2.13.12 stdlib Scaladoc was published with incorrect source links #12875

Closed SethTisue closed 1 year ago

SethTisue commented 1 year ago

e.g. https://www.scala-lang.org/api/current/scala/collection/immutable/List.html links to https://github.com/scala/scala/tree/v2.13.12src/library/scala/collection/immutable/List.scala#L79 which is wrong — note the "v2.13.12src" with the slash missing

the root cause is https://github.com/scala/bug/issues/12867

I'm milestoning this for 2.13.13 and assigning myself, but we shouldn't just leave the published docs broken until 2.13.13; I should be able to ssh to chara.epfl.ch and fix them up

SethTisue commented 1 year ago

I was able to ssh to chara and fix up the docs in /home/linuxsoft/archives/scala/api/2.13.12

that doesn't seem to have fixed the docs at e.g. https://www.scala-lang.org/api/current/scala/collection/immutable/List.html , but I think it might be that the files need to sync somewhere? I'll check on it again tomorrow I guess

Also, I still need to PR a fix to our build.

som-snytt commented 1 year ago

I see the PR had a test for the encoding issue, but why was there no test failure?

The existing test did not test -sourcepath, and in fact the help text is wrong:

To obtain a relative path for €{FILE_PATH} and €{FILE_PATH_EXT} instead of an absolute one, use the -sourcepath setting.

The existing test gets a relative path because it is the path that was supplied:

val expect = s"file:test/scaladoc/resources/doc-source-url@@.scala@@test/scaladoc/resources/doc-source-url.scala@@13"

There was no test for paths relative to sourcepath.

Probably the help text meant to say that paths are relativized to -sourcepath if provided. Paths are never absolutized. The usage of the word "absolute" was wrong.

I'll take a look at dottydoc to compare behaviors.

som-snytt commented 1 year ago

I don't see where dotty configures the URL, but I see we should use blob not tree,

https://github.com/scala/scala/blob/v2.13.10/src/library/scala/Predef.scala#L106

The doc is at https://docs.scala-lang.org/scala3/guides/scaladoc/settings.html#-source-links

Template can defined only by subset of sources defined by path prefix represented by <sub-path>. In such case paths used in templates will be relativized against <sub-path>

som-snytt commented 1 year ago

We need a label for regret.

SethTisue commented 1 year ago

that doesn't seem to have fixed the docs at e.g. scala-lang.org/api/current/scala/collection/immutable/List.html , but I think it might be that the files need to sync somewhere? I'll check on it again tomorrow I guess

it synced

and I've submitted scala/scala#10548 to fix the problem for next time