Skip to content

Improves spotlessPredeclare#2925

Open
bric3 wants to merge 3 commits into
diffplug:mainfrom
bric3:spotless-predeclare
Open

Improves spotlessPredeclare#2925
bric3 wants to merge 3 commits into
diffplug:mainfrom
bric3:spotless-predeclare

Conversation

@bric3
Copy link
Copy Markdown
Contributor

@bric3 bric3 commented May 12, 2026

This PR introduces two changes

  • Make spotlessPredeclare visible to Gradle Kotlin DSL type-safe accessors.
  • Allow spotlessPredeclare to be used directly without enabling it first in spotless extension.

Now the spotlessPredeclare can be used on the root project directly

spotlessPredeclare {
  java { ... }
}
spotlessPredeclare {
  fromBuildscriptRepositories()
  java { ... }
}
before one had to write respectively

import com.diffplug.gradle.spotless.SpotlessExtension

spotless {
  predeclareDeps()
}

with(extensions["spotlessPredeclare"] as SpotlessExtension) {
  java { ... }
}
import com.diffplug.gradle.spotless.SpotlessExtension

spotless {
  predeclareDepsFromBuildscript()
}

with(extensions["spotlessPredeclare"] as SpotlessExtension) {
  java { ... }
}
Note I intentionally, kept the old API to be backward compatible.

Also fixes #2580

bric3 added 3 commits May 12, 2026 16:08
This avoids the necessity to declare it in the spotless extension.
The old style API are kept for backward compat.
@bric3
Copy link
Copy Markdown
Contributor Author

bric3 commented May 12, 2026

Two jobs failure appear to be infrastructure issues

@jochenberger
Copy link
Copy Markdown
Contributor

Two jobs failure appear to be infrastructure issues

#2928 should fix that.

@bric3
Copy link
Copy Markdown
Contributor Author

bric3 commented May 13, 2026

Thanks @jochenberger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spotlessPredeclare accessor is not available in kotlin scripts

2 participants