Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. // Assuming Kotlin plugin is applied...
  2.  
  3. // Run as: ./gradlew kotlinRepl --console plain --no-daemon
  4. val kotlinRepl by tasks.creating {
  5. dependsOn("assemble")
  6. doFirst {
  7. val buildscriptClasspath = rootProject.buildscript.configurations["classpath"]
  8.  
  9. val embeddedableCompiler = buildscriptClasspath
  10. .resolvedConfiguration
  11. .resolvedArtifacts
  12. .first { it.name == "kotlin-compiler-embeddable" }
  13. val jarLocation = embeddedableCompiler.file
  14.  
  15. val mainClasspath = java.sourceSets["main"].runtimeClasspath.joinToString(separator = ":")
  16. javaexec {
  17. classpath = files(jarLocation)
  18. main = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
  19. standardInput = System.`in`
  20. args("-cp", mainClasspath)
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement