Add gradle task 'aggregateJavadocIncludingTests' that builds javadoc for both main and test

It will allow CI to spot javadoc errors, for example broken links, in test code.

Close apache/calcite-avatica#117
diff --git a/build.gradle.kts b/build.gradle.kts
index 13ee9eb..3953296 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -152,6 +152,20 @@
     setDestinationDir(file("$buildDir/docs/javadocAggregate"))
 }
 
+/** Similar to {@link #javadocAggregate} but includes tests.
+ * CI uses this target to validate javadoc (e.g. checking for broken links). */
+val javadocAggregateIncludingTests by tasks.registering(Javadoc::class) {
+    description = "Generates aggregate javadoc for all the artifacts, including test code"
+
+    val sourceSets = allprojects
+        .mapNotNull { it.extensions.findByType<SourceSetContainer>() }
+        .flatMap { listOf(it.named("main"), it.named("test")) }
+
+    classpath = files(sourceSets.map { set -> set.map { it.output + it.compileClasspath } })
+    setSource(sourceSets.map { set -> set.map { it.allJava } })
+    setDestinationDir(file("$buildDir/docs/javadocAggregateIncludingTests"))
+}
+
 val licenseHeaderFile = file("config/license.header.java")
 
 allprojects {
@@ -446,7 +460,7 @@
 
         // Note: jars below do not normalize line endings.
         // Those jars, however are not included to source/binary distributions
-        // so the normailzation is not that important
+        // so the normalization is not that important
 
         val testJar by tasks.registering(Jar::class) {
             from(sourceSets["test"].output)