Skip to content
Permalink
Browse files

utils: Use the new kotlin-scripting-jsr223-embeddable

This supports direct access to bound variables. For details see
https://youtrack.jetbrains.com/issue/KT-15125.

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch-si.com>
  • Loading branch information...
sschuberth committed Aug 23, 2019
1 parent 91e3a00 commit 6160f36f97df29797e27daa2c043e79f568ded01
@@ -36,9 +36,6 @@ class Evaluator(ortResult: OrtResult) : ScriptRunner() {
import java.util.*
// Input:
val ortResult = bindings["ortResult"] as OrtResult
// Output:
val ruleViolations = mutableListOf<RuleViolation>()
@@ -54,11 +54,6 @@ class NoticeReporter : Reporter() {
import java.util.*
// Input:
val ortResult = bindings["ortResult"] as OrtResult
val noticeReport = bindings["noticeReport"] as NoticeReport
val copyrightGarbage = bindings["copyrightGarbage"] as CopyrightGarbage
var headers = noticeReport.headers
var findings = noticeReport.findings
var footers = noticeReport.footers
@@ -25,7 +25,5 @@ dependencies {
implementation("commons-codec:commons-codec:$commonsCodecVersion")
implementation("org.apache.commons:commons-compress:$commonsCompressVersion")
implementation("org.tukaani:xz:$xzVersion")
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
implementation("org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable")
implementation("org.jetbrains.kotlin:kotlin-script-util")
implementation("org.jetbrains.kotlin:kotlin-scripting-jsr223-embeddable")
}
@@ -24,8 +24,6 @@ import javax.script.ScriptEngine
import javax.script.ScriptEngineManager
import javax.script.ScriptException

import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback

/**
* A class providing the framework to run Kotlin scripts.
*/
@@ -45,17 +43,6 @@ abstract class ScriptRunner {
*/
abstract val postface: String

init {
// This is required to avoid
//
// WARN: Failed to initialize native filesystem for Windows
// java.lang.RuntimeException: Could not find installation home path. Please make sure bin/idea.properties
// is present in the installation directory.
//
// on Windows for some reason.
setIdeaIoUseFallback()
}

private fun completeScript(script: String) = preface + script + postface

/**
@@ -1 +1 @@
org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory
kotlin.script.experimental.jsr223.KotlinJsr223DefaultScriptEngineFactory

0 comments on commit 6160f36

Please sign in to comment.
You can’t perform that action at this time.