Skip to content

Commit

Permalink
Include Kotlin API documentation in the documentation site
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed May 10, 2024
1 parent 772e4ca commit 53e1c7e
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 6 deletions.
1 change: 1 addition & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies {

implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}"))
implementation("com.diffplug.gradle:goomph:3.37.2")
implementation("dev.adamko.dokkatoo:dokkatoo-plugin:2.3.1")
implementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
implementation("com.github.node-gradle:gradle-node-plugin:3.5.1")
implementation("com.gradle:develocity-gradle-plugin:3.17.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,9 @@ private void configureDependencyManagement(Project project) {
configuration.setCanBeResolved(false);
});
configurations
.matching((configuration) -> configuration.getName().endsWith("Classpath")
.matching((configuration) -> (configuration.getName().endsWith("Classpath")
|| JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME.equals(configuration.getName()))
&& (!configuration.getName().contains("dokkatoo")))
.all((configuration) -> configuration.extendsFrom(dependencyManagement));
Dependency springBootParent = project.getDependencies()
.enforcedPlatform(project.getDependencies()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,10 @@
import java.util.ArrayList;
import java.util.List;

import dev.adamko.dokkatoo.DokkatooExtension;
import dev.adamko.dokkatoo.formats.DokkatooHtmlPlugin;
import org.gradle.api.Project;
import org.gradle.api.tasks.SourceSet;
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions;
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile;

Expand All @@ -44,9 +47,10 @@
class KotlinConventions {

void apply(Project project) {
project.getPlugins()
.withId("org.jetbrains.kotlin.jvm",
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
project.getPlugins().withId("org.jetbrains.kotlin.jvm", (plugin) -> {
project.getTasks().withType(KotlinCompile.class, this::configure);
configureDokkatoo(project);
});
}

private void configure(KotlinCompile compile) {
Expand All @@ -60,4 +64,12 @@ private void configure(KotlinCompile compile) {
compile.getKotlinOptions().setFreeCompilerArgs(freeCompilerArgs);
}

private void configureDokkatoo(Project project) {
project.getPlugins().apply(DokkatooHtmlPlugin.class);
DokkatooExtension dokkatoo = project.getExtensions().getByType(DokkatooExtension.class);
dokkatoo.getDokkatooSourceSets()
.named(SourceSet.MAIN_SOURCE_SET_NAME)
.configure((spec) -> spec.getSourceRoots().setFrom(project.file("src/main/kotlin")));
}

}
1 change: 0 additions & 1 deletion spring-boot-project/spring-boot-autoconfigure/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id "java-library"
id "org.jetbrains.kotlin.jvm"
id "org.springframework.boot.auto-configuration"
id "org.springframework.boot.configuration-properties"
id "org.springframework.boot.conventions"
Expand Down
16 changes: 16 additions & 0 deletions spring-boot-project/spring-boot-docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ dependencies {
configurationProperties(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "configurationPropertiesMetadata"))
configurationProperties(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "configurationPropertiesMetadata"))

dokkatoo(project(path: ":spring-boot-project:spring-boot"))
dokkatoo(project(path: ":spring-boot-project:spring-boot-test"))

implementation(project(path: ":spring-boot-project:spring-boot-actuator"))
implementation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure"))
implementation(project(path: ":spring-boot-project:spring-boot-autoconfigure"))
Expand Down Expand Up @@ -183,6 +186,10 @@ dependencies {
testSlices(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "testSliceMetadata"))
}

dokkatoo {
moduleName.set("Spring Boot Kotlin API")
}

task aggregatedJavadoc(type: Javadoc) {
dependsOn dependencyVersions
project.rootProject.gradle.projectsEvaluated {
Expand Down Expand Up @@ -344,6 +351,9 @@ def antoraApiCatalogContent = tasks.register("antoraApiCatalogContent", Zip) {
from(aggregatedJavadoc) {
into "java"
}
from(tasks.named("dokkatooGeneratePublicationHtml")) {
into "kotlin"
}
}

def copyAntoraContentDependencies = tasks.register("copyAntoraContentDependencies", Copy) {
Expand All @@ -366,6 +376,12 @@ gradle.projectsEvaluated {
}
}

dokkatoo {
dokkatooPublications.configureEach {
includes.from("src/docs/dokkatoo/dokka-overview.md")
}
}

publishing {
publications {
getByName("maven") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ ext:
attributes: { external: true}
- path: [ "Java APIs", "Gradle Plugin" ]
attributes: { external: true }
- path: [ "Kotlin APIs", "Spring Boot" ]
attributes: { external: true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Kotlin APIs
** xref:api:kotlin/index.html[Spring Boot]
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ include::build-tool-plugin:partial$nav-build-tool-plugin.adoc[]
include::cli:partial$nav-cli.adoc[]
include::api:partial$nav-rest-api.adoc[]
include::api:partial$nav-java-api.adoc[]
include::api:partial$nav-kotlin-api.adoc[]
include::specification:partial$nav-specification.adoc[]
include::appendix:partial$nav-appendix.adoc[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# All Modules
_See also the <a href="../java/index.html" target="_blank">Java API documentation (Javadoc)</a>._

0 comments on commit 53e1c7e

Please sign in to comment.