-
Notifications
You must be signed in to change notification settings - Fork 166
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
Fix for "Kotlin sourceDir
isn't take into account"
#703
Conversation
sourceDir
isn't take into account"
To be clear about what this breaks, it would mean that we now require AGP >=7.0 and Gradle >= 7.0? I am ok with this, but I would like to queue up some related maintenance work around dropping Gradle 6 support so we can merge them all around the same time and release it as 16.0 |
Yes, that's correct. Sure, do the maintaince work and come back as you're finish with that ☺. You can also let me when I can help with that somewhere. |
@wakingrufus did you had the time to look into this yet? |
Not yet. I need to finish up #708 first |
It's going to be happen 🤘 🙃 |
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/android/AndroidPluginsApplier.kt
Outdated
Show resolved
Hide resolved
Do we want to accept this API breaking change? Does this break our guarantee of android plugin support range? Do we currently have unit tests that cover the range of android plugins we want to ensure we support? If we don't we should. |
I just saw that we set the AGP only as a ktlint-gradle/plugin/build.gradle.kts Line 135 in a826dcd
With that we can also workaround the breaking change by adding a try-catch 🤔 val androidSourceSet = try {
sourceSet.kotlin as DefaultAndroidSourceDirectorySet
} catch(_: java.lang.NoSuchMethodError) {
java as DefaultAndroidSourceDirectorySet
} UpdateUnfortunately this is not really working as the signature of the |
34eeeae
to
2141717
Compare
For detailed reasons check the following issue: JLLeitschuh#702
2141717
to
eb47391
Compare
Seems this could be closed for now, handled by #733. |
Closes #702
Description:
An detailed explanation why can be read in #702
I also had the upgrade the AGP to version 7.0.0 because the 4.1.0 doesn't know the
kotlin
property 😁7.0.0 is the first version that supports hit.
Yes, this would be an potential breaking change.
But please take a look at the release dates for those plugins:
https://maven.google.com/web/index.html?q=tools.bui#com.android.tools.build:gradle:4.1.0
-> Release at 10th December 2020
https://maven.google.com/web/index.html?q=tools.bui#com.android.tools.build:gradle:7.0.0
-> Release at 28th July 2021
As the Android community is normaly quite good in upgrading the core plugin to develop, I guess we are fine 😁
Changes:
kotlin
sourceSet instead ofjava
sourceSetHow to test:
/plugin/VERSION_CURRENT.txt
to something else e.g. "testKotlinSourceSet"cd plugin ./gradlew publishToMavenLocal
mavenLocal()
repository (to find that version)/plugin/VERSION_CURRENT.txt