https://kotlinlang.org logo
#arrow-meta
Title
# arrow-meta
n

Nathan Bedell

12/08/2021, 11:53 PM
Hey all. I've finally got my first arrow-meta plugin to the point where I'm ready to depend on it in other projects. I've tried to copy the structure of the plugins in the
arrow-meta
repo in order to setup a gradle plugin for loading my arrow-meta plugin, and I can build a jar for the gradle plugin fine -- but I'm not entirely sure how to test the result. Usually for a library I'd use
publishToMavenLocal
, and then use
mavenLocal()
as a repository in some other project to make sure the maven config is working properly. Is it possible to do the same for a gradle plugin? How would I set up maven to publish a gradle plugin? I tried skimming through the gradle files in the
arrow-meta
repo to see what would be of help, but no luck so far. Can someone point me in the right direction?
r

raulraja

12/09/2021, 9:05 AM
Hi @Nathan Bedell, you can test the plugin either applying the gradle plugin or applying the compiler plugin to the compilation config free compiler args. without gradle : https://github.com/arrow-kt/arrow-meta/blob/main/plugins/analysis/example/build.gradle.kts#L37-L44 with gradle: (outdated plugins) but config is the same https://github.com/arrow-kt/arrow-meta-examples/blob/main/demos/refined-types-compiler-plugin-demo/build.gradle#L17-L34
n

Nathan Bedell

12/09/2021, 2:41 PM
Hi @raulraja. I think this answers my question as to how to use my plugin -- something like:
Copy code
buildscript {
    repositories {
        mavenLocal()
    }
    dependencies {
        classpath "io.github.sintrastes:buildable-kt-gradle-plugin:0.1"
    }
}

...

apply plugin: "io.sintrastes.buildable-kt"
And it looks like now after setting up the right maven publish config, I can get most of the way there -- but I'm running into an issue:
Copy code
java.lang.NullPointerException: inStream parameter is null
        at arrow.meta.plugin.gradle.ArrowMetaGradlePlugin.apply(ArrowMetaGradlePlugin.kt:19)
It seems like it can't find my
plugin.properties
file for some reason, and I'm not sure why. Source: https://github.com/Sintrastes/buildable-kt/blob/main/libs/gradle-plugin-commons/src/main/kotlin/arrow/meta/plugin/gradle/ArrowMetaGradlePlugin.kt I took this from the arrow-meta repo to try and get my plugin working with a gradle plugin -- but as I look now at this file in the arrow-meta repo today, I see that it has already changed a bit. Maybe for now it would better for me to just release my plugin jar, and have users manually add the compiler plugin rather than applying the gradle plugin.
r

raulraja

12/09/2021, 3:14 PM
Do you have that properties file on your plugin file like other plugins in the arrow meta repo do?
n

Nathan Bedell

12/09/2021, 11:03 PM
I believe so. It's possible that it's named incorrectly maybe.