Skip to content

Commit 0ae89cf

Browse files
authored
Generate aggregate javadoc and sources at top-level (#11)
1 parent f057224 commit 0ae89cf

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ repositories {
1010
mavenCentral()
1111
}
1212

13+
java {
14+
withJavadocJar()
15+
withSourcesJar()
16+
}
17+
1318
val embed by configurations.creating {
1419
isTransitive = false
1520
}
@@ -25,3 +30,15 @@ tasks.jar {
2530
dependsOn(embed)
2631
from(embed.map { zipTree(it) })
2732
}
33+
tasks.javadoc {
34+
dependsOn(embed)
35+
setSource(subprojects.map { it.sourceSets.main.get().allSource })
36+
classpath = files(subprojects.flatMap { it.sourceSets.main.get().compileClasspath })
37+
if (JavaVersion.current().isJava9Compatible) {
38+
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
39+
}
40+
}
41+
tasks.named<Jar>("sourcesJar") {
42+
dependsOn(embed)
43+
from(subprojects.map { it.sourceSets.main.get().allSource })
44+
}

buildSrc/src/main/kotlin/instrument-glue.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ tasks.register<JavaExec>("generateGlue") {
3636
tasks.compileJava {
3737
dependsOn(tasks.named("generateGlue"))
3838
}
39+
tasks.named("sourcesJar") {
40+
dependsOn(tasks.named("generateGlue"))
41+
}
3942

4043
tasks.jar {
4144
// glue classes only contain large string constants that get inlined into other classes

buildSrc/src/main/kotlin/java-common.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,19 @@ java {
1919
toolchain {
2020
languageVersion = JavaLanguageVersion.of(17)
2121
}
22+
withJavadocJar()
23+
withSourcesJar()
2224
}
2325
tasks.withType<JavaCompile>().configureEach {
2426
options.release = 8
2527
}
2628

29+
tasks.javadoc {
30+
if (JavaVersion.current().isJava9Compatible) {
31+
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
32+
}
33+
}
34+
2735
dependencies {
2836
compileOnly(libs.spotbugs.annotations)
2937
testCompileOnly(libs.spotbugs.annotations)

0 commit comments

Comments
 (0)