atomic-fu docs says > Compile-only dependency f...
# multiplatform
e
atomic-fu docs says
Compile-only dependency for JVM and JS (no runtime dependencies)
But then in the decompiled bytecode I find
Copy code
private static final AtomicInt count = AtomicFU.atomic(0);
Which is part of the runtime. Am I missing something?
a
Doesn't it mean that, there is no runtime dependencies on JS??
o
atomicfu declarations should be replaced or by compiler plugin (if using flags mentioned in readme) or via transformer which modifies bytecode/js files more info: https://github.com/Kotlin/kotlinx-atomicfu?tab=readme-ov-file#transformation-modes Most likely, you have atomicfu in decompiled bytecode, because gradle plugin is not configured in project
e
So, I've added the plugin
Copy code
[plugins]
kotlinx-atomicfu = { id = "org.jetbrains.kotlin.plugin.atomicfu", version.ref = "kotlin" }
And
Copy code
plugins {
  alias(libs.plugins.kotlinx.atomicfu)
}
Plus, applied
Copy code
# AtomicFU transformation via compiler plugin
kotlinx.atomicfu.enableJsIrTransformation = true
kotlinx.atomicfu.enableJvmIrTransformation = true
And I can still AtomicFU stuff in decompiled code. Not sure if I've missed a step.
o
please recheck on how to apply kotlinx-atomicfu plugin here: https://github.com/Kotlin/kotlinx-atomicfu?tab=readme-ov-file#gradle-configuration Correct name of gradle plugin is
kotlinx-atomicfu
with version of a library f.e. 0.22.0 and not version of kotlin what you have applied is just a
compiler plugin
which is not enough in this case
e
Ok! Seems working now, thanks! Wondering why it's not published to the Gradle repository and it's still using the buildscript way of adding plugins
o
most likely, lack of resources / other priorities it works know, but I agree, that it’s not idiomatic now there are several issues for tracking gradle related things: • https://github.com/Kotlin/kotlinx-atomicfu/pull/205https://github.com/Kotlin/kotlinx-atomicfu/pull/74 But, AFAIK those changes will be not enough, as if only those changes will be implemented getting default version for runtime dependency could stop working (because of https://github.com/Kotlin/kotlinx-atomicfu/blob/master/atomicfu-gradle-plugin/src/main/kotlin/kotlinx/atomicfu/plugin/gradle/AtomicFUGradlePlugin.kt#L47) So, more changes needed to make it happen (or may be even some other changes, of which Im not aware of)
m
Wondering why it's not published to the Gradle repository and it's still using the buildscript way of adding plugins
FWIW, these are 2 orthogonal things. What you want most of the times is the plugin marker to be published. You can publish them on Maven Central, this has nothing to do with the Gradle Plugin Portal.