-
Notifications
You must be signed in to change notification settings - Fork 163
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
Migrate to ktlint 0.46.0 #593
Conversation
- migrated `ReporterProvider` usage to `ReporterProvider<*>` - using wildcards as exact type is not required for plugin's use cases - Ktlint.Params class is no longer available, removed it in favor of Ktlint.ExperimentalParams
- afaik git is case-insensitive, so you need to run two commits in order to change main->Main (error reported by new version of ktlint)
-- ktlint suggests that this is no longer necessary - is it? > UserData contains properties [android]. However, userData is deprecated and will be removed in a future version. Please create an issue that shows how this field is actively used.
There is a bug in documentation that should be fixed :) ./plugin/gradlew pluginUnderTestMetadata try ./plugin/gradlew -p ./plugin pluginUnderTestMetadata than, you should be able to run the tests: ./plugin/gradlew -p ./plugin check 😃 new version of ktlint complains about main.kt files not being PascalCase. Thanks for the contribution, I am not the maintainer of this repo, but I actively use it at work! |
Is there any way to write this change so that it is backwards compatible via reflection? If it is not, then there needs to be an exception thrown somewhere if someone attempts to use an older, incompatible, version of |
@JLLeitschuh If the only breaking change was removal of
@AleksanderBrzozowski not really, the name change will still be registered in Git history, but if you have this project cloned on your local machine and you make a pull, casing will not change (it will remain I tried this: |
@scana I cloned the repo, invoked the command and everything worked correctly - build passed.
|
I think the addition of generics is not an API breaking chance because generics are erased by the compiler. I'd try doing the reflection thing and leave the generics as you have them and see if you can support backwards compatibility. If you can't, oh well.. but it would be worth trying |
Small update - still working on this as I managed to get tests to run, but at least half of them fail with:
|
@scana Please provide more details about system / java version that you use ;) |
-- with lowest supported version 0.46.1, those tests do not longer bring value to us
-- added missing google repository (Android Gradle Plugin could not be found issue) -- fixed file names (ktlint started to complain about them not being pascal case) -- indentations changed from tabs to spaces -- some error messages changes (phrasing mostly)
Added some more changes, some of them taken directly from @fthouraud's PR (#595). Had to remove some of the test cases as they are failing before plugin can even start, due to missing Gradle-related classes (ie. it's not so easy to throw an exception). The following test cases still fail, but I am not sure how long it make take me to resolve them.
@AleksanderBrzozowski I am using the same java version as you are + MacOS M1. |
I believe that this is now outdated by #597, correct? |
@JLLeitschuh yeah, #597 covers some of the changes here - let me close this one. |
Important/breaking changes:
1.6.21
- required as newer ktlint is compiled with Kotlin1.7.0
and the build fails due to it being incompatible with1.5.21
0.46.1
- this was unavoidable because ktlint has introduce an API breaking change inReporterProvider
interfaceFixes #589.
Opening this as a draft, as there are few things to be resolved.
Notes/questions/problems:
./plugin/gradlew pluginUnderTestMetadata
returns:At the same time, running tests from IDE result in:
main.kt
files not being PascalCase.This is problematic because git is case-insensitive and if all of those changes get squashed, the filename won't change on other repo clones.
This could be perhaps resolved by just disabling this particular rule for every sample. Or do a rename in separate PR and instead of squashing, just rebase two commits. Wdyt?
userData
parameter fromKtlint.Params/ExperimentalParams
as ktlint would complain that this field is deprecated and will be removed. Is it needed for any particular reason?