I enabled CC with a Kotlin Multiplatform build (1 ...
# gradle
h
I enabled CC with a Kotlin Multiplatform build (1 JS target only) but now I get this confusing error message:
IllegalArgumentException: Cannot set the value of a property of type org.jetbrains.kotlin.gradle.plugin.statistics.BuildFusService using a provider of type org.jetbrains.kotlin.gradle.plugin.statistics.BuildFusService.
Bug in Gradle or in KGP? https://scans.gradle.com/s/vncsk6llqmdja/failure
v
From a very cursory look, I'd almost guess that it might be caused by the plugin classpath injecting when you use the TestKit. If you instead publish to some local directory (not maven local) and consume the plugin from there, it might work better.
h
Hm, I don't use Testkit but an includedBuild, but I will test it
v
Hm, was mostly a steer in the dark, as I've seen it is something with integ tests and most often for that TestKit is used, and I've already seen very strange behavior in the past when using TestKit and its feature to inject the plugin classpath. These strange behaviours often resulted in classloader issues like class not found exceptions that should be found or things like cannot cast A to A like in your case.
But if it is not that, I'd recommend you set a breakpoint to where the exception is coming from and then look at which classloaders the two identical classes are coming from.
Maybe that will give the insight to understand the reason.
Another typical reason for such cannot cast A to A errors is, if you add plugin X (that contains A) to subprojectA and subprojectB without having it in the classloader of parentproject. If then those two want to use something in common like a build service, the same happens. But as far as I have seen from the scan, you also have the plugin in the root project, so that should not be it I think.
h
This is the code btw https://github.com/hfhbd/kotlin-actions/tree/supportCC, but yes, KGP is also applied in the root project indirectly by adding the dependencies of the included build into the settings classpath
And of course it does work without problems if I run the task from IntelliJ
WTF I bumped the develocity plugin to 3.17.5 and it does work now?!
And when I rerun the tasks now, it is working now too? After all the previous failures? I don't get it.
v
o_O
h
How does the develocity plugin influence the classpath? Does it depend on KGP somehow? But why does it conflict with the BuildFusService that is only part of KGP?
v
dark and evil magic?
h
Well, I guess so... Anyway, it does work now, somehow I absolutely don't understand, but this is the definition of magic 🙂
At least I can reproduce the error when I downgrade to 3.17.2
🤔 1
v
Interesting. You should investigate it then maybe? Sounds quite frightening and it might just be an accidental and maybe even temporary side-effect that it works with the newer version. 🤷‍♂️
h
will do it tomorrow
👌 1