raulraja
01/06/2018, 9:31 PM// Assuming Kotlin plugin is applied...
// Run as: ./gradlew kotlinRepl --console plain --no-daemon
val kotlinRepl by tasks.creating {
dependsOn("assemble")
doFirst {
val buildscriptClasspath = rootProject.buildscript.configurations["classpath"]
val embeddedableCompiler = buildscriptClasspath
.resolvedConfiguration
.resolvedArtifacts
.first { it.name == "kotlin-compiler-embeddable" }
val jarLocation = embeddedableCompiler.file
val mainClasspath = java.sourceSets["main"].runtimeClasspath.joinToString(separator = ":")
javaexec {
classpath = files(jarLocation)
main = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
standardInput = System.`in`
args("-cp", mainClasspath)
}
}
}
but when It attempts to compile it, it bails with:
Caused by: org.gradle.cache.CacheOpenException: Could not open cache directory 1w2yoljzkhbi9mrklhbh5ttcm (/home/raulraja/.gradle/caches/4.4.1/gradle-kotlin-dsl/1w2yoljzkhbi9mrklhbh5ttcm)
no other useful information.
Any ideas of what I must be doing wrong? other kotlin scripts for example the one I have for detekt works fine.mkobit
01/08/2018, 12:30 AMraulraja
01/08/2018, 1:26 AM--stacktrace
that I can tell from the output