mirror of
https://github.com/square/okhttp.git
synced 2026-01-25 16:01:38 +03:00
Switch to Dokka v2 (#9263)
* Update Dokka to v2 update configuration to use experimental V2 plugin mode and adjust documentation generation scripts.
This commit is contained in:
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
@@ -722,6 +722,9 @@ jobs:
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v5
|
||||
|
||||
- name: Run with Jlink
|
||||
run: ./gradlew module-tests:imageRun
|
||||
- name: Test module-tests
|
||||
run: ./gradlew module-tests:test -PokhttpModuleTests=true
|
||||
|
||||
- name: Run with Jlink
|
||||
run: ./gradlew module-tests:imageRun -PokhttpModuleTests=true
|
||||
|
||||
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"java.compile.nullAnalysis.mode": "automatic"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension
|
||||
import java.net.URI
|
||||
import kotlinx.validation.ApiValidationExtension
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.jetbrains.dokka.gradle.DokkaTaskPartial
|
||||
import org.jetbrains.dokka.gradle.DokkaExtension
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
@@ -38,7 +38,14 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply(plugin = "org.jetbrains.dokka")
|
||||
val okhttpDokka: String by project
|
||||
val dokkaBuild = okhttpDokka.toBoolean()
|
||||
val platform = System.getProperty("okhttp.platform", "jdk9")
|
||||
val testJavaVersion = System.getProperty("test.java.version", "21").toInt()
|
||||
|
||||
if (dokkaBuild) {
|
||||
apply(plugin = "org.jetbrains.dokka")
|
||||
}
|
||||
apply(plugin = "com.diffplug.spotless")
|
||||
|
||||
configure<SpotlessExtension> {
|
||||
@@ -78,8 +85,7 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
val platform = System.getProperty("okhttp.platform", "jdk9")
|
||||
val testJavaVersion = System.getProperty("test.java.version", "21").toInt()
|
||||
|
||||
|
||||
/** Configure building for Java+Kotlin projects. */
|
||||
subprojects {
|
||||
@@ -197,8 +203,7 @@ subprojects {
|
||||
}
|
||||
}
|
||||
|
||||
val platform = System.getProperty("okhttp.platform", "jdk9")
|
||||
val testJavaVersion = System.getProperty("test.java.version", "21").toInt()
|
||||
|
||||
|
||||
if (project.name != "okhttp") {
|
||||
val testRuntimeOnly: Configuration by configurations.getting
|
||||
@@ -304,26 +309,39 @@ subprojects {
|
||||
|
||||
/** Configure publishing and signing for published Java and JavaPlatform subprojects. */
|
||||
subprojects {
|
||||
tasks.withType<DokkaTaskPartial>().configureEach {
|
||||
dokkaSourceSets.configureEach {
|
||||
reportUndocumented.set(false)
|
||||
skipDeprecated.set(true)
|
||||
jdkVersion.set(8)
|
||||
perPackageOption {
|
||||
matchingRegex.set(".*\\.internal.*")
|
||||
suppress.set(true)
|
||||
}
|
||||
if (project.file("Module.md").exists()) {
|
||||
includes.from(project.file("Module.md"))
|
||||
}
|
||||
externalDocumentationLink {
|
||||
url.set(URI.create("https://square.github.io/okio/3.x/okio/").toURL())
|
||||
packageListUrl.set(URI.create("https://square.github.io/okio/3.x/okio/okio/package-list").toURL())
|
||||
plugins.withId("com.vanniktech.maven.publish.base") {
|
||||
if (dokkaBuild) {
|
||||
apply(plugin = "org.jetbrains.dokka")
|
||||
|
||||
extensions.configure<DokkaExtension> {
|
||||
dokkaSourceSets.configureEach {
|
||||
reportUndocumented.set(false)
|
||||
skipDeprecated.set(true)
|
||||
jdkVersion.set(21)
|
||||
perPackageOption {
|
||||
matchingRegex.set(".*\\.internal.*")
|
||||
suppress.set(true)
|
||||
}
|
||||
if (project.file("Module.md").exists()) {
|
||||
includes.from(project.file("Module.md"))
|
||||
}
|
||||
externalDocumentationLinks.register("okio") {
|
||||
url.set(URI.create("https://square.github.io/okio/3.x/okio/"))
|
||||
packageListUrl.set(URI.create("https://square.github.io/okio/3.x/okio/okio/package-list"))
|
||||
}
|
||||
|
||||
externalDocumentationLinks.named("jdk") {
|
||||
url.set(URI.create("https://docs.oracle.com/en/java/javase/21/docs/api/"))
|
||||
packageListUrl.set(URI.create("https://docs.oracle.com/en/java/javase/21/docs/api/element-list"))
|
||||
}
|
||||
externalDocumentationLinks.register("androidRef") {
|
||||
url.set(URI.create("https://developer.android.com/reference/"))
|
||||
packageListUrl.set(URI.create("https://developer.android.com/reference/package-list"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("com.vanniktech.maven.publish.base") {
|
||||
configure<MavenPublishBaseExtension> {
|
||||
publishToMavenCentral(automaticRelease = true)
|
||||
signAllPublications()
|
||||
@@ -376,3 +394,22 @@ plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||
tasks.wrapper {
|
||||
distributionType = Wrapper.DistributionType.ALL
|
||||
}
|
||||
|
||||
if (dokkaBuild) {
|
||||
dependencies {
|
||||
add("dokka", project(":okhttp"))
|
||||
add("dokka", project(":okhttp-brotli"))
|
||||
add("dokka", project(":okhttp-coroutines"))
|
||||
add("dokka", project(":okhttp-dnsoverhttps"))
|
||||
add("dokka", project(":okhttp-java-net-cookiejar"))
|
||||
add("dokka", project(":logging-interceptor"))
|
||||
add("dokka", project(":okhttp-sse"))
|
||||
add("dokka", project(":okhttp-tls"))
|
||||
add("dokka", project(":okhttp-urlconnection"))
|
||||
add("dokka", project(":okhttp-zstd"))
|
||||
add("dokka", project(":mockwebserver"))
|
||||
add("dokka", project(":mockwebserver3"))
|
||||
add("dokka", project(":mockwebserver3-junit4"))
|
||||
add("dokka", project(":mockwebserver3-junit5"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,8 @@ androidBuild=false
|
||||
graalBuild=false
|
||||
loomBuild=false
|
||||
containerTests=false
|
||||
okhttpModuleTests=false
|
||||
okhttpDokka=false
|
||||
|
||||
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ gradlePlugin-animalsniffer = "ru.vyarus:gradle-animalsniffer-plugin:2.0.1"
|
||||
gradlePlugin-binaryCompatibilityValidator = "org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin:0.18.1"
|
||||
gradlePlugin-bnd = { module = "biz.aQute.bnd:biz.aQute.bnd.gradle", version.ref = "biz-aQute-bnd" }
|
||||
gradlePlugin-burst = { module = "app.cash.burst:burst-gradle-plugin", version = "2.10.2" }
|
||||
gradlePlugin-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:2.0.0"
|
||||
gradlePlugin-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:2.1.0"
|
||||
gradlePlugin-errorprone = "net.ltgt.gradle:gradle-errorprone-plugin:4.3.0"
|
||||
gradlePlugin-graalvmBuildTools = "org.graalvm.buildtools.native:org.graalvm.buildtools.native.gradle.plugin:0.11.3"
|
||||
gradlePlugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "org-jetbrains-kotlin" }
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import com.vanniktech.maven.publish.JavadocJar
|
||||
import com.vanniktech.maven.publish.KotlinJvm
|
||||
import org.jetbrains.kotlin.gradle.dsl.kotlinExtension
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ plugins {
|
||||
dependencies {
|
||||
implementation(projects.okhttp)
|
||||
implementation(projects.loggingInterceptor)
|
||||
|
||||
// Force version 26.0.2-1 which is a proper JPMS module, unlike transitive 13.0
|
||||
implementation("org.jetbrains:annotations:26.0.2-1")
|
||||
|
||||
testImplementation(projects.okhttp)
|
||||
testImplementation(projects.loggingInterceptor)
|
||||
@@ -33,9 +36,6 @@ jlinkApplication {
|
||||
}
|
||||
|
||||
extraJavaModuleInfo {
|
||||
module("org.jetbrains:annotations", "org.jetbrains.annotations") {
|
||||
exportAllPackages()
|
||||
}
|
||||
module("com.squareup.okio:okio-jvm", "okio") {
|
||||
exportAllPackages()
|
||||
requires("kotlin.stdlib")
|
||||
@@ -46,6 +46,12 @@ extraJavaModuleInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude dokka from all configurations
|
||||
// to attempt to avoid https://github.com/gradlex-org/extra-java-module-info/issues/221
|
||||
configurations.all {
|
||||
exclude(group = "org.jetbrains.dokka")
|
||||
}
|
||||
|
||||
val testJavaVersion = System.getProperty("test.java.version", "21").toInt()
|
||||
|
||||
tasks.withType<Test> {
|
||||
|
||||
@@ -5,7 +5,6 @@ import ru.vyarus.gradle.plugin.animalsniffer.AnimalSnifferExtension
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("com.gradleup.shadow")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
id("ru.vyarus.animalsniffer")
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import com.vanniktech.maven.publish.KotlinJvm
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
}
|
||||
|
||||
@@ -3,16 +3,15 @@
|
||||
import com.vanniktech.maven.publish.JavadocJar
|
||||
import com.vanniktech.maven.publish.KotlinMultiplatform
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||
import ru.vyarus.gradle.plugin.animalsniffer.AnimalSniffer
|
||||
import ru.vyarus.gradle.plugin.animalsniffer.AnimalSnifferExtension
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("com.android.library")
|
||||
kotlin("plugin.serialization")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish.base")
|
||||
id("binary-compatibility-validator")
|
||||
id("app.cash.burst")
|
||||
|
||||
@@ -52,7 +52,10 @@ include(":samples:static-server")
|
||||
include(":samples:tlssurvey")
|
||||
include(":samples:unixdomainsockets")
|
||||
include(":container-tests")
|
||||
include(":module-tests")
|
||||
val okhttpModuleTests: String by settings
|
||||
if (okhttpModuleTests.toBoolean()) {
|
||||
include(":module-tests")
|
||||
}
|
||||
|
||||
project(":okhttp-logging-interceptor").name = "logging-interceptor"
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
set -ex
|
||||
|
||||
# Test generating the javadoc jars
|
||||
./gradlew publishToMavenLocal -DRELEASE_SIGNING_ENABLED=false
|
||||
./gradlew publishToMavenLocal -DRELEASE_SIGNING_ENABLED=false -PokhttpDokka=true
|
||||
|
||||
# Generate the API docs
|
||||
./gradlew dokkaHtmlMultiModule
|
||||
./gradlew dokkaGeneratePublicationHtml -PokhttpDokka=true
|
||||
|
||||
mv ./build/dokka/htmlMultiModule docs/4.x
|
||||
mv ./build/dokka/html docs/4.x
|
||||
|
||||
# Copy in special files that GitHub wants in the project root.
|
||||
cat README.md | grep -v 'project website' > docs/index.md
|
||||
|
||||
Reference in New Issue
Block a user