Skip to content

Commit 6acd4e1

Browse files
authored
Kscript 4.2.3 (#410)
Compatibility with Kotlin 1.9.x --------- Signed-off-by: Marcin Kuszczak <1508798+aartiPl@users.noreply.github.com>
1 parent 1c97c21 commit 6acd4e1

File tree

6 files changed

+33
-17
lines changed

6 files changed

+33
-17
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
version: 1.7.21
4343

4444
- name: Setup Gradle
45-
uses: gradle/gradle-build-action@v2
45+
uses: gradle/gradle-build-action@v2.4.2
4646
with:
4747
gradle-version: 8.0.2
4848

NEWS.adoc

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
= Changes
22

3+
== [4.2.3] - 2023-07-22
4+
5+
=== Fixed
6+
7+
* Compatibility with Kotlin 1.9.0
8+
39
== [4.2.2] - 2023-04-29
410

511
=== Added

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repositories {
2727
}
2828

2929
group = "io.github.kscripting"
30-
version = "4.2.2"
30+
version = "4.2.3"
3131

3232
buildConfig {
3333
packageName(project.group.toString() + "." + project.name)

src/main/kotlin/io/github/kscripting/kscript/code/Templates.kt

+12-12
Original file line numberDiff line numberDiff line change
@@ -104,24 +104,24 @@ object Templates {
104104

105105

106106
fun createUsageInfo(selfName: String) =
107-
"""|Usage:
108-
| $selfName [options] <script> [<script_args>]...
109-
| $selfName --clear-cache [--development]
110-
| $selfName (--help | --version) [--development]""".trimMargin()
107+
"""|Usage:
108+
| $selfName [options] <script> [<script_args>]...
109+
| $selfName --clear-cache [--development]
110+
| $selfName (--help | --version) [--development]""".trimMargin()
111111

112112

113113
fun createFooterInfo() =
114-
"""|
115-
|Copyright : 2022 Holger Brandl, Marcin Kuszczak
116-
|Website : https://github.com/kscripting/kscript
117-
|License : MIT""".trimMargin()
114+
"""|
115+
|Copyright : 2023 Holger Brandl, Marcin Kuszczak
116+
|Website : https://github.com/kscripting/kscript
117+
|License : MIT""".trimMargin()
118118

119119
fun createVersionInfo(
120120
buildDateTime: ZonedDateTime, version: String, newVersion: String, kotlinVersion: String, jreVersion: String
121121
): String =
122122
"""|Version : $version ${if (newVersion.isNotBlank()) "(new version v$newVersion is available)" else ""}
123-
|Build : $buildDateTime
124-
|Kotlin : $kotlinVersion
125-
|Java : $jreVersion
126-
|""".trimMargin().trim()
123+
|Build : $buildDateTime
124+
|Kotlin : $kotlinVersion
125+
|Java : $jreVersion
126+
|""".trimMargin().trim()
127127
}

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

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package io.github.kscripting.kscript.creator
22

33
import io.github.kscripting.kscript.code.Templates
4+
import io.github.kscripting.kscript.model.CompilerOpt
45
import io.github.kscripting.kscript.model.Script
56
import io.github.kscripting.kscript.util.Executor
67
import io.github.kscripting.kscript.util.FileUtils
7-
import io.github.kscripting.shell.model.*
8+
import io.github.kscripting.shell.model.OsPath
9+
import io.github.kscripting.shell.model.ScriptType
10+
import io.github.kscripting.shell.model.writeText
811

912
data class JarArtifact(val path: OsPath, val execClassName: String)
1013

@@ -44,7 +47,14 @@ class JarArtifactCreator(private val executor: Executor) {
4447
filesToCompile.add(wrapper)
4548
}
4649

47-
executor.compileKotlin(jarFile, resolvedDependencies, filesToCompile, script.compilerOpts)
50+
executor.compileKotlin(
51+
jarFile,
52+
resolvedDependencies,
53+
filesToCompile,
54+
script.compilerOpts +
55+
// This options allows to work with Kotlin 1.9.x, where scripts in source roots are ignored
56+
CompilerOpt("-Xallow-any-scripts-in-source-roots")
57+
)
4858

4959
return JarArtifact(jarFile, execClassName)
5060
}

src/test/kotlin/io/github/kscripting/kscript/resolver/ScriptResolverTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,5 +163,5 @@ class ScriptResolverTest {
163163
}
164164
}
165165

166-
private fun String.discardEmptyLines(): String = this.lines().filterNot { it.isEmpty() }.joinToString("\n")
166+
private fun String.discardEmptyLines(): String = this.lines().filterNot { it.isBlank() }.joinToString("\n")
167167
}

0 commit comments

Comments
 (0)