SpongePowered / SpongeGradle

Handy gradle utilities for the various gradle projects of SpongePowered
MIT License
21 stars 16 forks source link

Plugin metadata incomplete with kotlin #11

Closed mattmess1221 closed 2 years ago

mattmess1221 commented 7 years ago

I have a plugin using kotlin, but the generated mcmod.info is not complete. It only has name, modid, version, and description.

The plugin I'm building is here. https://github.com/killjoy1221/NoClip

Zidane commented 7 years ago

This should be re-opened on the API as it is handling the generation of the mcmod.info.

mattmess1221 commented 7 years ago

The api works fine. The file kapt generates is in /build/tmp/kapt3/classes/main and is what I expect it to do.

On Tue, Jul 25, 2017, 5:18 PM Chris Sanders notifications@github.com wrote:

Closed #11 https://github.com/SpongePowered/SpongeGradle/issues/11.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SpongePowered/SpongeGradle/issues/11#event-1178826203, or mute the thread https://github.com/notifications/unsubscribe-auth/ADQIKtOy1YetymccDDNG1HNNdqAuxrJyks5sRlulgaJpZM4OjEwK .

Zidane commented 7 years ago

@kashike

See above.

kashike commented 7 years ago

@killjoy1221 After looking at this a bit more, I'm not sure if there's a real good way to handle this. If you've got a suggestion, feel free to give it - or send a pull request, if you like.

Relevant:

mattmess1221 commented 7 years ago

It was caused by kapt itself actually. I was told that I needed the kotlin-kapt plugin in order for the annotation processor to work, but it was a lie. Annotation processing works just fine with just the kotlin plugin.

Additionally, it looks like compileJava takes care kotlin files as well.

mattmess1221 commented 7 years ago

Actually, that seemed to be a fluke. I got it to work by adding these lines to my buildscript.

compileKotlin.dependsOn generateMetadata
kapt {
    processors += 'org.spongepowered.plugin.processor.PluginProcessor'
    arguments {
        arg 'extraMetadataFiles', generateMetadata.target
        arg 'metadataOutputFile', generateMetadata.target
    }
}
afterEvaluate { tasks.kaptKotlin.outputs.upToDateWhen { false } }

For some reason, I think the kaptKotlin task is created in afterEvaluate.

Aaron1011 commented 6 years ago

Can we re-open this? It's still an issue when trying to use SpongeAPI with Kotlin

kashike commented 6 years ago

Pull requests are welcome.

zml2008 commented 2 years ago

This issue is no longer applicable to SpongeGradle 2.0.0+