1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
package org.jetbrains.dokka.dokkatoo.dokka.plugins
import org.jetbrains.dokka.dokkatoo.internal.DokkatooInternalApi
import org.jetbrains.dokka.dokkatoo.internal.addAll
import org.jetbrains.dokka.dokkatoo.internal.putIfNotNull
import javax.inject.Inject
import kotlinx.serialization.json.buildJsonObject
import kotlinx.serialization.json.putJsonArray
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.api.tasks.PathSensitivity.RELATIVE
/**
* Configuration for Dokka's base HTML format
*
* [More information is available in the Dokka docs.](https://kotlinlang.org/docs/dokka-html.html#configuration)
*/
abstract class DokkaHtmlPluginParameters
@DokkatooInternalApi
@Inject
constructor(
name: String
) : DokkaPluginParametersBaseSpec(
name,
DOKKA_HTML_PLUGIN_FQN,
) {
/**
* List of paths for image assets to be bundled with documentation.
* The image assets can have any file extension.
*
* For more information, see
* [Customizing assets](https://kotlinlang.org/docs/dokka-html.html#customize-assets).
*
* Be aware that files will be copied as-is to a specific directory inside the assembled Dokka
* publication. This means that any relative paths must be written in such a way that they will
* work _after_ the files are moved into the publication.
*
* It's best to try and mirror Dokka's directory structure in the source files, which can help
* IDE inspections.
*/
@get:InputFiles
@get:PathSensitive(RELATIVE)
@get:Optional
abstract val customAssets: ConfigurableFileCollection
/**
* List of paths for `.css` stylesheets to be bundled with documentation and used for rendering.
*
* For more information, see
* [Customizing assets](https://kotlinlang.org/docs/dokka-html.html#customize-assets).
*
* Be aware that files will be copied as-is to a specific directory inside the assembled Dokka
* publication. This means that any relative paths must be written in such a way that they will
* work _after_ the files are moved into the publication.
*
* It's best to try and mirror Dokka's directory structure in the source files, which can help
* IDE inspections.
*/
@get:InputFiles
@get:PathSensitive(RELATIVE)
@get:Optional
abstract val customStyleSheets: ConfigurableFileCollection
/**
* This is a boolean option. If set to `true`, Dokka renders properties/functions and inherited
* properties/inherited functions separately.
*
* This is disabled by default.
*/
@get:Input
@get:Optional
abstract val separateInheritedMembers: Property<Boolean>
/**
* This is a boolean option. If set to `true`, Dokka merges declarations that are not declared as
* [expect/actual](https://kotlinlang.org/docs/multiplatform-connect-to-apis.html), but have the
* same fully qualified name. This can be useful for legacy codebases.
*
* This is disabled by default.
*/
@get:Input
@get:Optional
abstract val mergeImplicitExpectActualDeclarations: Property<Boolean>
/** The text displayed in the footer. */
@get:Input
@get:Optional
abstract val footerMessage: Property<String>
/**
* Path to the directory containing custom HTML templates.
*
* For more information, see [Templates](https://kotlinlang.org/docs/dokka-html.html#templates).
*/
@get:InputDirectory
@get:PathSensitive(RELATIVE)
@get:Optional
abstract val templatesDir: DirectoryProperty
override fun jsonEncode(): String =
buildJsonObject {
putJsonArray("customAssets") {
addAll(customAssets.files)
}
putJsonArray("customStyleSheets") {
addAll(customStyleSheets.files)
}
putIfNotNull("separateInheritedMembers", separateInheritedMembers.orNull)
putIfNotNull(
"mergeImplicitExpectActualDeclarations",
mergeImplicitExpectActualDeclarations.orNull
)
putIfNotNull("footerMessage", footerMessage.orNull)
putIfNotNull("footerMessage", footerMessage.orNull)
putIfNotNull(
"templatesDir",
templatesDir.orNull?.asFile?.canonicalFile?.invariantSeparatorsPath
)
}.toString()
companion object {
const val DOKKA_HTML_PARAMETERS_NAME = "html"
const val DOKKA_HTML_PLUGIN_FQN = "org.jetbrains.dokka.base.DokkaBase"
}
}
|