21
21
import java .util .List ;
22
22
23
23
import dev .adamko .dokkatoo .DokkatooExtension ;
24
+ import dev .adamko .dokkatoo .formats .DokkatooHtmlPlugin ;
24
25
import org .gradle .api .Project ;
25
26
import org .gradle .api .tasks .SourceSet ;
26
27
import org .gradle .api .tasks .SourceSetContainer ;
27
28
import org .jetbrains .kotlin .gradle .dsl .KotlinJvmOptions ;
28
29
import org .jetbrains .kotlin .gradle .tasks .KotlinCompile ;
29
30
30
31
/**
31
- * Conventions that are applied in the presence of the
32
- * {@code org.jetbrains.kotlin.jvm} plugin. When the plugin is applied:
32
+ * Conventions that are applied in the presence of the {@code org.jetbrains.kotlin.jvm}
33
+ * plugin. When the plugin is applied:
33
34
*
34
35
* <ul>
35
36
* <li>{@link KotlinCompile} tasks are configured to:
@@ -50,7 +51,7 @@ class KotlinConventions {
50
51
void apply (Project project ) {
51
52
project .getPlugins ().withId ("org.jetbrains.kotlin.jvm" , (plugin ) -> {
52
53
project .getTasks ().withType (KotlinCompile .class , this ::configure );
53
- configureDokkatoo (project );
54
+ project . getPlugins (). withType ( DokkatooHtmlPlugin . class , ( dokkatooPlugin ) -> configureDokkatoo (project ) );
54
55
});
55
56
}
56
57
@@ -69,15 +70,18 @@ private void configureDokkatoo(Project project) {
69
70
DokkatooExtension dokkatoo = project .getExtensions ().getByType (DokkatooExtension .class );
70
71
dokkatoo .getDokkatooSourceSets ().named (SourceSet .MAIN_SOURCE_SET_NAME ).configure ((sourceSet ) -> {
71
72
sourceSet .getSourceRoots ().setFrom (project .file ("src/main/kotlin" ));
72
- sourceSet .getClasspath ().from (project .getExtensions ().getByType (SourceSetContainer .class )
73
- .getByName (SourceSet .MAIN_SOURCE_SET_NAME ).getOutput ());
73
+ sourceSet .getClasspath ()
74
+ .from (project .getExtensions ()
75
+ .getByType (SourceSetContainer .class )
76
+ .getByName (SourceSet .MAIN_SOURCE_SET_NAME )
77
+ .getOutput ());
74
78
sourceSet .getExternalDocumentationLinks ().create ("spring-boot-javadoc" , (link ) -> {
75
79
link .getUrl ().set (URI .create ("https://docs.spring.io/spring-boot/api/java/" ));
76
80
link .getPackageListUrl ().set (URI .create ("https://docs.spring.io/spring-boot/api/java/element-list" ));
77
81
});
78
82
sourceSet .getExternalDocumentationLinks ().create ("spring-framework-javadoc" , (link ) -> {
79
83
String url = "https://docs.spring.io/spring-framework/docs/%s/javadoc-api/"
80
- .formatted (project .property ("springFrameworkVersion" ));
84
+ .formatted (project .property ("springFrameworkVersion" ));
81
85
link .getUrl ().set (URI .create (url ));
82
86
link .getPackageListUrl ().set (URI .create (url + "/element-list" ));
83
87
});
0 commit comments