Skip to content

Commit d2a3180

Browse files
authored
Fix: UnidocModule does not allow customization of Scala compiler flags, e.g. -Xsource:3 (main branch) (#5036)
Fix #5034
1 parent defd3ff commit d2a3180

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

libs/scalalib/src/mill/scalalib/UnidocModule.scala

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package mill.scalalib
2-
import mill._
2+
import mill.*
33

44
/**
55
* Mix this in to any [[ScalaModule]] to provide a [[unidocSite]] target that
@@ -19,6 +19,15 @@ trait UnidocModule extends ScalaModule {
1919
allSourceFiles() ++ Task.traverse(moduleDeps)(_.allSourceFiles)().flatten
2020
}
2121

22+
/** The title of the scaladoc site. */
23+
def unidocDocumentTitle: T[String] = Task { "Mill" }
24+
25+
/** Extra options passed to scaladoc. */
26+
def unidocOptions: T[Seq[String]] = Task { Seq.empty[String] }
27+
28+
/**
29+
* @param local whether to use 'file://' as the `-doc-source-url`.
30+
*/
2231
def unidocCommon(local: Boolean) = Task.Anon {
2332

2433
val unidocSourceFiles0 = unidocSourceFiles()
@@ -30,7 +39,7 @@ trait UnidocModule extends ScalaModule {
3039
// below is for scala-2 variant
3140
val options: Seq[String] = Seq(
3241
"-doc-title",
33-
"Mill",
42+
unidocDocumentTitle(),
3443
"-d",
3544
Task.dest.toString,
3645
"-classpath",
@@ -48,7 +57,7 @@ trait UnidocModule extends ScalaModule {
4857
"-sourcepath",
4958
Task.workspace.toString
5059
)
51-
}
60+
} ++ unidocOptions()
5261

5362
jvmWorker().worker().docJar(
5463
scalaVersion(),

0 commit comments

Comments
 (0)