Skip to content

Commit 496ac08

Browse files
committed
Fixes for tests
Signed-off-by: Marcin Kuszczak <[email protected]>
1 parent 04114b4 commit 496ac08

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/main/kotlin/io/github/kscripting/kscript/creator/JarArtifactCreator.kt

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,9 @@ data class JarArtifact(val path: OsPath, val execClassName: String)
1111
class JarArtifactCreator(private val executor: Executor) {
1212

1313
fun create(basePath: OsPath, script: Script, resolvedDependencies: Set<OsPath>): JarArtifact {
14-
// Capitalize first letter and get rid of dashes (since this is what kotlin compiler is doing for the wrapper to create a valid java class name)
15-
// For valid characters see https://stackoverflow.com/questions/4814040/allowed-characters-in-filename
16-
val className =
17-
script.scriptLocation.scriptName.replace("[^A-Za-z0-9]".toRegex(), "_").replaceFirstChar { it.titlecase() }
18-
// also make sure that it is a valid identifier by avoiding an initial digit (to stay in sync with what the kotlin script compiler will do as well)
19-
.let { if ("^[0-9]".toRegex().containsMatchIn(it)) "_$it" else it }
20-
21-
// Define the entrypoint for the scriptlet jar
2214
val execClassName = "${script.entryPoint.value}Kt"
23-
24-
2515
val jarFile = basePath.resolve("scriplet.jar")
26-
val scriptFile = basePath.resolve("$className.kt")
16+
val scriptFile = basePath.resolve("Scriplet.kt")
2717
val execClassNameFile = basePath.resolve("scripletExecClassName.txt")
2818

2919
execClassNameFile.writeText(execClassName)

src/main/kotlin/io/github/kscripting/kscript/resolver/ScriptResolver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class ScriptResolver(
158158
resolutionContext.scriptNodes.add(scriptNode)
159159

160160
resolutionContext.packageName = resolutionContext.packageName ?: PackageName("kscript.scriplet")
161-
resolutionContext.entryPoint = resolutionContext.entryPoint ?: Entry("${resolutionContext.packageName!!.value}.${scriptLocation.scriptName}")
161+
resolutionContext.entryPoint = resolutionContext.entryPoint ?: Entry("${resolutionContext.packageName!!.value}.Scriplet")
162162

163163
val code = ScriptUtils.resolveCode(resolutionContext.packageName, resolutionContext.importNames, scriptNode)
164164

0 commit comments

Comments
 (0)