mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Refactor.
This commit is contained in:
parent
1b065c8d50
commit
aaf5e4826b
1 changed files with 6 additions and 6 deletions
|
@ -90,17 +90,17 @@ class KotlinCompiler @Inject constructor(
|
||||||
log(2, "Calling kotlinc " + allArgs.joinToString(" "))
|
log(2, "Calling kotlinc " + allArgs.joinToString(" "))
|
||||||
val result : TaskResult =
|
val result : TaskResult =
|
||||||
if (true) {
|
if (true) {
|
||||||
val compilerJar = listOf(kotlinJarFiles.compiler.toURI().toURL())
|
|
||||||
|
|
||||||
val classLoader = ParentLastClassLoader(compilerJar)
|
|
||||||
val compiler = classLoader.loadClass("org.jetbrains.kotlin.cli.common.CLICompiler")
|
|
||||||
val kCompiler = classLoader.loadClass("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// In order to capture the error stream, I need to invoke CLICompiler.exec(), which
|
// In order to capture the error stream, I need to invoke CLICompiler.exec(), which
|
||||||
// is the first method that accepts a PrintStream for the errors in parameter
|
// is the first method that accepts a PrintStream for the errors in parameter
|
||||||
//
|
//
|
||||||
ByteArrayOutputStream().use { baos ->
|
ByteArrayOutputStream().use { baos ->
|
||||||
|
val compilerJar = listOf(kotlinJarFiles.compiler.toURI().toURL())
|
||||||
|
|
||||||
|
val classLoader = ParentLastClassLoader(compilerJar)
|
||||||
|
val compiler = classLoader.loadClass("org.jetbrains.kotlin.cli.common.CLICompiler")
|
||||||
|
val kCompiler = classLoader.loadClass("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
|
||||||
|
|
||||||
PrintStream(baos).use { ps ->
|
PrintStream(baos).use { ps ->
|
||||||
val execMethod = compiler.declaredMethods.filter {
|
val execMethod = compiler.declaredMethods.filter {
|
||||||
it.name == "exec" && it.parameterTypes.size == 2
|
it.name == "exec" && it.parameterTypes.size == 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue