kotlinx-atomicfu icon indicating copy to clipboard operation
kotlinx-atomicfu copied to clipboard

Publish Gradle plugin to https://plugins.gradle.org

Open jonnyzzz opened this issue 6 years ago • 7 comments

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

jonnyzzz avatar Feb 17 '19 21:02 jonnyzzz

when would we published to the Gradle Plugin Portal? I'd really like the simplified plugin grammar

revintec avatar Sep 30 '21 04:09 revintec

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 avatar Oct 01 '21 10:10 NikkyAI

@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

volo-droid avatar Mar 22 '23 15:03 volo-droid

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...

NikkyAI avatar Mar 24 '23 09:03 NikkyAI

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.

evilcat-x avatar Apr 06 '23 00:04 evilcat-x

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?

vdshb avatar Oct 29 '23 11:10 vdshb

It seems org.jetbrains.kotlin.plugin.atomicfu is 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.

nedtwigg avatar Feb 05 '24 05:02 nedtwigg