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

The plugin does not work when using Ktlint 0.46.0 #589

Closed
mars885 opened this issue Jun 19, 2022 · 14 comments · Fixed by #620 or d-fine/Dataland#175
Closed

The plugin does not work when using Ktlint 0.46.0 #589

mars885 opened this issue Jun 19, 2022 · 14 comments · Fixed by #620 or d-fine/Dataland#175

Comments

@mars885
Copy link

mars885 commented Jun 19, 2022

The Ktlint 0.46.0 has been released recently with breaking API changes that make using the plugin impossible. One such change is that Ktlint.Params class has been renamed into the ExperimentalParams.

As a result of this, when I run the ./gradlew ktlintCheck --continue command, I get the following:

> Task :app:runKtlintCheckOverKotlinScripts FAILED
> Task :app:runKtlintCheckOverMainSourceSet FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:runKtlintCheckOverKotlinScripts'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > com/pinterest/ktlint/core/KtLint$Params

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:runKtlintCheckOverMainSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > com/pinterest/ktlint/core/KtLint$Params

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
10 actionable tasks: 3 executed, 7 up-to-date

The versions used are the following:

  • ktlint-gradle: 10.3.0
  • ktlint: 0.46.0
@JLLeitschuh
Copy link
Owner

A PR that addresses the issue would be appreciated 🙂

@scana
Copy link

scana commented Jun 29, 2022

Hey @JLLeitschuh, I have it almost ready, but it seems like it would require updating the whole project (and samples) to Kotlin 1.6.21 and then it will not be backward-compatible with earlier ktlint versions (due to 0.46 introducing breaking changes).

I'll open it soon so maybe @JLLeitschuh or @Tapchicoma could take a look (I've read #569 so I know how it looks like time-wise)

@JLLeitschuh
Copy link
Owner

@scana could you do so in such a way that preserves backwards compatibility by using reflection to call the old APIs?

@scana
Copy link

scana commented Jun 29, 2022

@JLLeitschuh unfortunately not, because they have also changed ReporterProvider signature to ReporterProvider<T : Reporter>

@jzeferino
Copy link

with:

tlint-gradle: 10.3.0
ktlint: 0.46.1

still getting the following exception:

Screenshot 2022-08-17 at 13 07 28

StylianosGakis added a commit to HedvigInsurance/android that referenced this issue Aug 18, 2022
Turns out experimental:function-signature is a feature of ktlint 0.46.+
which is something we can not use yet since the gradle plugin we're
using does not support it yet, relevant issue here:
JLLeitschuh/ktlint-gradle#589

This also required to downgrade to the gradle plugin ktlint version
0.9.1 from 0.10.0 so that the IDE hints do not show different rules as
well.
@mikehardy
Copy link

Please take this in the light-hearted spirit it is intended but: change all the things, issue a major version (semantic-version-wise) and sleep well at night :-)

@G00fY2
Copy link

G00fY2 commented Aug 25, 2022

As stated in this PR I think even though there was a 11.0.0 major release, this issue is still unchanged.

@DmitriyZaitsev
Copy link

DmitriyZaitsev commented Aug 31, 2022

Same issue with all ktlint versions >0.45.2, including 0.47.0

@mikehardy
Copy link

mikehardy commented Sep 1, 2022

@DmitriyZaitsev edited his comment to be more collaborative / informative, so I am editing mine to be much more friendly :-)

@scottkennedy
Copy link

Please take this in the light-hearted spirit it is intended but: change all the things, issue a major version (semantic-version-wise) and sleep well at night :-)

Given how long this issue has been open and unresolved, is this something we could do? Create a 12.0.0 and just say that as of that version of this plugin, only ktlint 0.46.0 and newer are supported?

@konstantin-rudoi-nix
Copy link

The same problem

Execution failed for task ':app:runKtlintCheckOverKotlinScripts'.
Execution failed for task ':app:runKtlintCheckOverMainSourceSet'.
Execution failed for task ':app:runKtlintCheckOverTestSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > com/pinterest/ktlint/core/KtLint$Params

wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 12, 2023
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 12, 2023
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 12, 2023
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 13, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 13, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
@konstantin-rudoi-nix
Copy link

konstantin-rudoi-nix commented Jan 16, 2023

com.android.tools.build:gradle = "7.4.0"
kotlin = "1.8.0"
ktlint = "0.48.1"

> Task :app:runKtlintCheckOverMainSourceSet FAILED
> Task :app:runKtlintCheckOverTestSourceSet FAILED
> Task :app:runKtlintCheckOverKotlinScripts FAILED

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:runKtlintCheckOverKotlinScripts'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Could not create an instance of type org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction.
      > Could not generate a decorated class for type KtLintWorkAction.
         > com/pinterest/ktlint/core/ParseException

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:runKtlintCheckOverMainSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Could not create an instance of type org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction.
      > Could not generate a decorated class for type KtLintWorkAction.
         > com/pinterest/ktlint/core/ParseException

3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:runKtlintCheckOverTestSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Could not create an instance of type org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction.
      > Could not generate a decorated class for type KtLintWorkAction.
         > com/pinterest/ktlint/core/ParseException

@wakingrufus
Copy link
Collaborator

My pr #620 will resolve this issue. I am putting the finishing touches on it and will hopefully merge it later this week

wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 17, 2023
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 17, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 17, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 17, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 17, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 17, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 25, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 25, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
wakingrufus added a commit to wakingrufus/ktlint-gradle that referenced this issue Jan 26, 2023
add tests for 0.44 and 0.45 as well
This resolves JLLeitschuh#589
This resolves JLLeitschuh#607
JLLeitschuh pushed a commit that referenced this issue Jan 27, 2023
@JLLeitschuh
Copy link
Owner

https://github.com/JLLeitschuh/ktlint-gradle/releases/tag/v11.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
10 participants