-
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 8 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,83 @@ | ||
/* | ||
* 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 org.gradle.kotlin.dsl.dependencies | ||
import org.gradle.kotlin.dsl.withType | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
import io.spine.internal.dependency.Dokka | ||
import java.time.LocalDate | ||
|
||
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("org.jetbrains.dokka:kotlin-as-java-plugin:${Dokka.GradlePlugin.version}") | ||
} | ||
|
||
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 dokkaBaseRef = "org.jetbrains.dokka.base.DokkaBase" | ||
val dokkaConfDir = rootDir.resolve("buildSrc/src/main/kotlin/io/spine/internal/gradle/dokka") | ||
|
||
/** | ||
* Dokka Base configuration provides <code>customStyleSheets</code> property to which we can | ||
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. This is Kotlin, so instead of
|
||
* pass our css files overriding styles generated by Dokka. | ||
* Also, there is a <code>customAssets</code> property to provide resources. We need to | ||
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. Please allow an empty line between the paragraphs. |
||
* provide an image with the name "logo-icon.svg" to overwrite the default one used by Dokka. | ||
*/ | ||
val dokkaConf = """ | ||
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. One thing missing from the configuration is as follows. In the Javadoc artifact we have at the moment, the types annotated as You should be able to tell it from your own experience by comparing the test output of Dokka for the In the build-time codebase, it is performed via the special configuration of Javadoc doclet which excludes all With Dokka, an approach to achieve the same result seems to be different — as I can tell by reading the Dokka's manual. We should be able to exclude the types by tweaking the Dokka's configuration. |
||
{ | ||
"customStyleSheets": [ | ||
"${dokkaConfDir.resolve("styles/custom-styles.css")}" | ||
], | ||
"customAssets": [ | ||
"${dokkaConfDir.resolve("assets/logo-icon.svg")}" | ||
], | ||
"footerMessage": "Copyright ${LocalDate.now().year}, TeamDev" | ||
} | ||
""".trimIndent() | ||
|
||
pluginsMapConfiguration.set( | ||
mapOf( | ||
dokkaBaseRef to dokkaConf | ||
) | ||
) | ||
} |
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; | ||
} |
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
.