Does anyone know if there's a good way to detect w...
# gradle
t
Does anyone know if there's a good way to detect what version of the kotlin gradle plugin is applied? I have a plugin where in the past we had a few directories that we were adding to the java sourceset. However, adding to just the java sourceset caused issues when we switched to gradle 8 because we started to get implicit task dependency errors on a few kotlin specific tasks. So I updated the plugin so that it now grabs the kotlinExtension and adds directly to the kotlin sourceset. After making the change, I found out this logic was broken before kotlin 1.9.0. I'm wondering if there's a good way to detect the version so I can just add to the java source set if they are pre kotlin 1.9.0 and add to the kotlin sourceset if they are on or after 1.9.0.
Maybe a better workaround is to just add each file individually? I assume that logic works.
I found a post which has a solution that looks like it may work, although I don't love it: https://discuss.gradle.org/t/how-can-a-custom-gradle-plugin-determine-its-own-version/36761/4. It seems like gradle should know the entire classpath for the child without having to look at the parent.
t
I think you are look for this. All Kotlin plugins should implement this interface
t
ahh amazing! Thank you both!