Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 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)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement