-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Dokka instead of Javadoc #337
Changes from all commits
a3e04a8
3c509c2
ce681b8
c0269dd
7d86d81
32f40f2
8c61461
0c61e95
b864bfb
b200bc9
a404879
53cd466
94885eb
2c689fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2022, TeamDev. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import io.spine.internal.dependency.Dokka | ||
import java.time.LocalDate | ||
import org.jetbrains.dokka.base.DokkaBase | ||
import org.jetbrains.dokka.base.DokkaBaseConfiguration | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
|
||
plugins { | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
/** | ||
* To generate the documentation as seen from Java perspective, | ||
* the kotlin-as-java plugin was added to the Dokka plugins classpath. | ||
* | ||
* @see <a href="https://github.com/Kotlin/dokka#output-formats"> | ||
* Dokka output formats</a> | ||
*/ | ||
dependencies { | ||
dokkaPlugin(Dokka.KotlinAsJava.lib) | ||
} | ||
|
||
tasks.withType<DokkaTask>().configureEach { | ||
outputDirectory.set(buildDir.resolve("docs/dokka")) | ||
|
||
/** | ||
* In order to modify the styles Dokka uses for the generated documentation we provide | ||
* a configuration to the Dokka Base Plugin. | ||
* | ||
* @see <a href="https://kotlin.github.io/dokka/1.6.10/user_guide/base-specific/frontend/#prerequisites"> | ||
* Dokka modifying frontend assets</a> | ||
*/ | ||
val dokkaConfDir = rootDir.resolve("buildSrc/src/main/kotlin/io/spine/internal/gradle/dokka") | ||
|
||
/** | ||
* Dokka Base configuration provides `customStyleSheets` property to which we can | ||
* pass our css files overriding styles generated by Dokka. | ||
* | ||
* Also, there is a `customAssets` property to provide resources. We need to | ||
* provide an image with the name "logo-icon.svg" to overwrite the default one used by Dokka. | ||
*/ | ||
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> { | ||
customStyleSheets = listOf(file("${dokkaConfDir.resolve("styles/custom-styles.css")}")) | ||
customAssets = listOf(file("${dokkaConfDir.resolve("assets/logo-icon.svg")}")) | ||
footerMessage = "Copyright ${LocalDate.now().year}, TeamDev" | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2022, TeamDev. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package io.spine.internal.gradle.dokka | ||
|
||
import org.gradle.kotlin.dsl.provideDelegate | ||
import org.jetbrains.dokka.base.DokkaBase | ||
import org.jetbrains.dokka.plugability.DokkaPlugin | ||
|
||
/** | ||
* Dokka has several extensions points at different stages of generating documentation. | ||
* The plugin below is injected at stage when the source code of a project is already collected and | ||
* translated to Dokka internal representation Documentable. | ||
* | ||
* @see <a href="https://kotlin.github.io/dokka/1.6.10/developer_guide/extension_points/#pre-merge-documentation-transform"> | ||
* Dokka "Pr-merge documentation transform" extension point</a> | ||
*/ | ||
class ExcludeInternalPlugin : DokkaPlugin() { | ||
private val dokkaBase by lazy { plugin<DokkaBase>() } | ||
|
||
val excludeInternalTransformer by extending { | ||
dokkaBase.preMergeDocumentableTransformer providing ::ExcludeInternalTransformer | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2022, TeamDev. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
package io.spine.internal.gradle.dokka | ||
|
||
import org.jetbrains.dokka.base.transformers.documentables.SuppressedByConditionDocumentableFilterTransformer | ||
import org.jetbrains.dokka.model.Documentable | ||
import org.jetbrains.dokka.model.dfs | ||
import org.jetbrains.dokka.model.doc.CustomTagWrapper | ||
import org.jetbrains.dokka.plugability.DokkaContext | ||
|
||
/** | ||
* @see <a href="https://github.com/Kotlin/dokka/issues/2404"> | ||
* Can classes or methods be dropped from documentation based on annotation</a> | ||
*/ | ||
class ExcludeInternalTransformer(val dokkaContext: DokkaContext) : | ||
SuppressedByConditionDocumentableFilterTransformer(dokkaContext) { | ||
override fun shouldBeSuppressed(d: Documentable): Boolean { | ||
return d.documentation.any { (_, docs) -> | ||
docs.dfs { | ||
it is CustomTagWrapper && it.name.trim() == "Internal" | ||
} != null | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2022, TeamDev. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Redistribution and use in source and/or binary forms, with or without | ||
* modification, must retain the above copyright notice and the following | ||
* disclaimer. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
:root, | ||
:root.theme-dark { | ||
--color-dark: #007bff; | ||
} | ||
|
||
.library-name a::before { | ||
background-image: url('https://spine.io/img/spine-sign-white.svg') | ||
} | ||
|
||
.cover a, | ||
.main-subrow.keyValue a { | ||
font-family: monospace; | ||
} | ||
|
||
:root.theme-dark dt { | ||
color: #fff; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,5 +35,6 @@ package io.spine.internal.gradle.publish | |
internal enum class ArtifactTaskName { | ||
sourceJar, | ||
testOutputJar, | ||
javadocJar; | ||
javadocJar, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another thing here is that today we are going to have one more PR merged to Once that request is merged, I'd like you to perform a back-merge from the |
||
dokkaJar; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.spine.internal.gradle.dokka.ExcludeInternalPlugin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have an empty line above
@see
.