Skip to content
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

Dokka 2+: Creating a custom format requires access to an internal configuration #3925

Open
CLOVIS-AI opened this issue Nov 15, 2024 · 6 comments
Labels
enhancement An issue for a feature or an overall improvement runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin

Comments

@CLOVIS-AI
Copy link
Contributor

Is your feature request related to a problem? Please describe

I am creating a custom Dokka output format. More specifically, I'm embedding Dokka into an MkDocs website.

Since I created a custom format, Dokka generates a task that creates all the files. But I need them to be in a specific directory. I want to recursively access all generated files.

At the moment, the best way to do so seems to be to declare a dependency on the configuration dokkaMkdocsModuleOutputDirectoriesResolver~internal, which I do here and is used in the Sync task declared just below.

Describe the solution you'd like

A way to access all the files that were outputted by my custom format, across any project registered in the current project through dependencies { dokka(…) }.

Describe alternatives you've considered

I don't know what's possible here.

@CLOVIS-AI CLOVIS-AI added the enhancement An issue for a feature or an overall improvement label Nov 15, 2024
@adam-enko
Copy link
Member

Hi, thanks for the request.

I see the difficulty, and while I don't have the time right now to have a thorough look, I have a suggestion: Could you try accessing the files from the DokkaFormatPluginContext instead?

abstract class DokkaMkDocsPlugin : DokkaFormatPlugin(formatName = "mkdocs") {

    @OptIn(DokkaInternalApi::class)
    override fun DokkaFormatPluginContext.configure() {
        val moduleOutputFiles = formatDependencies.moduleOutputDirectories.incomingArtifactFiles

        // ...
    }

    // ...
}

@adam-enko adam-enko added the runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin label Nov 19, 2024
@CLOVIS-AI
Copy link
Contributor Author

DokkaFormatPlugin doesn't seem to have a configure method that I can override? I'm a bit confused

@adam-enko
Copy link
Member

DokkaFormatPlugin doesn't seem to have a configure method that I can override? I'm a bit confused

Hmm strange, it should be there, both in Dokka and Dokkatoo

Could you share more info? Do you get an error message?

@CLOVIS-AI
Copy link
Contributor Author

Weird. Just IDEA that says there is no method to override. I tried to copy-paste your snippet in this file, I don't know where else it could be?

@adam-enko
Copy link
Member

I see the method is already overridden https://gitlab.com/opensavvy/automation/dokka-material-mkdocs/-/blob/main/dokka-mkdocs/src/main/kotlin/DokkaMkDocsPlugin.kt?ref_type=heads#L118-123, so I guess it's a very unhelpful error message from IJ?

@CLOVIS-AI
Copy link
Contributor Author

uh, I'm dumb. Thanks, I'll try it again then :|

CLOVIS-AI added a commit to CLOVIS-AI/Dokka-MkDocs that referenced this issue Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue for a feature or an overall improvement runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

No branches or pull requests

2 participants