@@ -40,6 +40,8 @@ import org.gradle.kotlin.dsl.DependencyHandlerScope
40
40
import org.jetbrains.dokka.DokkaConfiguration
41
41
import org.jetbrains.dokka.base.DokkaBase
42
42
import org.jetbrains.dokka.base.DokkaBaseConfiguration
43
+ import org.jetbrains.dokka.gradle.AbstractDokkaLeafTask
44
+ import org.jetbrains.dokka.gradle.AbstractDokkaTask
43
45
import org.jetbrains.dokka.gradle.DokkaTask
44
46
import org.jetbrains.dokka.gradle.GradleDokkaSourceSetBuilder
45
47
@@ -56,7 +58,7 @@ fun DependencyHandlerScope.useDokkaForKotlinAsJava() {
56
58
57
59
/* *
58
60
* To exclude pieces of code annotated with `@Internal` from the documentation
59
- * a custom plugin is added to the Dokka's classpath.
61
+ * a custom plugin is added to the Dokka classpath.
60
62
*
61
63
* @see <a href="https://github.com/SpineEventEngine/dokka-tools/tree/master/dokka-extensions">
62
64
* Custom Dokka Plugins</a>
@@ -71,12 +73,35 @@ private fun DependencyHandler.dokkaPlugin(dependencyNotation: Any): Dependency?
71
73
private fun Project.dokkaOutput (language : String ): File =
72
74
buildDir.resolve(" docs/dokka${language.capitalized()} " )
73
75
74
- private fun Project.dokkaConfigFile (file : String ): File {
76
+ fun Project.dokkaConfigFile (file : String ): File {
75
77
val dokkaConfDir = project.rootDir.resolve(" buildSrc/src/main/resources/dokka" )
76
78
return dokkaConfDir.resolve(file)
77
79
}
78
80
79
- private fun DokkaTask.configureFor (language : String ) {
81
+ /* *
82
+ * Configures the presentation style, logo, and footer message.
83
+ *
84
+ * Dokka Base plugin allows setting a few properties to customize the output:
85
+ * - `customStyleSheets` property to which CSS files are passed overriding
86
+ * styles generated by Dokka;
87
+ * - `customAssets` property to provide resources. The image with the name
88
+ * "logo-icon.svg" is passed to override the default logo used by Dokka;
89
+ * - `separateInheritedMembers` when set to `true`, creates a separate tab in
90
+ * type-documentation for inherited members.
91
+ *
92
+ * @see <a href="https://kotlin.github.io/dokka/1.8.10/user_guide/base-specific/frontend/#prerequisites">
93
+ * Dokka modifying frontend assets</a>
94
+ */
95
+ fun AbstractDokkaTask.configureStyle () {
96
+ pluginConfiguration<DokkaBase , DokkaBaseConfiguration > {
97
+ customStyleSheets = listOf (project.dokkaConfigFile(" styles/custom-styles.css" ))
98
+ customAssets = listOf (project.dokkaConfigFile(" assets/logo-icon.svg" ))
99
+ separateInheritedMembers = true
100
+ footerMessage = " Copyright ${LocalDate .now().year} , TeamDev"
101
+ }
102
+ }
103
+
104
+ private fun AbstractDokkaLeafTask.configureFor (language : String ) {
80
105
dokkaSourceSets.configureEach {
81
106
/* *
82
107
* Configures links to the external Java documentation.
@@ -85,6 +110,8 @@ private fun DokkaTask.configureFor(language: String) {
85
110
86
111
skipEmptyPackages.set(true )
87
112
113
+ includeNonPublic.set(true )
114
+
88
115
documentedVisibilities.set(
89
116
setOf (
90
117
DokkaConfiguration .Visibility .PUBLIC ,
@@ -95,38 +122,20 @@ private fun DokkaTask.configureFor(language: String) {
95
122
96
123
outputDirectory.set(project.dokkaOutput(language))
97
124
98
- /* *
99
- * Dokka Base plugin allows to set a few properties to customize the output:
100
- *
101
- * - `customStyleSheets` property to which CSS files are passed overriding
102
- * styles generated by Dokka;
103
- * - `customAssets` property to provide resources. The image with the name
104
- * "logo-icon.svg" is passed to override the default logo used by Dokka;
105
- * - `separateInheritedMembers` when set to `true`, creates a separate tab in
106
- * type-documentation for inherited members.
107
- *
108
- * @see <a href="https://kotlin.github.io/dokka/1.8.10/user_guide/base-specific/frontend/#prerequisites">
109
- * Dokka modifying frontend assets</a>
110
- */
111
- pluginConfiguration<DokkaBase , DokkaBaseConfiguration > {
112
- customStyleSheets = listOf (project.dokkaConfigFile(" styles/custom-styles.css" ))
113
- customAssets = listOf (project.dokkaConfigFile(" assets/logo-icon.svg" ))
114
- separateInheritedMembers = true
115
- footerMessage = " Copyright ${LocalDate .now().year} , TeamDev"
116
- }
125
+ configureStyle()
117
126
}
118
127
119
128
/* *
120
129
* Configures this [DokkaTask] to accept only Kotlin files.
121
130
*/
122
- fun DokkaTask .configureForKotlin () {
131
+ fun AbstractDokkaLeafTask .configureForKotlin () {
123
132
configureFor(" kotlin" )
124
133
}
125
134
126
135
/* *
127
136
* Configures this [DokkaTask] to accept only Java files.
128
137
*/
129
- fun DokkaTask .configureForJava () {
138
+ fun AbstractDokkaLeafTask .configureForJava () {
130
139
configureFor(" java" )
131
140
}
132
141
0 commit comments