Skip to content

docs(plugin-client): use tasks.registering instead of deprecated tasks.creating#2177

Merged
samuelAndalon merged 1 commit into
ExpediaGroup:masterfrom
gaurav0107:fix/2077-examples-in-documentation-uses-deprecate
Jun 16, 2026
Merged

docs(plugin-client): use tasks.registering instead of deprecated tasks.creating#2177
samuelAndalon merged 1 commit into
ExpediaGroup:masterfrom
gaurav0107:fix/2077-examples-in-documentation-uses-deprecate

Conversation

@gaurav0107

Copy link
Copy Markdown
Contributor

Description

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 (lines 611 and 614 of website/docs/plugins/gradle-plugin-usage-client.mdx), so readers who copy the snippet into their own build.gradle.kts get a deprecation warning from modern Gradle.

This change:

  • switches the two val NAME by tasks.creating(...) declarations to tasks.registering(...), which preserves the property-delegate idiom familiar to Kotlin DSL readers but produces a TaskProvider<T> so the task is configured lazily, and
  • updates the inter-task wiring schemaFile.set(graphqlDownloadOtherSDL.outputFile) to schemaFile.set(graphqlDownloadOtherSDL.flatMap { it.outputFile }), since the property delegate now resolves to a TaskProvider rather than the realized task. Using flatMap keeps 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 under website/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

…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 samuelAndalon merged commit e8875eb into ExpediaGroup:master Jun 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Examples in documentation uses deprecated Gradle function

2 participants