Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions connekt-scripting-host/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm")
implementation("org.jetbrains.kotlin:kotlin-scripting-jvm-host")
implementation("com.github.ajalt.clikt:clikt:5.0.1")
implementation("org.jetbrains.kotlin:kotlin-power-assert-compiler-plugin-embeddable:2.0.21")

// Implementation for slf4j to disable warning
implementation("org.slf4j:slf4j-nop:2.0.7")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package io.amplicode.connekt

import io.amplicode.connekt.dsl.ConnektBuilder
import java.io.File
import java.io.File.pathSeparator
import kotlin.script.experimental.api.*
import kotlin.script.experimental.host.ScriptingHostConfiguration
import kotlin.script.experimental.jvm.BasicJvmScriptEvaluator
Expand All @@ -25,14 +26,26 @@ class ConnektScriptingHost(
// that should be used to run the Evaluator.
private val jvmTarget = "1.8"

private val powerAssertJar by lazy {
System.getProperty("java.class.path")
.split(pathSeparator)
.map(::File)
.firstOrNull { it.name.startsWith("kotlin-power-assert-compiler-plugin-embeddable") && it.extension == "jar" }
?: error("Power-Assert plugin jar not found on classpath")
}

private val compilationConfiguration =
createJvmCompilationConfigurationFromTemplate<Connekt> {
compilerOptions(
listOf(
"use-fast-jar-file-system",
"false",
"-Xadd-modules=ALL-MODULE-PATH",
"-jvm-target=$jvmTarget"
"-jvm-target=$jvmTarget",
"-Xplugin=${powerAssertJar.absolutePath}",
"-P",
"plugin:org.jetbrains.kotlin.powerassert:function=kotlin.assert",
"plugin:org.jetbrains.kotlin.powerassert:function=kotlin.require",
)
)
}
Expand Down Expand Up @@ -109,4 +122,4 @@ private class NoopScriptEvaluator(
)
)
}
}
}