Kotlin / dokka

API documentation engine for Kotlin
https://kotl.in/dokka
Apache License 2.0
3.42k stars 406 forks source link

Improve compatibility with the Gradle API, and follow best practices #2700

Open aSemy opened 1 year ago

aSemy commented 1 year ago

Is your feature request related to a problem? Please describe

Hi, this is related to the Dokka Gradle plugin, which I would like to help improve.

Improving usage of Gradle would help with the following issues:

These PRs are related:

Describe the solution you'd like

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered

Additional context

Perhaps the dokka team could create a 'gradle-plugin' tag for all relevant GitHub issues? https://github.com/Kotlin/dokka/issues?q=is%3Aissue+is%3Aopen++gradle

Are you willing to provide a PR?

Yes. I will try and split this up into smaller PRs.

IgnatBeresnev commented 1 year ago

Wow... thanks! Our Gradle plugin and everything around it definitely needs work. I'll take us some time to go through PRs, so please bear with us :sweat_smile:

aSemy commented 1 year ago

So I've submitted a few PRs and they make some progress towards improving the plugin, but actually started re-implementing the plugin mostly to get my head around it, but also I think it would be nice to have a fresh start. I see there's code in the plugin from 2015, and Gradle has changed a lot since then.

Here's what I've got so far:

I'm not sure how much impact this will have. Perhaps it's possible to 'backport' it to the current plugin, or maybe it needs a clean break. It's still a work-in-progress. I can make a PR if you want to have a very early look?

Goooler commented 1 year ago

2652 would be a part of this?

Goooler commented 1 year ago

And CC is WIP in #2499.

aSemy commented 1 year ago

2652 would be a part of this?

2652 is about improving the Gradle build scripts for the Dokka project, not the Dokka Gradle plugin. They both use Gradle, but they are independent from one another.

And CC is WIP in #2499.

Oh good catch, I missed that PR. That PR is indeed related, and should help.

IgnatBeresnev commented 1 year ago

Hi! Sorry it's taking so long, I've only now finally got time after re-writing documentation for stable release.

I'll go over all Gradle PRs in the upcoming weeks :+1:

IgnatBeresnev commented 1 year ago

If you don't mind, I'll use this issue as an umbrella issue to cover all Gradle-related PRs from you and @Goooler. I'll include "infrastructure" tagged issues in my comment as well as they're about following Gradle's best practices and there aren't that many of them.

Below I'll write down the order in which the PRs should be reviewed and merged, feel free to correct me.

First wave

Can be reviewed now, but merged after we branch off for 1.8.10: :heavy_check_mark: ~ #2833~ :heavy_check_mark: ~ #2707~ :heavy_check_mark: ~ #2705~ :heavy_check_mark: ~ (infra) #2704~

:heavy_check_mark: ~Blocked by #2841 (ETA: right after 1.8.10):~ :heavy_check_mark: ~* (approved) #2702~

:heavy_check_mark: ~Blocked by #2704 (ETA: right after 1.8.10)~ :heavy_check_mark: ~* (infra) #2912~

:heavy_check_mark: ~Blocked by #2912~ :heavy_check_mark: ~* (infra) #2884~

Second wave

Third wave:

To be discussed further / postponed:

aajtodd commented 1 year ago

What's the status of this? It looks like a lot of great improvements that we would like to see/use (gradle worker API, better cache support, fix inter project task dependency relationships, etc).

The AWS SDK for Kotlin is an abnormally large project (300+ modules). It takes several hours to build everything and we are weighing our options on how to get this time down (including possibly investigating moving to https://github.com/adamko-dev/dokkatoo).

There are also some issues with upgrading to Gradle 8.2+ w/Dokka 1.8+ that we are wondering might be fixed by some of these changes.

e.g.

    Reason: Task ':services:dokkaHtmlMultiModule' uses this output of task ':dokkaHtmlMultiModule' without declaring an explicit or implicit dependency. This can lead
 to incorrect results being produced, depending on what order the tasks are executed.  
IgnatBeresnev commented 1 year ago

@aajtodd I definitely agree, and we honestly can't wait ourselves to address Gradle problems, but our resources have been spread thin, and there have been multiple things falling apart at the same time (K2/analysis-related), so we couldn't focus on Gradle much.

Rest assured, we understand that our Gradle plugin is a severe problem for Dokka's users, and it is very high on our list. We should hopefully get to it quite soon - likely within the next month.

In the meantime, if migrating to github.com/adamko-dev/dokkatoo resolves your problems - please, do use it :) Adam did an amazing job, and we plan to merge dokkatoo into Dokka, making it Dokka's new Gradle plugin - albeit, with some configuration DSL changes, so expect some migration work up ahead. It would also help us with finding bugs early, so you'd be helping us with testing.

P.S., Dokka 1.9.0 should work with aws-sdk-kotlin, we've somewhat "fixed" the single-target multiplatform support (with your help in debugging), and I'm still trying to get to providing more details on this in #2679 - will try hard to do it this friday or next week.