How can I configure this setting with Gradle Kotli...
# getting-started
n
How can I configure this setting with Gradle Kotlin DSL?
Copy code
// Groovy config
atomicfu {
  dependenciesVersion = '0.19.0'
}
Content assist does not work in the
build.gradle.kts
file... The related parts extracted from the build file:
Copy code
plugins {
    kotlin("jvm") version "1.8.0"
    id("org.jetbrains.kotlin.plugin.atomicfu") version "1.8.0"
}

dependencies {
    implementation("org.jetbrains.kotlinx:atomicfu:0.19.0") // <<< Is this necessary?
}

// <<< This does not work, how can I set it?
atomicfu {
  dependenciesVersion = "0.19.0"
}
Thanks.
e
you have only applied the new compiler plugin, but you haven't applied the kotlinx-atomicfu plugin that sets things up
it's a bit annoying to use because it's not published like the usual gradle plugin, but
Copy code
// settings.gradle.kts
pluginManagement {
    repositories {
        mavenCentral()
    }

    plugins {
        resolutionStrategy {
            eachPlugin {
                if (requested.id.id == "kotlinx-atomicfu") useModule("org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}")
            }
        }
    }
}
Copy code
// build.gradle.kts
plugins {
    id("kotlinx-atomicfu") version "0.19.0"
}
should do it
😮 1
🙏 1
you don't need to add the dependency manually nor set the dependency version, it'll default to using the artifact matching the plugin version 0.19.0
👍🏻 1
a
Just asking, why do I have to apply the atomicfu gradle plugin?? is the dependncy itself not enough?? I don't get errors compiling with the library alone
e
the dependency alone is not enough, no. the plugin changes the bytecode generated so that it is actually atomic
a
Thanks