dokka icon indicating copy to clipboard operation
dokka copied to clipboard

Gradle Plugin: Expose `finalizeCoroutines` as Gradle task option

Open aSemy opened this issue 3 years ago • 1 comments

  • Allows the finalizeCoroutines option to be configurable from Gradle tasks
  • fixes flakey tests in the Kotlinx Serialization and Kotlin Coroutines integration tests

This PR was triggered by an issue in https://github.com/Kotlin/dokka/pull/2740#issuecomment-1329499420. Kotlinx Serialization and Kotlinx Coroutines requires finalizeCoroutines to be disabled, else Dokka generation fails

Example error: https://github.com/Kotlin/dokka/actions/runs/3567615789/jobs/5995523064#step:4:4032

 Caused by: java.util.concurrent.RejectedExecutionException: DefaultDispatcher was terminated

Currently the Kotlinx Serialization and Kotlin Coroutines integration tests are flakey because of this error.

But with this PR, the option can be configured:

tasks.withType<AbstractDokkaTask>().configureEach {
    finalizeCoroutines.set(false)
}

I've fixed the flakey tests by setting finalizeCoroutines to false with a Gradle init script.

Since I would like to see more idiomatic Gradle config #2700, the new code in this PR follows the Gradle API more closely than pre-existing code (for example, using abstract val for properties, and setting the default value using convention(), so getSafe() is not necessary).

This PR includes

  • https://github.com/Kotlin/dokka/pull/2702

aSemy avatar Nov 28 '22 20:11 aSemy

An update on this: if we do start using Gradle workers from #2740, it looks like this configuration option won't be needed at all for the Gradle plugin users, can just set it to false by default.

Disabling it for coroutines and serialization does make the tests pass, but if you try to run Dokka with gradle workers on any other project - I think it'll also fail until you turn set finalizeCoroutines to false as well.

Let's wait until we get to #2740 though and decide and test it there

Note: it might still be relevant for the CLI runner, also needs to be tested. But it looks like it should be set to false by default if Gradle workers are used.

IgnatBeresnev avatar Jan 29 '23 13:01 IgnatBeresnev

This PR is no longer necessary. finalizeCoroutines is exposed as an option in DGPv2.

adam-enko avatar Jun 12 '25 09:06 adam-enko