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

Support Gradle Configuration cache #2231

Closed
TWiStErRob opened this issue Nov 17, 2021 · 8 comments · May be fixed by #2499
Closed

Support Gradle Configuration cache #2231

TWiStErRob opened this issue Nov 17, 2021 · 8 comments · May be fixed by #2499
Labels
enhancement An issue for a feature or an overall improvement runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin

Comments

@TWiStErRob
Copy link
Contributor

Configuration cache is a new feature in Gradle that speeds up running repetitive tasks (during daily development) by storing the task graph on disk and loading it back. This requires certain actions from plugin authors to be compatible. For example not using specific types.

Describe the solution you'd like
With dokka, the problem is

- Task `:checkstyle:dokkaJavadoc` of type `org.jetbrains.dokka.gradle.DokkaTask`: cannot serialize object of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfiguration', a subtype of 'org.gradle.api.artifacts.Configuration', as these are not supported with the configuration cache.
  See https://docs.gradle.org/7.3/userguide/configuration_cache.html#config_cache:requirements:disallowed_types

The solution to this is a bit of refactoring the task to use cacheable types.
The first example in the docs might help.

Describe alternatives you've considered
@3flex tried #1800, but that probably needs more work.
Right now if developers / CI ever wants to execute Dokka, they have to disable configuration caching, e.g. with --no-configuration-cache.

Additional context
Repro:

  • Project with dokka configured on it
  • Run dokka with --configuration-cache on gradlew command line

Are you willing to provide a PR?
I don't have enough experience with this yet.

@TWiStErRob TWiStErRob added the enhancement An issue for a feature or an overall improvement label Nov 17, 2021
@3flex
Copy link
Contributor

3flex commented Jan 18, 2022

Is this a duplicate of #1217?

@TWiStErRob
Copy link
Contributor Author

Looks like it, except the "consider" part ☺️.

@bric3
Copy link

bric3 commented Sep 15, 2023

For reference, here's what I had in Gradle 8.3, dokka 1.9.0

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache problems found in this build.

3 problems were found storing the configuration cache, 2 of which seem unique.
- Task `:components:dokkaHtml` of type `org.jetbrains.dokka.gradle.DokkaTask`: cannot serialize object of type 'org.gradle.api.internal.artifacts.configurations.DefaultConfiguration', a subtype of 'org.gradle.api.artifacts.Configuration', as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:components:dokkaHtml` of type `org.jetbrains.dokka.gradle.DokkaTask`: invocation of 'Task.project' at execution time is unsupported.
  See https://docs.gradle.org/8.3/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution

See the complete report at file:///Users/brice.dutheil/opensource/intellij-platform-swing-components/build/reports/configuration-cache/oc9jqhodauovc9773iurqvxf/9fa5s0orualeswvhyudajg6d8/configuration-cache-report.html
> Invocation of 'Task.project' by task ':components:dokkaHtml' at execution time is unsupported.

As a workaround one can do the following :

  tasks
+   withType<DokkaTask>().configureEach {
+       notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
+   }
  }

configuration-cache-report.html.zip

bric3 added a commit to bric3/intellij-platform-swing-components that referenced this issue Sep 15, 2023
@SimonMarquis
Copy link
Contributor

This workaround won't be necessary on the next version as it will be automatically flagged as not compatible with CC (until it is fully supported):

@CharlieTap
Copy link

Is this not included in the latest release? I still get the error and have to use the workaround:

tasks.withType<DokkaTask>().configureEach {
    notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
}

My config is essentially:

val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)

val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
    dependsOn(dokkaHtml)
    archiveClassifier.set("javadoc")
    from(dokkaHtml.outputDirectory)
}

@deivyrene
Copy link

Is this not included in the latest release? I still get the error and have to use the workaround:

tasks.withType<DokkaTask>().configureEach {
    notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231")
}

My config is essentially:

val dokkaHtml by tasks.getting(org.jetbrains.dokka.gradle.DokkaTask::class)

val javadocJar: TaskProvider<Jar> by tasks.registering(Jar::class) {
    dependsOn(dokkaHtml)
    archiveClassifier.set("javadoc")
    from(dokkaHtml.outputDirectory)
}

@CharlieTap Maybe ./gradlew --no-configuration-cache in command line?

@adam-enko
Copy link
Member

adam-enko commented Aug 28, 2024

Hi all, thanks for the feedback. Supporting Configuration Cache (and all other upcoming Gradle features) is important, so Dokka Gradle Plugin will support it in Dokka's 2.0 release.

We'll use #1217 to keep track of the request for CC support (simply because since it was made first).

@adam-enko adam-enko closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
@adam-enko
Copy link
Member

Duplicate of #1217

@adam-enko adam-enko marked this as a duplicate of #1217 Aug 28, 2024
@adam-enko adam-enko closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 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

Successfully merging a pull request may close this issue.

8 participants