Skip to content

Commit

Permalink
Kscript 4.2.3 (#410)
Browse files Browse the repository at this point in the history
Compatibility with Kotlin 1.9.x
---------

Signed-off-by: Marcin Kuszczak <[email protected]>
  • Loading branch information
aartiPl authored Jul 22, 2023
1 parent 1c97c21 commit 6acd4e1
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
version: 1.7.21

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
with:
gradle-version: 8.0.2

Expand Down
6 changes: 6 additions & 0 deletions NEWS.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
= Changes

== [4.2.3] - 2023-07-22

=== Fixed

* Compatibility with Kotlin 1.9.0

== [4.2.2] - 2023-04-29

=== Added
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repositories {
}

group = "io.github.kscripting"
version = "4.2.2"
version = "4.2.3"

buildConfig {
packageName(project.group.toString() + "." + project.name)
Expand Down
24 changes: 12 additions & 12 deletions src/main/kotlin/io/github/kscripting/kscript/code/Templates.kt
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,24 @@ object Templates {


fun createUsageInfo(selfName: String) =
"""|Usage:
| $selfName [options] <script> [<script_args>]...
| $selfName --clear-cache [--development]
| $selfName (--help | --version) [--development]""".trimMargin()
"""|Usage:
| $selfName [options] <script> [<script_args>]...
| $selfName --clear-cache [--development]
| $selfName (--help | --version) [--development]""".trimMargin()


fun createFooterInfo() =
"""|
|Copyright : 2022 Holger Brandl, Marcin Kuszczak
|Website : https://github.com/kscripting/kscript
|License : MIT""".trimMargin()
"""|
|Copyright : 2023 Holger Brandl, Marcin Kuszczak
|Website : https://github.com/kscripting/kscript
|License : MIT""".trimMargin()

fun createVersionInfo(
buildDateTime: ZonedDateTime, version: String, newVersion: String, kotlinVersion: String, jreVersion: String
): String =
"""|Version : $version ${if (newVersion.isNotBlank()) "(new version v$newVersion is available)" else ""}
|Build : $buildDateTime
|Kotlin : $kotlinVersion
|Java : $jreVersion
|""".trimMargin().trim()
|Build : $buildDateTime
|Kotlin : $kotlinVersion
|Java : $jreVersion
|""".trimMargin().trim()
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package io.github.kscripting.kscript.creator

import io.github.kscripting.kscript.code.Templates
import io.github.kscripting.kscript.model.CompilerOpt
import io.github.kscripting.kscript.model.Script
import io.github.kscripting.kscript.util.Executor
import io.github.kscripting.kscript.util.FileUtils
import io.github.kscripting.shell.model.*
import io.github.kscripting.shell.model.OsPath
import io.github.kscripting.shell.model.ScriptType
import io.github.kscripting.shell.model.writeText

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

Expand Down Expand Up @@ -44,7 +47,14 @@ class JarArtifactCreator(private val executor: Executor) {
filesToCompile.add(wrapper)
}

executor.compileKotlin(jarFile, resolvedDependencies, filesToCompile, script.compilerOpts)
executor.compileKotlin(
jarFile,
resolvedDependencies,
filesToCompile,
script.compilerOpts +
// This options allows to work with Kotlin 1.9.x, where scripts in source roots are ignored
CompilerOpt("-Xallow-any-scripts-in-source-roots")
)

return JarArtifact(jarFile, execClassName)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ class ScriptResolverTest {
}
}

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

0 comments on commit 6acd4e1

Please sign in to comment.