-
Notifications
You must be signed in to change notification settings - Fork 950
Add missing scalac options to scaladoc task configuration #6499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @pikinier20, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Lightbend Contributors License Agreement: |
Thanks @pikinier20! Can you give us more details about how scaladoc handles unused scalac options? From what I know, scaladoc 3.0.0 is still printing a lot of warnings because of unused options. So maybe we should wait for 3.0.1 before merging. What do you think? |
Yes, I think it should be released after release with my PR to dotty, because we are gonna have warns. My PR to dotty just filters scalacOptions and doesn't print warns for standard scala options. |
I think merging and releasing an sbt with this PR in as soon as possible would be helpful since right now many people cannot publish their scala.js project because doc generation fails (scala/scala3#11943), and the only workaround we can give them is to disable doc generation, when I'd rather tell them to try a dotty nightly with the latest sbt to ensure that this setup works correctly. |
This fix will generate a lot of warnings on all Scala 3.0.0 projects (not only Scala.js):
If people want to try a nightly version of scaladoc with Scala.js, they can do: Compile / doc / scalacOptions ++= (Compile / scalacOptions).value @pikinier20 maybe you could add a scripted test in this PR to check that this fix works with a nighlty version of Scala 3.0.1? |
I understand that, but I think that warnings all the time are better than crashes some of the time :). |
Agreed this has been blocking several releases of libraries migrating to Scala 3 |
Having unactionable warnings to all JS users would be pretty bad UX. If Scaladoc also respect fatal warnings wouldn't it also result to occasional errors? Is it possible to maybe filter in only the necessary scalacOptions only when Scala version is 3.0.0 or something? |
…ng doc on Scala.js project
@@ -2107,7 +2107,11 @@ object Defaults extends BuildCommon { | |||
val projectName = name.value | |||
if (ScalaArtifacts.isScala3(sv)) { | |||
val project = if (config == Compile) projectName else s"$projectName-$config" | |||
Seq("-project", project) | |||
if (scalaVersion.value.startsWith("3.0.0")) { | |||
Seq("-project", project) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could still pass -scalajs here to avoid most issues without introducing warnings:
Seq("-project", project) | |
compileOptions.filter(_ == "-scalajs") ++ Seq("-project", project) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is scaladoc
3.0.0 able to use -scalajs
? I think it was failing in cats-effect
repo even with -scalajs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. We didn't handle -scalajs
in 3.0.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @pikinier20!
I think this can be merged in 1.5 and released before Scala 3.0.1 goes out.
At the moment, sbt fails to pass a -scalajs compiler option flag to scaladoc, causing an error reading the TASTY file of scala-js-dom. This appears to be related to sbt/sbt#6499 which will be included in a later sbt release
Related to: #12298