-
Notifications
You must be signed in to change notification settings - Fork 410
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
[Bug] Cannot Configure Custom Dokka Plugin #3869
Comments
- Register binding for `DokkaPluginParametersBuilder` - Remove @internal annotation on `jsonEncode()` for `DokkaPluginParametersBuilder` - Annotate the getter for `DokkaPluginParametersBuilder.objects` (the annotation only works for getters) - Add missing functions for adding files, directories, and maps, which were implied but not present for `DokkaPluginParametersBuilder` - remove overriden `DokkaPluginParametersBuilder.pluginFqn` property as it just caused issues - Add documentation for configuring custom plugins in dokka-migration.md Signed-off-by: solonovamax <[email protected]>
Hi, thank you very much for the report and investigation. For some context, the I've looked into Alternative approachFor now you will have to avoid // build.gradle.kts
plugins {
id("org.jetbrains.dokka") version "2.0.0-Beta"
}
val dokkaScripts = layout.projectDirectory.dir("dokka-scripts")
dokka {
pluginsConfiguration {
registerBinding(DokkaScriptsPluginParameters::class, DokkaScriptsPluginParameters::class)
register<DokkaScriptsPluginParameters>("DokkaScripts") {
scripts.from(dokkaScripts.asFileTree)
}
}
}
@OptIn(DokkaInternalApi::class)
abstract class DokkaScriptsPluginParameters @Inject constructor(
name: String
) : DokkaPluginParametersBaseSpec(name, "ca.solostudios.dokkascript.plugin.DokkaScriptsPlugin") {
@get:InputFiles
@get:PathSensitive(PathSensitivity.RELATIVE)
@get:NormalizeLineEndings
abstract val scripts: ConfigurableFileCollection
override fun jsonEncode(): String {
val encodedScriptFiles = scripts.files.joinToString { "\"${it.canonicalFile.invariantSeparatorsPath}\"" }
return """
{
"scripts": [ $encodedScriptFiles ]
}
""".trimIndent()
}
} If you find you need to re-use Presently Tasks
|
I mentioned this in the slack, however this does not work and gradle will error with this. this is because it wants the class to be a static class, and for whatever reason if a class is declared in a buildscript, it is a non-static inner class I also don't particularly want to introduce a |
this is the specific issue, btw:
this is happening specifically because of the use of an |
Thanks for sharing the specific error. It looks like that's a Gradle error gradle/gradle#25494, caused by referencing something from the buildscript inside of the class. I'm working on a demonstration project here to show how to configure a custom If something still isn't working, please share an example (or link to an open source project) and I can take a look. |
Describe the Bug
It is currently impossible to configure custom dokka plugins.
Expected Behaviour
It should be possible to, and documented how to, configure custom dokka plugins.
Actual Behaviour
When attempting to configure custom dokka plugins with the (entirely undocumented)
DokkaPluginParametersBuilder
class andpluginParameters
function, eg.then the following error is produced:
If
DokkaPluginParametersBuilder
then has a factory registered usingthen, gradle will properly load, however gradle will not allow the
dokkaGenerate
task to run, and instead produces the following error:Environment
The text was updated successfully, but these errors were encountered: