I'm trying to organise the members of a class in my library API documentation using @groupname and @group tags, but it doesn't work (I'm using sbt 0.13.11)
My toy build.sbt
:
name := "test"
scalaVersion := "2.10.5"
My toy code src/main/scala/test.scala
:
package test
/** Test class
*
* @groupname print Printer
* @groupname throw Thrower
*/
class TestClass {
/** @group print */
def trivialPrint: Unit = print("Hello")
/** @group throw */
def trivialError: Unit = throw new Exception("Hello")
}
sbt doc
compiles an API doc where both my functions are in the "Value Members" group of the class (cf. screenshot). What am I doing wrong?
Prior to Scala 2.11 you have to explicitly ask for Scaladoc grouping support in your build.sbt
:
name := "test"
scalaVersion := "2.10.5"
scalacOptions += "-groups"
You could scope it to in (Compile, doc)
, but I'm not sure it matters much.
Like most things related to Scaladoc this is essentially undocumented, but it works.
At least for Scala 2.11.x, it seems like we do still need to ask for it specifically. Consider the following in your build.sbt
:
/* Normal scalac options */
scalacOptions := Seq(
"-deprecation",
"-Ypartial-unification",
"-Ywarn-value-discard",
"-Ywarn-unused-import",
"-Ywarn-dead-code",
"-Ywarn-numeric-widen"
)
/* Only invoked when you do `doc` in SBT */
scalacOptions in (Compile, doc) += "-groups"
And then your example as you have it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With