@@ -9,14 +9,17 @@ import java.nio.file.Path
99import java.nio.file.Paths
1010import kotlin.io.path.absolute
1111import kotlin.io.path.absolutePathString
12+ import kotlin.io.path.div
1213
1314class CommandResolver (private val config : Config , private val script : Script ) {
1415 fun compileKotlin (jar : Path , dependencies : Set <Path >, filePaths : Set <Path >): String {
1516 val compilerOptsStr = resolveCompilerOpts(script.compilerOpts)
1617 val classpath = resolveClasspath(dependencies)
1718 val files = filePaths.joinToString(" " ) { it.absolute().toString() }
1819
19- return " kotlinc $compilerOptsStr $classpath -d '${jar.absolute()} ' $files "
20+ val kotlinc = if (config.kotlinHome != null ) (config.kotlinHome / " bin" / " kotlinc" ).toString() else " kotlinc"
21+
22+ return " $kotlinc $compilerOptsStr $classpath -d '${jar.absolute()} ' $files "
2023 }
2124
2225 fun executeKotlin (jarArtifact : JarArtifact , dependencies : Set <Path >, userArgs : List <String >): String {
@@ -33,15 +36,19 @@ class CommandResolver(private val config: Config, private val script: Script) {
3336
3437 val classpath = resolveClasspath(dependenciesSet)
3538
36- return " kotlin $kotlinOptsStr $classpath ${jarArtifact.execClassName} $userArgsStr "
39+ val kotlin = if (config.kotlinHome != null ) (config.kotlinHome / " bin" / " kotlin" ).toString() else " kotlin"
40+
41+ return " $kotlin $kotlinOptsStr $classpath ${jarArtifact.execClassName} $userArgsStr "
3742 }
3843
3944 fun interactiveKotlinRepl (dependencies : Set <Path >): String {
4045 val compilerOptsStr = resolveCompilerOpts(script.compilerOpts)
4146 val kotlinOptsStr = resolveKotlinOpts(script.kotlinOpts)
4247 val classpath = resolveClasspath(dependencies)
4348
44- return " kotlinc $compilerOptsStr $kotlinOptsStr $classpath "
49+ val kotlinc = if (config.kotlinHome != null ) (config.kotlinHome / " bin" / " kotlinc" ).toString() else " kotlinc"
50+
51+ return " $kotlinc $compilerOptsStr $kotlinOptsStr $classpath "
4552 }
4653
4754 fun executeIdea (projectPath : Path ): String {
0 commit comments