Skip to content
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

Apply kotlinx-atomicfu plugin by id #443

Merged
merged 5 commits into from
Jun 27, 2024
Merged

Conversation

mvicsokolova
Copy link
Collaborator

@mvicsokolova mvicsokolova commented Jun 21, 2024

Fixes #56

@mvicsokolova mvicsokolova changed the title WIP: publish the Gradle plugin Apply kotlinx-atomicfu plugin by id Jun 24, 2024
@mvicsokolova mvicsokolova marked this pull request as ready for review June 24, 2024 10:43
}

// NOTE: `kotlinx-atomicfu.properties` file appears in the artifact twice, when publishing kotlin-atomicfu plugin using gradlePlugin{} block above
tasks.withType<Copy>().named("processResources") {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, if this is the best way to resolve the duplicate conflict 🤔:

Execution failed for task ':atomicfu-gradle-plugin:processResources'.
> Entry META-INF/gradle-plugins/kotlinx-atomicfu.properties is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/8.7/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.gradle.org/current/userguide/java_gradle_plugin.html#ex-using-the-gradleplugin-block
Check the text below the example.
You should be able to delete the /atomicfu-gradle-plugin/src/main/resources/META-INF directory instead. As the gradlePlugin block is creating the files itself.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, cool, thank you! That solves the problem)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's usually a good idea not to apply Kotlin/JVM in Gradle plugins. Try this instead:

plugins {
//    id("kotlin-jvm-conventions")
    id("java-gradle-plugin")
    id("publish-conventions")
    id("common-conventions")
    id("kotlin-base-conventions")
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkrasnoff We could look at making this neater as part of #421, e.g. create a kotlin-gradle-plugin convention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, without kotlin("jvm") I get an error: Extension of type 'KotlinProjectExtension' does not exist.
And because of that I can not apply kotlin-base-conventions plugin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yes, that makes sense. So yes, remove kotlin-base-conventions from the Atomicfu Gradle Plugin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc kotlin-base-conventions has been reworked in @dkrasnoff's branch.

@mvicsokolova mvicsokolova merged commit dc1c5f5 into develop Jun 27, 2024
@dkrasnoff dkrasnoff deleted the publish-gradle-plugin branch July 3, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants