-
Notifications
You must be signed in to change notification settings - Fork 122
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
add support for Dokka 2 #849
Conversation
val tasks = project.tasks.withType(DokkaTask::class.java) | ||
tasks.singleOrNull()?.name ?: "dokkaHtml" | ||
if (tasks.size == 0) { | ||
"dokkaGeneratePublicationHtml" | ||
} else { | ||
tasks.singleOrNull()?.name ?: "dokkaHtml" | ||
} |
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.
With V2Enabled
there will be 0 registered DokkaTask
instances so we can use that as an indicator. When Dokka reached 2.1.0 we can make v2 mode required and simplify all of this to just JavadocJar.Dokka("dokkaGeneratePublicationHtml)
, like the javadoc block above.
// TODO can always return true when dropping support for dokka 1 | ||
return plugins.none { it.id == dokkaPlugin.id } |
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.
Config cache doesn't like the provider.flatMap { tasks.named(it) }
that we're doing right now. So until we're dropping support for Dokka 1 it will stay incompatible.
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.
FYI: Configuration cache is supported ONLY when pluginMode is V2Enabled/V2EnabledWithHelpers
- so in so called DGP v2
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.
👍 I've clarified/updated the comment
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.
Thanks for so fast support for DGPv2!
I've just added some more context in comments :)
// TODO can always return true when dropping support for dokka 1 | ||
return plugins.none { it.id == dokkaPlugin.id } |
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.
FYI: Configuration cache is supported ONLY when pluginMode is V2Enabled/V2EnabledWithHelpers
- so in so called DGP v2
CHANGELOG.md
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
## 0.30.0 **UNRELEASED** | |||
|
|||
- Add support for Dokka 2.0.0-Beta | |||
- Supports `org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled` | |||
- When `pluginMode` is set to `V2EnabledWithHelpers` the old v1 tasks are used |
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.
FYI: in case of V2EnabledWithHelpers
we do only create stub tasks which matches old types - they will fail to generate documentation.
Still, it should not really matter, as V2EnabledWithHelpers
should only be used during migration and should not be committed or used afterwards
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.
Thanks for taking a look at this. I adjusted the v2 detection for the html plugin to be project.extensions.findByName("dokka") != null
. That way we a) don't need this part about the migration and b) it fixes a configuration cache issue on our side. 9ecef5c
https://kotlinlang.org/docs/dokka-migration.html#select-documentation-output-format