@@ -22,25 +22,26 @@ class CommandResolver(private val config: Config, private val script: Script) {
2222
2323 // <command_path>kotlinc -classpath "p1:p2"
2424 // OS Conversion matrix
25- // command_path command_quoting classpath_path classpath_separator classpath_quoting files_path files_quoting main_class_quoting
26- // LINUX native no native : " ?
27- // GIT-BASH shell no native ; " ?
28- // CYGWIN shell no native ; "
29- // WINDOWS native no native ; "
30- // MACOS ? ? ? ? ?
25+ // command_path command_quoting classpath_path classpath_separator classpath_quoting files_path files_quoting main_class_quoting @arg_file
26+ // LINUX native no native : " ? no
27+ // GIT-BASH shell no native ; " ? no
28+ // CYGWIN shell no native ; " no
29+ // WINDOWS native no native ; " yes
30+ // MACOS ? ? ? ? ? no
3131
3232
3333 // Path conversion (Cygwin/mingw): cygpath -u "c:\Users\Admin"; /cygdrive/c/ - Cygwin; /c/ - Mingw
3434 // uname --> CYGWIN_NT-10.0 or MINGW64_NT-10.0-19043
3535 // How to find if mingw/cyg/win (second part): https://stackoverflow.com/questions/40877323/quickly-find-if-java-was-launched-from-windows-cmd-or-cygwin-terminal
3636
3737 fun compileKotlin (jar : Path , dependencies : Set <Path >, filePaths : Set <Path >): String {
38- val compilerOptsStr = resolveCompilerOpts(script.compilerOpts)
38+ val compilerOpts = resolveCompilerOpts(script.compilerOpts)
3939 val classpath = resolveClasspath(dependencies)
40- val files = filePaths.joinToString(" " ) { " \" ${it.absolutePathString()} \" " }
40+ val jarFile = resolveJarFile(jar)
41+ val files = resolveFiles(filePaths)
4142 val kotlinc = resolveKotlinBinary(" kotlinc" )
4243
43- return " $kotlinc $compilerOptsStr $classpath -d \" ${jar.absolutePathString()} \" $files "
44+ return " $kotlinc $compilerOpts $classpath -d $jarFile $files "
4445 }
4546
4647 fun executeKotlin (jarArtifact : JarArtifact , dependencies : Set <Path >, userArgs : List <String >): String {
@@ -82,6 +83,10 @@ class CommandResolver(private val config: Config, private val script: Script) {
8283
8384 private fun resolveCompilerOpts (compilerOpts : Set <CompilerOpt >) = compilerOpts.joinToString(" " ) { it.value }
8485
86+ private fun resolveJarFile (jar : Path ): String = " '${jar.absolutePathString()} '"
87+
88+ private fun resolveFiles (filePaths : Set <Path >): String = filePaths.joinToString(" " ) { " '${it.absolutePathString()} '" }
89+
8590 private fun resolveUserArgs (userArgs : List <String >) =
8691 userArgs.joinToString(" " ) { " \" ${it.replace(" \" " , " \\\" " )} \" " }
8792
0 commit comments