aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stage2/plugins/Dotty.scala32
-rw-r--r--test/test.scala1
2 files changed, 33 insertions, 0 deletions
diff --git a/stage2/plugins/Dotty.scala b/stage2/plugins/Dotty.scala
index 8869860..5fdf066 100644
--- a/stage2/plugins/Dotty.scala
+++ b/stage2/plugins/Dotty.scala
@@ -23,6 +23,11 @@ trait Dotty extends BaseBuild{
)
}
+ def doc: ExitCode =
+ dottyLib.doc(
+ sourceFiles, compileClasspath, docTarget, dottyOptions
+ )
+
def repl = dottyLib.repl(context.args, classpath)
override def dependencies = Resolver(mavenCentral).bind(
@@ -59,6 +64,33 @@ class DottyLib(
)
}
+ def doc(
+ sourceFiles: Seq[File],
+ dependencyClasspath: ClassPath,
+ docTarget: File,
+ compileArgs: Seq[String]
+ ): ExitCode = {
+ if(sourceFiles.isEmpty){
+ ExitCode.Success
+ } else {
+ docTarget.mkdirs
+ val args = Seq(
+ // FIXME: can we use compiler dependency here?
+ "-bootclasspath", dottyDependency.classpath.string, // FIXME: does this break for builds that don't have scalac dependencies?
+ "-classpath", (dependencyClasspath ++ dottyDependency.classpath).string, // FIXME: does this break for builds that don't have scalac dependencies?
+ "-d", docTarget.toString
+ ) ++ compileArgs ++ sourceFiles.map(_.toString)
+ logger.lib("creating docs for source files "+args.mkString(", "))
+ redirectOutToErr{
+ runMain(
+ "dotty.tools.dottydoc.DottyDoc",
+ args,
+ dottyDependency.classLoader(classLoaderCache)
+ )
+ }
+ }
+ }
+
def compile(
needsRecompile: Boolean,
files: Seq[File],
diff --git a/test/test.scala b/test/test.scala
index f8ba351..ca64d99 100644
--- a/test/test.scala
+++ b/test/test.scala
@@ -195,6 +195,7 @@ object Main{
compile("../examples/multi-project-example")
compile("../examples/dotty-example")
task("run","../examples/dotty-example")
+ task("doc","../examples/dotty-example")
task("fastOptJS","../examples/scalajs-react-example/js")
task("fullOptJS","../examples/scalajs-react-example/js")
compile("../examples/uber-jar-example")