11package io.github.kscripting.kscript.creator
22
3- import io.github.kscripting.kscript.code.Templates
43import io.github.kscripting.kscript.model.Script
54import io.github.kscripting.kscript.util.Executor
65import io.github.kscripting.kscript.util.FileUtils
7- import io.github.kscripting.shell.model.*
6+ import io.github.kscripting.shell.model.OsPath
7+ import io.github.kscripting.shell.model.writeText
88
99data class JarArtifact (val path : OsPath , val execClassName : String )
1010
@@ -19,14 +19,11 @@ class JarArtifactCreator(private val executor: Executor) {
1919 .let { if (" ^[0-9]" .toRegex().containsMatchIn(it)) " _$it " else it }
2020
2121 // Define the entrypoint for the scriptlet jar
22- val execClassName = if (script.scriptLocation.scriptType == ScriptType .KTS ) {
23- " Main_${className} "
24- } else {
25- """ ${script.packageName.value} .${script.entryPoint?.value ? : " ${className} Kt" } """
26- }
22+ val execClassName = " ${script.entryPoint.value} Kt"
23+
2724
2825 val jarFile = basePath.resolve(" scriplet.jar" )
29- val scriptFile = basePath.resolve(className + script.scriptLocation.scriptType.extension )
26+ val scriptFile = basePath.resolve(" $ className.kt " )
3027 val execClassNameFile = basePath.resolve(" scripletExecClassName.txt" )
3128
3229 execClassNameFile.writeText(execClassName)
@@ -36,14 +33,6 @@ class JarArtifactCreator(private val executor: Executor) {
3633 val filesToCompile = mutableSetOf<OsPath >()
3734 filesToCompile.add(scriptFile)
3835
39- // create main-wrapper for kts scripts
40- if (script.scriptLocation.scriptType == ScriptType .KTS ) {
41- val wrapper = FileUtils .createFile(
42- basePath.resolve(" $execClassName .kt" ), Templates .createWrapperForScript(script.packageName, className)
43- )
44- filesToCompile.add(wrapper)
45- }
46-
4736 executor.compileKotlin(jarFile, resolvedDependencies, filesToCompile, script.compilerOpts)
4837
4938 return JarArtifact (jarFile, execClassName)
0 commit comments