-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix javadoc missing generated API (#200)
Move Dokka configuration to the `jvm-library` plugin, which is applied before `test-suites`, and stop passing a fixed source root for Dokka so that generated API source set is included. Also fix some configuration avoidance smells. When refactoring build logic into plugins, Dokka stopped recognizing the correct source set. #199 fixed this by passing a specific source root to Dokka, but this caused the resulting javadoc to not include the generated API. Bisecting shows that moving the test suite setup (456f769), making test suites be set up before Dokka, was when the issue started.
- Loading branch information
1 parent
20a64fd
commit 1605270
Showing
6 changed files
with
58 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
build-logic/src/main/kotlin/com/gabrielfeo/kotlin-jvm-library.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,49 @@ | ||
package com.gabrielfeo | ||
|
||
import org.jetbrains.dokka.DokkaConfiguration.Visibility.PUBLIC | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
import java.net.URL | ||
|
||
plugins { | ||
id("org.jetbrains.kotlin.jvm") | ||
id("org.jetbrains.dokka") | ||
`java-library` | ||
} | ||
|
||
val repoUrl: Provider<String> = providers.gradleProperty("repo.url") | ||
|
||
java { | ||
withSourcesJar() | ||
withJavadocJar() | ||
toolchain { | ||
languageVersion.set(JavaLanguageVersion.of(11)) | ||
vendor.set(JvmVendorSpec.AZUL) | ||
} | ||
} | ||
|
||
tasks.withType<DokkaTask>().configureEach { | ||
dokkaSourceSets.all { | ||
sourceRoot("src/main/kotlin") | ||
sourceLink { | ||
localDirectory.set(file("src/main/kotlin")) | ||
remoteUrl.set(repoUrl.map { URL("$it/blob/$version/src/main/kotlin") }) | ||
remoteLineSuffix.set("#L") | ||
} | ||
jdkVersion.set(11) | ||
suppressGeneratedFiles.set(false) | ||
documentedVisibilities.set(setOf(PUBLIC)) | ||
perPackageOption { | ||
matchingRegex.set(""".*\.internal.*""") | ||
suppress.set(true) | ||
} | ||
externalDocumentationLink("https://kotlinlang.org/api/kotlinx.coroutines/") | ||
externalDocumentationLink("https://square.github.io/okhttp/4.x/okhttp/") | ||
externalDocumentationLink("https://square.github.io/retrofit/2.x/retrofit/") | ||
externalDocumentationLink("https://square.github.io/moshi/1.x/moshi/") | ||
externalDocumentationLink("https://square.github.io/moshi/1.x/moshi-kotlin/") | ||
} | ||
} | ||
|
||
tasks.named<Jar>("javadocJar") { | ||
from(tasks.dokkaHtml) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
plugins { | ||
id("org.jetbrains.dokka") version "1.9.20" apply false | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters