Hey. I am trying to add arrow-meta to my project, ...
# arrow-meta
k
Hey. I am trying to add arrow-meta to my project, but the existing instruction is a bit unclear (I also use kotlin for gradle script). Looking at https://meta.arrow-kt.io/setup.html the link to gradle is dead for example and so on. Is there any up-to-date guide? 🙂
r
I did it yesterday. This is build file for plugin itself (subproject
my-plugin
):
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.nio.file.Paths

plugins {
    kotlin("jvm")
    kotlin("kapt")
}


tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "11"
}

val arrow_version = "0.11.0"
dependencies {
    implementation("io.arrow-kt:arrow-core:$arrow_version")
    implementation("io.arrow-kt:arrow-syntax:$arrow_version")
    kapt("io.arrow-kt:arrow-meta:$arrow_version")

    compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10")
    compileOnly("io.arrow-kt:compiler-plugin:1.4.10-SNAPSHOT")
}

val jar by tasks.getting(Jar::class) {
    from (
        zipTree(sourceSets.main.get().compileClasspath.first {
            Paths.get("arrow-kt","compiler-plugin").toString() in it.absolutePath
        })
    ) {
        exclude("META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar")
    }
}
And this is how to use it (subproject
in-use
):
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.nio.file.Paths

plugins {
    kotlin("jvm")
}


tasks.withType<KotlinCompile>() {
    kotlinOptions.jvmTarget = "11"
    kotlinOptions.freeCompilerArgs = listOf("-Xplugin=${rootDir}/my-plugin/build/libs/my-plugin.jar")
}

val arrow_version = "0.11.0"
dependencies {
    compileOnly("io.arrow-kt:arrow-annotations:0.11.0")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
    this.dependsOn(":my-plugin:assemble")
}
And in project root:
Copy code
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.nio.file.Paths

plugins {
    kotlin("jvm") version "1.4.10"
    kotlin("kapt") version "1.4.10"
}

//buildscript {
//    repositories {
//        maven("<https://oss.jfrog.org/artifactory/oss-snapshot-local/>")
//    }
//    dependencies {
//        classpath("io.arrow-kt:gradle-plugin:1.4.10-SNAPSHOT")
//    }
//}
//
//apply(plugin = "io.arrow-kt.arrow")


group = "me.radekm"
version = "1.0-SNAPSHOT"

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        maven(url = "<https://dl.bintray.com/arrow-kt/arrow-kt/>")
        maven("<https://oss.jfrog.org/artifactory/oss-snapshot-local/>")
    }
}
k
Thanks, I'll take a look