-
Notifications
You must be signed in to change notification settings - Fork 61
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
Move the logic from koltin repo atomicfu gradle plugin to the gradle plugin in the library. #406
Conversation
a0877cd
to
1c1b02b
Compare
…ary starting from Kotlin 1.9.0 Fixes #370
The last commit suggests an alternative solution to the problem of 2 atomicfu gradle plugins (#370): This will solve the problem of Kotlin version resolution "before" The current solution works in overall, but still has several issues to be solved:
|
As the problems 1 and 2 are not critical now, and there were no actual user cases of version difference, I think it's reasonable to postpone their solution (#408) until we have public API to retrieve Kotlin compiler and Kotlin native compiler versions. Here is the corresponding ticket: KT-66384. I'll remove the separation of JVM/JS and Native compiler plugins and use KGP version to get the compiler plugin artifact, as it was done before. |
…ith Kotlin lower than 1.9.0
} | ||
} | ||
} | ||
error("You are applying `kotlinx-atomicfu` plugin of version 0.23.3 or newer. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, in case of KGP version < 1.9.0
, I asked users to add org.jetbrains.kotlin:atomicfu
dependency manually to the buildscript. However, this caused further problems, that already were solved in higher Kotlin versions.
E.g. the problem below would occur if you try to apply the current kotlinx-atomicfu version with Kotlin 1.8.20 and just add the kotlin:atomicfu:1.8.20
dependency manually (this problem was solved in 0.23.0
and Kotlin 1.9.10
)
e: Could not find ".gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/atomicfu-linuxarm64/0.23.2/7b4270560c2723dc55b1d3c8925b7b93201c437b/atomicfu.klib" in [IdeaProjects/kotlinx-atomicfu-new/integration-testing/examples/mpp-sample, .konan/klib, .konan/kotlin-native-prebuilt-macos-aarch64-1.8.20/klib/common, .konan/kotlin-native-prebuilt-macos-aarch64-1.8.20/klib/platform/linux_arm64]
So, I decided to write this error message about incompatibility instead.
I've checked that the sample mpp project can be built with kotlinx-atomicfu 0.22.0
and Kotlin down to 1.6.0
, though I believe these are very marginal use cases.
@fzhinkin WDYT? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version 0.23.3 or newer
Can we print the exact version here?
I think it should be enough to:
- mention that Kotlin version should be upgraded
- add a document (like readme) describing an alternative solution for those who can't upgrade the Kotlin for some reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a note about downgrading atomicfu version as an alternative solution in the README. And in the message left just the recommendation to upgrade the Kotlin version.
* --prerelease-check for the new project * remove expanded.lock file
atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
Outdated
Show resolved
Hide resolved
} | ||
} | ||
} | ||
error("You are applying `kotlinx-atomicfu` plugin of version 0.23.3 or newer. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version 0.23.3 or newer
Can we print the exact version here?
I think it should be enough to:
- mention that Kotlin version should be upgraded
- add a document (like readme) describing an alternative solution for those who can't upgrade the Kotlin for some reason
...lugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicfuKotlinCompilerPluginInternal.kt
Show resolved
Hide resolved
...lugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicfuKotlinCompilerPluginInternal.kt
Show resolved
Hide resolved
...lugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicfuKotlinCompilerPluginInternal.kt
Outdated
Show resolved
Hide resolved
…/gradle/AtomicfuKotlinCompilerPluginInternal.kt Co-authored-by: Filipp Zhinkin <filipp.zhinkin@jetbrains.com>
atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt
Outdated
Show resolved
Hide resolved
|
||
* Gradle `7.0` or newer | ||
|
||
* Kotlin `1.7.0` or newer | ||
* Kotlin `1.9.0` or newer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Atomicfu compiler plugin
sections seems to be obsolete as it describes how the plugin should be configured for older versions.
As there's a suggestion to use an older atomicfu version with older Kotlin version, it does make sense to move everything related to older versions to a dedicated page (or leave it here, but stress that it only applies to older atomicfu versions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed this section, added a note about Kotlin version requirements for the current atomicfu version and moved old configurations to the hidden section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This is a reproducer for the problem #399
According to our last solution (#386),
atomicfu-gradle-plugin
provides a transitive atomicfu compiler plugin dependency and relies on the gradle version resolution. So, we provide compiler plugin with the lowest version and expect it to be resolved into the highest version present on the user's classpath.But this does not work for the project configuration presented in this PR. This is a minimized version of an MPP project created by a MPP Wizard, which uses
libs.versions.toml
file as a version catalog.How to reproduce the failure:
The build will fail with the error:
NOTE: if contents of
compiler-plugin-resolution-bug/build.gradle.kts
are removed, the build completes successfully: