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

Add debug utility for manually overriding the Dokka configuration JSON #3915

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

adam-enko
Copy link
Member

@adam-enko adam-enko commented Nov 12, 2024

Being able to make minor manual modifications to the Dokka configuration is exceptionally useful for local debugging.

This should not be used in production, and it is protected by an opt-in API.

@adam-enko adam-enko self-assigned this Nov 12, 2024
@adam-enko adam-enko added the runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin label Nov 12, 2024
@adam-enko adam-enko modified the milestone: Dokka 2.0.0 Nov 12, 2024
@adam-enko adam-enko force-pushed the adam/feat/dgp-manual-json-config-override branch from 35f775e to 608811d Compare November 12, 2024 16:45
@adam-enko adam-enko marked this pull request as ready for review November 12, 2024 16:46
@adam-enko adam-enko changed the title DGP manual JSON config override Add debug utility for manually overriding the Dokka configuration JSON Nov 12, 2024
Being able to make minor manual modifications to the Dokka configuration is exceptionally useful for local debugging.

This should not be used in production, and it is protected by an opt-in API.
@adam-enko adam-enko force-pushed the adam/feat/dgp-manual-json-config-override branch from 608811d to 3d75dae Compare November 12, 2024 16:50
Copy link
Collaborator

@whyoleg whyoleg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against to having this, though I don't fully understand, how it could help during local debugging. Could you explain it a bit?

@adam-enko
Copy link
Member Author

I'm not against to having this, though I don't fully understand, how it could help during local debugging. Could you explain it a bit?

For example, @antohaby and I looked at improving KMP handling. It was convenient to be able to manually modify the Dokka configuration rather than trying to modify the Gradle config that DGP uses to produce the Dokka config.

For example, we could manually add/remove files from the dependencies that Dokka Generator analyses, or change the order of the files. Changing the order of the files would be quite difficult to do by modifying the Gradle build config.

So, instead we added this util. So we could run :dokkaGenerate, take the dokka-config.json, and quickly modify it to experiment with different configuration. Once we found some configuration that worked, we could focus on making DGP produce the correct config.

@adam-enko adam-enko requested a review from antohaby November 18, 2024 13:43
val dokkaConfiguration =
if (overrideJsonConfig.isPresent) {
logger.warn("w: [$path] Overriding DokkaConfiguration with manualJsonConfig")
DokkaConfigurationImpl(overrideJsonConfig.get())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's manualJsonConfig ? I don't see it anywhere. Perhaps you meant overrideJsonConfig :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

@antohaby
Copy link
Contributor

I'm afraid it can be abused in the future. But on the other hand why not? someone can also apply patches to the json files when necessary.

@adam-enko adam-enko merged commit 12e5635 into master Nov 18, 2024
8 of 11 checks passed
@adam-enko adam-enko deleted the adam/feat/dgp-manual-json-config-override branch November 18, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants