Add scripted verification that doc works

In 1.4.0-RC2, doc did not actually generate html files for the project
clases. This was fixed in zinc and this commit updates the actions/doc
scripted test to verify that doc actually generates output for the
project classes.
This commit is contained in:
Ethan Atkins 2020-08-25 12:35:35 -07:00
parent d1e7b2c35c
commit dc3bccc57f
3 changed files with 39 additions and 7 deletions

View File

@ -1,5 +1,19 @@
import complete.{ Parser, Parsers }
import Parser._
import Parsers._
lazy val root = (project in file("."))
.settings(
crossPaths := false,
Compile / doc / scalacOptions += "-Xfatal-warnings"
crossScalaVersions := Seq("2.12.12", "2.13.3"),
scalaVersion := "2.12.12",
Compile / doc / scalacOptions += "-Xfatal-warnings",
commands += Command.command("excludeB") { s =>
val impl = """val src = (sources in Compile).value; src.filterNot(_.getName.contains("B"))"""
s"set sources in (Compile, doc) := { $impl }" :: s
},
commands += Command.arb(_ => ("setDocExtension": Parser[String]) ~> " " ~> matched(any.*)) { (s, filter: String) =>
val impl = s"""val src = (sources in Compile).value; src.filter(_.getName.endsWith("$filter"))"""
s"set sources in (Compile, doc) := { $impl }" :: s
},
)

View File

@ -0,0 +1,6 @@
object B {
/**
* @param i An argument
*/
def x(i: Int) = 3
}

View File

@ -1,35 +1,47 @@
> debug
-> doc
# -> doc
> set sources in (Compile, doc) := { val src = (sources in Compile).value; src.filterNot(_.getName contains "B") }
> excludeB
# hybrid project, only scaladoc run
> doc
$ exists target/api/index.js
$ exists target/api/A$.html
$ absent target/api/scala
$ absent target/api/java
> set sources in (Compile, doc) := { val src = (sources in (Compile, doc)).value; src.filterNot(_.getName endsWith ".java") }
> setDocExtension scala
# The original B.scala fails scaladoc
$ copy-file changes/B.scala B.scala
# compile task is superfluous. Since doc task preceded by compile task has been problematic due to scala
# compiler's way of handling empty classpath. We have it here to test that our workaround works.
> clean ; compile ; doc
# pure scala project, only scaladoc at top level
$ exists target/api/index.js
$ exists target/api/A$.html
$ exists target/api/B$.html
$ absent target/api/package-list
$ absent target/api/scala
$ absent target/api/java
> set sources in (Compile, doc) := { val src = (sources in Compile).value; src.filter(_.getName endsWith ".java") }
> setDocExtension java
> clean ; doc
# pure java project, only javadoc at top level
$ exists target/api/index.html
$ exists target/api/pkg/J.html
$ absent target/api/index.js
> setDocExtension scala
> ++2.13.3
> clean
$ absent target/api/A$.html
> doc
$ exists target/api/A$.html
$ exists target/api/B$.html
# pending
# $ absent target/api/scala
# $ absent target/api/java