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

Regression in gradle/6.23.0. Unable to configre ktlint #1911

Closed
AntsyLich opened this issue Nov 27, 2023 · 9 comments · Fixed by #1912
Closed

Regression in gradle/6.23.0. Unable to configre ktlint #1911

AntsyLich opened this issue Nov 27, 2023 · 9 comments · Fixed by #1912

Comments

@AntsyLich
Copy link
Contributor

summary of problem

spotless {
    kotlin { 
        ktlint()
    }
}

Having the simple block below highlights ktlint(). Hovering on it shows the message "Type BaseKotlinExtension.KtlintConfig! is inaccessible in this context due to: public open inner class KtlintConfig defined in com.diffplug.gradle.spotless.BaseKotlinExtension". But spotless works fine. Now if i try to access any method of ktlint config like below red squiggly line appers below that method and hovering over them shows the message "Cannot access 'BaseKotlinExtension': it is package-private in 'com.diffplug.gradle.spotless'"

spotless {
    kotlin {
        ktlint()
            .customRuleSets(listOf("io.nlopez.compose.rules:ktlint:0.3.3"))
    }
}

Gradle or Maven version

Gradle 8.4

spotless version

gradle/6.23.0

operating system and version

Windows 11

copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible

See above

copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace

> Configure project :app
w: file:///D:/[...]/android/app/build.gradle.kts:46:9: Type BaseKotlinExtension.KtlintConfig! is inaccessible in this context due to: public open inner class KtlintConfig defined in com.diffplug.gradle.spotless.BaseKotlinExtension
w: file:///D:/[...]/android/app/build.gradle.kts:46:9: Type BaseKotlinExtension.KtlintConfig! is inaccessible in this context due to: public open inner class KtlintConfig defined in com.diffplug.gradle.spotless.BaseKotlinExtension
e: file:///D:/[...]/android/app/build.gradle.kts:47:14: Cannot access 'BaseKotlinExtension': it is package-private in 'com.diffplug.gradle.spotless'

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\[...]\android\app\build.gradle.kts' line: 47

* What went wrong:
Script compilation error:

  Line 47:             .customRuleSets(listOf("io.nlopez.compose.rules:ktlint:0.3.3"))
                        ^ Cannot access 'BaseKotlinExtension': it is package-private in 'com.diffplug.gradle.spotless'

If you're just submitting a feature request or question, no need for the above.

@Goooler
Copy link
Member

Goooler commented Nov 27, 2023

Fixing this in #1912.

@TWiStErRob
Copy link

TWiStErRob commented Nov 27, 2023

See also gradle-nexus/publish-plugin#286, same issue.

@StefanLobbenmeierObjego

ktfmt is affected by the same issue, adding this here in case someone searches for that instead:

* What went wrong:
Script compilation error:

  Line 141:     kotlinGradle { ktfmt().dropboxStyle() }
                                       ^ Cannot access 'BaseKotlinExtension': it is package-private in 'com.diffplug.gradle.spotless'

1 error

serras added a commit to arrow-kt/arrow that referenced this issue Nov 27, 2023
@madorb
Copy link

madorb commented Nov 28, 2023

Same issue with greclipse()

@nedtwigg
Copy link
Member

Fixed in plugin-gradle 6.23.1. It has been published in the Gradle plugin repository, but the maven central sync appears to be jammed for now. Should resolve in a few hours.

@StefanLobbenmeierObjego

I was able to update to v6.23.2 now and that fixed the issue, thanks ❤️

@yoobi
Copy link

yoobi commented May 25, 2024

I am having the same issue with 6.25.0

No signature of method: com.diffplug.gradle.spotless.BaseKotlinExtension$KtlintConfig.userData() is applicable for argument types: (LinkedHashMap) values: [[android:true]
ktlint().userData(["android": "true"])

@Goooler
Copy link
Member

Goooler commented May 25, 2024

userData method has been removed from Ktlint step in #1891, you may use editorConfigOverride instead.

I noted this in 6.23.0 changelog.

@yoobi
Copy link

yoobi commented May 25, 2024

Oh shoot I missed this, sorry

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 a pull request may close this issue.

7 participants