I'm trying the new k2 compiler with the 2.0 beta v...
# k2-adopters
j
I'm trying the new k2 compiler with the 2.0 beta version. Trying to compile a .kt file with an stdlib call and it is asking for kotlin-home. Should it be asking for that when I'm using the compiler-embeddable dependency? Adding kotlin-home it works perfectly though
j
What is kotlin-home
As tl;dr I'm using embeddable compiler to compile a file with
println("Hello")
and it is failing to find stdlib
👍 1
thank you color 1
t
yes, it should ask as we are not bundling
kotlin-stdlib
inside embeddable compiler
though it is weird that only with 2.0-Beta version you started to see this
j
Is there a way to not need this, or have this home in the classpath or something?
t
Do you run
kotlinc
from command line?
j
I'm doing it from inside a kotlin application
Copy code
val arguments = K2JVMCompilerArguments().apply {
            freeArgs = listFilesToCompile(project, target).map { it.absolutePath }
            classpath = project.classPath(target)
            kotlinHome = "/path/to/kotlin"
            destination = project.folder.resolve("build").resolve(target.name.lowercase()).absolutePathString()
            disableDefaultScriptingPlugin = true
        }
val code = compiler.exec(PrintingMessageCollector(System.out, MessageRenderer.PLAIN_FULL_PATHS, true), Services.EMPTY, arguments)
Like that
t
KGP always adds
-no-stdlib
and
-no-reflect
compiler options. And passes actual stdlib via classpath
j
Actually that makes more sense, will do that!
Thanks thanks
t
I am curious - what is your use-case for invoking such way Kotlin compiler?
j
I'm playing around a custom build system with a twist on dependency management
thank you color 1
Nothing serious at the moment, but I think gradle has become way too complicated and maven is way too verbose