docs(plugin-client): use tasks.registering instead of deprecated tasks.creating#2177
Merged
samuelAndalon merged 1 commit intoJun 16, 2026
Conversation
…s.creating
Gradle has deprecated the eager `tasks.creating(...)` configuration in
favour of the lazy `tasks.registering(...)` task configuration avoidance
API. The Kotlin DSL example in the *Generating Multiple Clients* section
of the gradle client plugin docs still demonstrates the eager form, which
emits a deprecation warning when readers copy the snippet into their own
build script.
Switch the two task declarations to `tasks.registering` and update the
inter-task wiring to use `flatMap { it.outputFile }` so the producer
task remains lazily realized.
Fixes ExpediaGroup#2077
samuelAndalon
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Gradle has deprecated the eager
tasks.creating(...)configuration in favour of the lazytasks.registering(...)task configuration avoidance API. The Kotlin DSL example in the Generating Multiple Clients section of the gradle client plugin docs still demonstrates the eager form (lines 611 and 614 ofwebsite/docs/plugins/gradle-plugin-usage-client.mdx), so readers who copy the snippet into their ownbuild.gradle.ktsget a deprecation warning from modern Gradle.This change:
val NAME by tasks.creating(...)declarations totasks.registering(...), which preserves the property-delegate idiom familiar to Kotlin DSL readers but produces aTaskProvider<T>so the task is configured lazily, andschemaFile.set(graphqlDownloadOtherSDL.outputFile)toschemaFile.set(graphqlDownloadOtherSDL.flatMap { it.outputFile }), since the property delegate now resolves to aTaskProviderrather than the realized task. UsingflatMapkeeps the upstream task lazy.The
dependsOn("graphqlDownloadOtherSDL")line is unchanged because Gradle resolves the task name string regardless of whether the producing task is realized eagerly or lazily.Only the live docs path (
website/docs/...) is touched. The historical Docusaurus snapshots underwebsite/versioned_docs/version-*are intentionally left alone — those are immutable per-release archives and should reflect what was published at the time.Related Issues
Fixes #2077