Skip to content

Commit

Permalink
utils: Use the new kotlin-scripting-jsr223-embeddable
Browse files Browse the repository at this point in the history
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 26, 2019
1 parent 91e3a00 commit 6160f36
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 25 deletions.
3 changes: 0 additions & 3 deletions evaluator/src/main/kotlin/Evaluator.kt
Expand Up @@ -36,9 +36,6 @@ class Evaluator(ortResult: OrtResult) : ScriptRunner() {
import java.util.*
// Input:
val ortResult = bindings["ortResult"] as OrtResult
// Output:
val ruleViolations = mutableListOf<RuleViolation>()
Expand Down
5 changes: 0 additions & 5 deletions reporter/src/main/kotlin/reporters/NoticeReporter.kt
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions utils/build.gradle.kts
Expand Up @@ -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")
}
13 changes: 0 additions & 13 deletions utils/src/main/kotlin/ScriptRunner.kt
Expand Up @@ -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.
*/
Expand All @@ -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

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

0 comments on commit 6160f36

Please sign in to comment.