scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.72k stars 1.04k forks source link

Project in directory that ends with `.scala` fails `sbt '++ 3' doc` #18312

Open CJSmith-0141 opened 11 months ago

CJSmith-0141 commented 11 months ago

Compiler version

3.3.0

Minimized code

gh repo clone typelevel/cats cats.scala && cd cats.scala
sbt '++ 3' doc

Output

[info] Main Scala API documentation to /home/tazato/cats.scala/core/.jvm/target/scala-3.3.0/api...
[error] missing argument for option -sourcepath
[info]   scaladoc -help  gives more information
[info] Skipping unused scalacOptions: -Ykind-projector, -source
[error] (coreJVM / Compile / doc) DottyDoc Compilation Failed
[error] Total time: 15 s, completed Jul 30, 2023, 9:27:13 AM

Expectation

scaladoc for scala3 should work regardless of the directory name.

Extra context from this closed issue https://github.com/typelevel/sbt-typelevel/issues/618

I wanted to initially follow the convention for client library names for SurrealDB of surreal.<language name>

CJSmith-0141 commented 11 months ago

Maybe somewhere in here is the culprit? https://github.com/lampepfl/dotty/blob/main/compiler/src/dotty/tools/dotc/classpath/FileUtils.scala

WojciechMazur commented 11 months ago

Thank you for reporting this issue, it's probably a bug in parsing scaladoc settings.

Even though the ScaladocSettings inherits AllScalaSettings it seams to not be able to acknowledge them. Probably there might be issue with settings partitioning here: https://github.com/lampepfl/dotty/blob/082dc6f6a63b7982f305b4f8d4b3245359c6cf26/scaladoc/src/dotty/tools/scaladoc/Scaladoc.scala#L117-L124 Reproducer:

scaladoc --version
scaladoc -sourcepath=anyPath nonExistingDir

yields

> sandbox scaladoc --version
Scaladoc version 3.3.0 -- Copyright 2002-2023, LAMP/EPFL
> scaladoc -sourcepath=anyPath nonExistingDir
bad option '-sourcepath=anyPath' was ignored
scaladoc will ignore following non-existent paths: nonExistingDir
Destination is not provided, please provide '-d' parameter pointing to directory where docs should be created