Closed chrisbanes closed 5 months ago
Hey @chrisbanes, thanks for the report. Can you check if you by any change have skie.kgpVersion
in your gradle.properties
? And if not, could you try adding skie.kgpVersion=2.0.0
and try if the problem goes away?
In the meantime I'll try to reproduce it in our tests. We actually don't use reflection to call these APIs (unless we missed something), but we did have to change how we call them to get SKIE working with Gradle Configuration Cache.
We don't have skie.kgpVersion
in our properties, but setting skie.kgpVersion=2.0.0
does workaround the issue š¤
That seems like SKIE can't automatically determine your Kotlin Gradle plugin version. Could you check if perhaps you have an old Kotlin version left somewhere that happened during upgrading?
Everything is controlled via libs.versions.toml
+ our convention plugins so there's no chance of that happening š¤.
I'll try with --debug
as it looks like you have some logging for this. (side note: should that be a info
or higher severity? it seems more serious than debug
).
So it should actually error out if it can't find the version. In this case it seems like it's finding a wrong version, which shouldn't happen.
The reason why it's debug
and not info
because we look at the project
of module you applied SKIE to and if that doesn't resolve, we go and look at rootProject
. So it'd show warnings (or infos) for folks who it resolved the version properly from rootProject
. What do you think?
@chrisbanes Do you use includeBuild
in your project? And you mentioned you use convention plugins, could you share how you configure version for kotlin("multiplatform")
in those plugins? (usually you need to add implementation
dependency to buildSrc
/build-logic
buildscript).
Do you use includeBuild in your project?
Yes, exactly
could you share how you configure version for kotlin("multiplatform") in those plugins? (usually you need to add implementation dependency to buildSrc/build-logic buildscript).
We add a compileOnly
dependency onto org.jetbrains.kotlin:kotlin-gradle-plugin
in the convention plugin. In the main project, we then use alias(libs.plugins.kotlin.multiplatform) apply false
in the main build.gradle.kts
to add KGP to the classpath.
Our KMP convention plugin calls pluginManager.apply("org.jetbrains.kotlin.multiplatform")
to hook it all up for each module.
Thanks, that's good info. And for the compileOnly
dependency, what version do you give it? Or do you use the same libs
with the same version ref?
It's all defined in a libs.versions.toml
. We use the alias
from the main project, and the library
from the convention plugin:
[versions]
kotlin = "2.0.0"
[plugins]
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
[libraries]
kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
Thanks, I'll try to reproduce it and possibly ask more questions if I can't.
No luck so far. What version of Gradle are you using? And could you share more about how you apply SKIE Gradle plugin?
And could you share the message SKIE prints when running with --debug
(without the skie.kgpVersion
override)? It should be starting with the "SKIE could not determine the Kotlin Gradle plugin version directly from Kotlin Gradle plugin because ..". Thanks!
Hi! We added some additional debug logging in 0.8.1. Can you please try this version with --debug
and send us all lines that contain [SKIE]
(you can filter them using grep
).
Here's the log. It seems to be finding Kotlin 1.9.22 from the classpath, but I have no idea how it's finding that.
Try running the :shared:app:dependencies
Gradle task it should print out the content of the classpath
configuration which might give us more insight.
I'm seeing a lot of: org.jetbrains.kotlin:kotlin-stdlib:1.9.2X -> 2.0.0 (*)
Is this a timing issue? Is SKIE checking the classpath before Ivy has fully resolved the dependencies?
I don't think it can be a timing issue (doesn't necessarily mean it isn't :D). SKIE looks for the org.jetbrains.kotlin:kotlin-gradle-plugin
artifact in the resolved classpath configuration. (After resolution the configuration content cannot change.) Do you see a similar version upgrade in the case of org.jetbrains.kotlin:kotlin-gradle-plugin
?
I don't see org.jetbrains.kotlin:kotlin-gradle-plugin
anywhere in the classpath š¤. I've even tried manually adding KGP to the module (before my convention plugin), and still nothing.
Oh, sorry I gave you a wrong task. The correct one should be :shared:app:buildEnvironment
.
Ah thanks! Found the issue. co.touchlab.crashkios.crashlyticslink
seems to have a hard dependency on KPG 1.9.22.
classpath
+--- co.touchlab.crashkios.crashlyticslink:co.touchlab.crashkios.crashlyticslink.gradle.plugin:0.8.6
| \--- co.touchlab.crashkios:crashlytics-ios-link:0.8.6
| +--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22
| | +--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22 (c)
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.9.22 (c)
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22 (c)
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.9.22 (c)
| | | +--- org.jetbrains.kotlin:kotlin-native-utils:1.9.22 (c)
| | | \--- org.jetbrains.kotlin:kotlin-tooling-core:1.9.22 (c)
| | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22 (*)
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-native-utils:1.9.22
| | | | +--- org.jetbrains.kotlin:kotlin-util-io:1.9.22
| | | | \--- org.jetbrains.kotlin:kotlin-util-klib:1.9.22
| | | | \--- org.jetbrains.kotlin:kotlin-util-io:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-project-model:1.9.22
| | | | \--- org.jetbrains.kotlin:kotlin-tooling-core:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-tooling-core:1.9.22
| | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.9.22 (*)
| | | \--- org.jetbrains.kotlin:kotlin-gradle-plugins-bom:1.9.22 (*)
| | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-tooling-core:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:1.9.22
| | +--- org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.9.22 (*)
| | +--- org.jetbrains.kotlin:kotlin-util-klib:1.9.22 (*)
| | +--- org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-native-utils:1.9.22 (*)
| | +--- org.jetbrains.kotlin:kotlin-build-tools-api:1.9.22
| | +--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.9.22
| | | | \--- org.jetbrains:annotations:13.0
| | | +--- org.jetbrains.kotlin:kotlin-script-runtime:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-reflect:1.6.10 -> 1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.9.22
| | | \--- org.jetbrains.intellij.deps:trove4j:1.0.20200330
| | +--- org.jetbrains.kotlin:kotlin-android-extensions:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.22 (*)
| | +--- org.jetbrains.kotlin:kotlin-compiler-runner:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-daemon-client:1.9.22
| | | +--- org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0
| | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.22 (*)
| | +--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.9.22
| | | +--- org.jetbrains.kotlin:kotlin-scripting-common:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-scripting-jvm:1.9.22
| | | \--- org.jetbrains.kotlin:kotlin-scripting-common:1.9.22
| | \--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.9.22 (*)
| \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.9.22 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib:{strictly 1.9.22} -> 1.9.22 (c)
+--- org.jetbrains.kotlin:kotlin-reflect:{strictly 1.9.22} -> 1.9.22 (c)
\--- org.jetbrains:annotations:{strictly 13.0} -> 13.0 (c)
Funny that it's caused by one of our libraries :D It should have compileOnly
dependency on KGP.
However, it's also a bug in the SKIE version resolution because the KGP version used by your Gradle script is different in the end. I'll try to reproduce the issue locally.
Fixed in 0.8.2.
I see that SKIE 0.8.0 is now using reflection to call KGP APIs, but it seems that this is completely breaking our usage.
What is the problem?
When does the problem occur?
Any Gradle task
How do we reproduce the issue?
Honestly, I don't really know. We use some convention plugins to apply a bunch of KGP, CMP and Skie settings. I've tried clearing out the entire Gradle cache, turning off configuration cache, etc.
What has changed since the last time SKIE worked in your project?
Updating to Kotlin 2.0.0 and SKIE 0.8.0