From e94e73291360c76429b9ab4428f1560dfea1bf39 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 25 Feb 2019 17:13:39 +0100 Subject: Introduced JavaModule.docOptions to add extra (Java)Doc procesing options E.g. disabling picky JavaDoc linter with `-Xdoclint:none`. The method is called `docOptions` instead of `javadocOptions` so that other modules like `ScalaModule` can reuse it. --- scalalib/src/JavaModule.scala | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/scalalib/src/JavaModule.scala b/scalalib/src/JavaModule.scala index 1a5bc47b..fb128f3c 100644 --- a/scalalib/src/JavaModule.scala +++ b/scalalib/src/JavaModule.scala @@ -298,36 +298,41 @@ trait JavaModule extends mill.Module with TaskModule { outer => } /** - * The documentation jar, containing all the Javadoc/Scaladoc HTML files, for - * publishing to Maven Central - */ + * Additional options for the used doc tool (e.g. javadoc). + */ + def docOptions: T[Seq[String]] = T { Seq[String]() } + + /** + * The documentation jar, containing all the Javadoc/Scaladoc HTML files, for + * publishing to Maven Central + */ def docJar = T[PathRef] { val outDir = T.ctx().dest val javadocDir = outDir / 'javadoc os.makeDir.all(javadocDir) - val files = for{ + val files = for { ref <- allSources() if os.exists(ref.path) p <- (if (os.isDir(ref.path)) os.walk(ref.path) else Seq(ref.path)) if os.isFile(p) && (p.ext == "java") } yield p.toNIO.toString - val options = Seq("-d", javadocDir.toNIO.toString) + val options = docOptions() ++ Seq("-d", javadocDir.toNIO.toString) - if (files.nonEmpty) Jvm.baseInteractiveSubprocess( + if (files.nonEmpty) Jvm.runSubprocess( commandArgs = Seq( "javadoc" ) ++ options ++ - Seq( - "-classpath", - compileClasspath() + Seq( + "-classpath", + compileClasspath() .map(_.path) .filter(_.ext != "pom") .mkString(java.io.File.pathSeparator) - ) ++ - files.map(_.toString), + ) ++ + files.map(_.toString), envArgs = Map(), workingDir = T.ctx().dest ) -- cgit v1.2.3