@@ -7,6 +7,7 @@ import io.github.kscripting.kscript.model.OsConfig
77import io.github.kscripting.shell.model.OsPath
88import io.github.kscripting.shell.model.OsType
99import io.github.kscripting.shell.model.toNativeOsPath
10+ import java.io.File // ADDED IMPORT
1011
1112class CommandResolver (val osConfig : OsConfig ) {
1213 private val classPathSeparator =
@@ -49,9 +50,23 @@ class CommandResolver(val osConfig: OsConfig) {
4950 val compilerOptsStr = resolveCompilerOpts(compilerOpts)
5051 val classpath = resolveClasspath(dependencies)
5152 val jarFile = resolveJarFile(jar)
52- val files = resolveFiles(filePaths)
53+ val files = resolveFiles(filePaths) // This 'files' variable contains the paths to the script(s) to be compiled
5354 val kotlinc = resolveKotlinBinary(" kotlinc" )
5455
56+ // START OF MODIFICATION: Print content of files to be compiled
57+ filePaths.forEach { osPath ->
58+ try {
59+ val actualFilePath = osPath.toNativeOsPath().stringPath()
60+ val content = File (actualFilePath).readText(Charsets .UTF_8 ) // Use actualFilePath
61+ println (" KOTLINC_INPUT_CODE_START " )
62+ println (content)
63+ println (" KOTLINC_INPUT_CODE_END " )
64+ } catch (e: Exception ) {
65+ println (" KOTLINC_INPUT_CODE_ERROR Failed to read content of $osPath : ${e.message} " )
66+ }
67+ }
68+ // END OF MODIFICATION
69+
5570 return " $kotlinc $compilerOptsStr $classpath -d $jarFile $files "
5671 }
5772
0 commit comments