Publish Gradle plugin to https://plugins.gradle.org
Gradle plugin repository https://plugins.gradle.org allows using the new plugin DSL in Gradle without any additional configuration, e.g.
plugins {
id("the plugin id") version "1.2.3"
}
Right now we may only use the older buildscript{..} approach
when would we published to the Gradle Plugin Portal? I'd really like the simplified plugin grammar
add this to your setting.gradle(.kts)
pluginManagement {
repositories {
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
val module = when(requested.id.id) {
"kotlinx-atomicfu" -> "org.jetbrains.kotlinx:atomicfu-gradle-plugin:${requested.version}"
else -> null
}
if(module != null) {
useModule(module)
}
}
}
}
it can bridge it .. but having it published properly as a gradle plugin would make this easier to use and integrate better with version management plguins like refresVersions
https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html
@NikkyAI do we still need to do it? I've just added the plugin via id("kotlinx-atomicfu") then updated the buildscript block with:
buildscript {
dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.20.0")
}
}
and everything seems to work, although I cannot find the kotlin-atomicfu plugin on the Gradle Plugin Portal, but there's org.jetbrains.kotlin.plugin.atomicfu with the latest version of 1.8.20-RC
UPDATE
It works if I add the plugin to the subproject, but fails if I do it in the top level build.gradle
well this is what we needed.. https://plugins.gradle.org/plugin/org.jetbrains.kotlin.plugin.atomicfu
maybe update the README to show how to apply the plugin ?
then this issue can be closed as far as i am concerned...
Any potential error or naming with the new not-in-readme plugin?
Trying to use the plugin dsl
plugins {
id("org.jetbrains.kotlin.plugin.atomicfu") version "1.8.20"
}
The plugin resolved but
import kotlinx.atomicfu.atomic
would have a Unresolved reference: atomicfu Error and upon checking External Libraries I couldn't find any relating to atomicfu
When I switch back to the legacy plugin
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.20.1")
}
}
apply(plugin = "kotlinx-atomicfu")
The org.jetbrains.kotlinx:atomicfu-jvm:0.20.1 would show up and correctly added.
It seems org.jetbrains.kotlin.plugin.atomicfu is not a new publication but a new plugin. The experimental one or a replacement for currently mentioned in the documentation. I'd actually prefer to try it instead of current stable. Does anyone know what is its status and is it even working?
It seems
org.jetbrains.kotlin.plugin.atomicfuis not a new publication but a new plugin. Does anyone know what is its status and is it even working?
I am applying it in my settings.gradle:
id 'org.jetbrains.kotlin.plugin.atomicfu' version '1.9.22' apply false
And when I apply it in a non-root project:
plugins {
id 'org.jetbrains.kotlin.multiplatform'
id 'org.jetbrains.kotlin.plugin.atomicfu'
}
nothing at all happens so far as I can tell.