hello everyone, with a coworker we have been exper...
# community-support
j
hello everyone, with a coworker we have been experimenting with configuring a different kotlin version to compile our code and to compile the build as per this gradle blog article. Our main project is stuck on kotlin compiler 2.2 for now ( we tried 2.3 and the different bytecode triggers subtle bugs which will take time to resolve ) so until today we were stuck on gradle 9.3.1 which pulls kotlin 2.2.21. Today we spent some time upgrading everything to gradle 9.7.1. Since this is a largish build we actually have 2 multi-project builds : • a plugin build where we define our convention plugins and custom plugins. • the apps build which consumes the conventions and plugins to build our apps Our understanding from the article is that the plugin build should use kotlin gradle plugin 2.4.0 ( which is the version embedded in gradle 9.7.1) and we want our apps build to keep using kotlin 2.2.21 we managed to make this work in the normal process where we release the artifacts of the plugin build and pull them in the main build in pre-compiled form ensuring a performant enough build for everyone However when working on the plugins build locally we use an include build: we include the plugins build in the apps build. In that configuration all other things being equal a build scan correctly reports that we have 2 version of the kotlin compiler plugin in the build, 2.2.21 which is used by the projects of the main build and 2.4.0 which is used by the projects of the plugins build. unfortunately the apps build fails to compile with errors which seem to indicate that the code was compiled with kotlin 2.3. Is this to be expected, is there a way around it ? we probably won't be able to upgrade to kotlin 2.4 for the apps build anytime soon so the dev experience for build engineers is going to significantly degrade ( we are investigation local publication in order to work around this but its way more painful than the include build pattern )
p
Do you have a public build scan? Because that should not happen
The Kotlin version used by Gradle should be independently from your app version
v
Also what concretely makes you think 2.3 is in the loop, especially as you said the scan confirms 2.2 and 2.4 being used.
j
Also what concretely makes you think 2.3 is in the loop, especially as you said the scan confirms 2.2 and 2.4 being used.
sorry I have mixed my versions up as I have tried with both gradle 4.1 and kotlin 2.3 and gradle 9.7 and gradle 2.4 what makes me think the version of the kotlin compiler is different in the case of included builds ands triggers the compilation error is that • nothing else changes appart from the gradle version and the version of the kgp plugin • using gradle 9.7 I don't get the compilation error if I use released artifacts, I only get it if I use included build I wanted to make sure this wasn't a known limitation of the included build before asking to be allowed to share a build scan or to spend time on building a reproducer. Now I know it's not I will resume these activities next week
I was too curious to let this sit : I finished the reproducer I had started friday and ... didn't reproduce the issue. after further investigation I'm the idiot: the worktree where I was testing the include build was indeed on the same commit that the worktree where I was testing the release build, using the same plugin build, but I had leftover changes to gradle lockfiles that I somehow missed to spot after cleaning that, the build works as expected 🎉 Please accept my apologies for the wasted time
👌 1