Skip to content

Conversation

wakingrufus
Copy link
Collaborator

@wakingrufus wakingrufus commented Aug 12, 2025

Gradle 9 Support
remove use of ConfigureUtil
update max kotlin version for testing to 2.2.0

Copy link
Owner

@JLLeitschuh JLLeitschuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions

// This method is needed for Groovy interop
// See https://discuss.gradle.org/t/multi-level-dsl-for-plugin-extension/19029/16
ConfigureUtil.configure(configuration, customReporters)
fun customReporters(configuration: Action<NamedDomainObjectContainer<CustomReporter>>) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a binary API breaking change? IE. if projects are depending upon this plugin as a direct dependency rather than as a script, anything compiled against our APIs won't work anymore, correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possibly... I know gradle has some stuff to auto convert between SAMs and Closures, but I'm not sure if it would help here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in any case, this is the way is is supposed to be done in Gradle now, so I think at most, I'll make a note about it in release notes

Comment on lines -91 to -95
MAX_GRADLE_MIN_AGP(
GradleVersion.version(TestVersions.maxSupportedGradleVersion),
TestVersions.minAgpVersion,
TestVersions.minSupportedKotlinPluginVersion
),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why drop this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old AGP doesnt work with Gradle 9, so this combination no longer works

@wakingrufus wakingrufus force-pushed the gradle-9 branch 2 times, most recently from bd66673 to accef98 Compare August 13, 2025 02:44
@@ -25,7 +29,6 @@ object TestVersions {
@Retention(AnnotationRetention.RUNTIME)
annotation class GradleTestVersions(
val minVersion: String = TestVersions.minSupportedGradleVersion,
val maxVersion: String = TestVersions.maxSupportedGradleVersion,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we were never overriding this anyway, and making it an annotation property was preventing me from making it dynamic based Java version

@wakingrufus wakingrufus force-pushed the gradle-9 branch 7 times, most recently from 6fe7256 to b1f3923 Compare August 13, 2025 03:18
remove use of ConfigureUtil
update max kotlin version for testing to 2.2.0
@wakingrufus wakingrufus merged commit e32495d into main Aug 15, 2025
21 checks passed
@wakingrufus wakingrufus deleted the gradle-9 branch August 15, 2025 02:06
@pkubowicz
Copy link

What problems does this PR solve?

I've been using ktlint-gradle 13.0.0 with Gradle 9.0.0 for more than two weeks, without any problems. When I execute gradle --warning-mode=all ktlintCheck ktlintFormat, I don't receive any warnings.

@wakingrufus
Copy link
Collaborator Author

wakingrufus commented Aug 25, 2025

What problems does this PR solve?

I've been using ktlint-gradle 13.0.0 with Gradle 9.0.0 for more than two weeks, without any problems. When I execute gradle --warning-mode=all ktlintCheck ktlintFormat, I don't receive any warnings.

2 main things:

  1. the custom reporter extension API was using Gradle APIs that were removed in Gradle 9
  2. the integration tests were updated to actually test against gradle 9, and doing that exposed some integration tests that did not work in gradle 9, so those were cleaned up.

@pkubowicz
Copy link

OK, so the plugin worked with Gradle 9 already in 13.0.0, just the custom reporters handling did not, and this part was fixed here.

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.

3 participants