Ahmed Mourad
09/13/2020, 3:59 PMconst
property of a companion object at compile time?raulraja
09/13/2020, 5:50 PMAhmed Mourad
09/13/2020, 6:19 PMAhmed Mourad
09/13/2020, 6:19 PMconstraints
property during code generation.
Where should I look?raulraja
09/13/2020, 7:04 PMraulraja
09/13/2020, 7:05 PMraulraja
09/13/2020, 7:06 PMraulraja
09/13/2020, 7:08 PMraulraja
09/13/2020, 7:09 PMAhmed Mourad
09/13/2020, 7:12 PMAhmed Mourad
09/16/2020, 6:23 AMeval
to work:
When I try this:
val script = "println(\"X\")"
try {
eval(script)
} catch (e: ScriptException) {
messageCollector?.report(
CompilerMessageSeverity.ERROR,
"$e",
null
)
}
It always fails:
javax.script.ScriptException: error: cannot access script base class 'org.jetbrains.kotlin.script.jsr223.KotlinStandardJsr223ScriptTemplate'. Check your module classpath for missing or conflicting dependencies
I tried adding different dependencies to the plugin, but none seem to work:
implementation(kotlin("scripting-jsr223"))
implementation(kotlin("script-util"))
implementation(kotlin("script-runtime"))
raulraja
09/16/2020, 10:15 AMraulraja
09/16/2020, 10:15 AMraulraja
09/16/2020, 10:17 AMraulraja
09/16/2020, 10:18 AMraulraja
09/16/2020, 10:18 AMAhmed Mourad
09/16/2020, 1:52 PMraulraja
09/16/2020, 3:41 PMe: javax.script.ScriptException: error: cannot access script base class 'org.jetbrains.kotlin.script.jsr223.KotlinStandardJsr223ScriptTemplate'. Check your module classpath for missing or conflicting dependencies
raulraja
09/16/2020, 3:53 PMimplementation("org.jetbrains.kotlin:kotlin-script-util:$kotlinVersion") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
exclude("org.jetbrains.kotlin", "kotlin-compiler")
exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable")
}
raulraja
09/16/2020, 3:54 PMAhmed Mourad
09/16/2020, 5:57 PMraulraja
09/16/2020, 8:59 PMkotlinCompilerClass
shows this regardless of exclusion:
Could not find or load main class org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
raulraja
09/16/2020, 9:02 PMAhmed Mourad
09/17/2020, 3:25 AMkotlinCompilerClass
I get the:
Could not find or load main class org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
error regardless of whether I call eval
or not.Rachel
09/17/2020, 5:43 PMAhmed Mourad
09/17/2020, 11:44 PMjava.lang.NoClassDefFoundError: org/jetbrains/kotlin/script/jsr223/KotlinJsr223JvmLocalScriptEngineFactory
I tried adding these deps:
implementation(kotlin("scripting-jsr223"))
implementation(kotlin("script-runtime"))
implementation("org.jetbrains.kotlin:kotlin-script-util:$kotlinVersion") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
exclude("org.jetbrains.kotlin", "kotlin-compiler")
exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable")
}
But it made no difference.
These are the changes from the previous version:
https://github.com/AhmedMourad0/compiler_plugin_eval_srp/commit/dba18c44e0771c011ec2b40ece2d2df546b596bdRachel
09/18/2020, 10:48 AMRachel
09/18/2020, 10:49 AMimplementation
adds the dependencies in compileClasspath
instead of kotlinCompilerClasspath
Rachel
09/18/2020, 10:49 AMRachel
09/18/2020, 10:49 AMkotlinCompilerClasspath("org.jetbrains.kotlin:kotlin-script-util:1.3.61") {
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
exclude("org.jetbrains.kotlin", "kotlin-compiler")
exclude("org.jetbrains.kotlin", "kotlin-compiler-embeddable")
}
kotlinCompilerClasspath("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.61")
kotlinCompilerClasspath("org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.61")
Rachel
09/18/2020, 10:49 AMRachel
09/18/2020, 10:49 AMRachel
09/18/2020, 10:49 AMAhmed Mourad
09/18/2020, 11:06 AMRachel
09/18/2020, 11:07 AMRachel
09/18/2020, 11:07 AMsample
module instead of plugin
moduleRachel
09/18/2020, 11:20 AMAhmed Mourad
09/18/2020, 11:26 AMAhmed Mourad
09/18/2020, 11:30 AManalysisCompleted
block is never executed.Rachel
09/18/2020, 11:41 AMRachel
09/18/2020, 11:41 AMmessageCollector?.report(CompilerMessageSeverity.WARNING, eval("2 + 3").toString(), null)
Rachel
09/18/2020, 11:41 AMtry
section, you'll see something like:Rachel
09/18/2020, 11:41 AM> Task :sample:compileKotlin
w: 5
Rachel
09/18/2020, 11:42 AManalysisCompleted
block is executed during compilationAhmed Mourad
09/18/2020, 11:48 AM