Skip to content

Commit d253b76

Browse files
authored
feat: produce bindings with 2.0 Kotlin target (#2004)
Thanks to this, consumer that use older Kotlin version may use the bindings server. The oldest compatible version is 1.9.0. Part of #1756.
1 parent 2cfe6e5 commit d253b76

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

.github/workflows/bindings-server.main.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ workflow(
108108

109109
// There should be a difference of one (mostly minor) version between these two,
110110
// to be able to see the newest non-working and oldest working version.
111-
val newestNotCompatibleVersion = "2.0.0"
112-
val oldestCompatibleVersion = "2.1.0"
111+
val newestNotCompatibleVersion = "1.9.0"
112+
val oldestCompatibleVersion = "2.0.0"
113113

114114
runWithSpecificKotlinVersion(
115115
kotlinVersion = newestNotCompatibleVersion,

.github/workflows/bindings-server.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,29 +81,29 @@ jobs:
8181
mv .github/workflows/test-served-bindings-depend-on-library.main.do-not-compile.kts .github/workflows/test-served-bindings-depend-on-library.main.kts
8282
.github/workflows/test-served-bindings-depend-on-library.main.kts
8383
- id: 'step-8'
84-
name: 'Install Kotlin 2.0.0'
84+
name: 'Install Kotlin 1.9.0'
8585
uses: 'fwilhe2/setup-kotlin@v1'
8686
with:
87-
version: '2.0.0'
87+
version: '1.9.0'
8888
- id: 'step-9'
8989
name: 'Clean Maven Local to fetch required POMs again'
9090
run: 'rm -rf ~/.m2/repository/'
9191
- id: 'step-10'
92-
name: 'Execute the script using the bindings from the server, using older Kotlin (2.0.0) as consumer'
92+
name: 'Execute the script using the bindings from the server, using older Kotlin (1.9.0) as consumer'
9393
run: |2-
9494
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts
9595
(.github/workflows/test-script-consuming-jit-bindings-too-old-kotlin.main.kts || true) >> output.txt 2>&1
9696
grep "was compiled with an incompatible version of Kotlin" output.txt
9797
- id: 'step-11'
98-
name: 'Install Kotlin 2.1.0'
98+
name: 'Install Kotlin 2.0.0'
9999
uses: 'fwilhe2/setup-kotlin@v1'
100100
with:
101-
version: '2.1.0'
101+
version: '2.0.0'
102102
- id: 'step-12'
103103
name: 'Clean Maven Local to fetch required POMs again'
104104
run: 'rm -rf ~/.m2/repository/'
105105
- id: 'step-13'
106-
name: 'Execute the script using the bindings from the server, using older Kotlin (2.1.0) as consumer'
106+
name: 'Execute the script using the bindings from the server, using older Kotlin (2.0.0) as consumer'
107107
run: |-
108108
cp .github/workflows/test-script-consuming-jit-bindings.main.kts .github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts
109109
.github/workflows/test-script-consuming-jit-bindings-older-kotlin.main.kts

maven-binding-builder/src/main/kotlin/io/github/typesafegithub/workflows/mavenbinding/JarBuilding.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ internal fun ActionCoords.buildJars(): Jars? {
5959
)
6060
}
6161

62+
private const val TARGET_KOTLIN_VERSION = "2.0"
63+
6264
private fun compileBinding(sourceFilePaths: List<Path>): Path {
6365
val compilationOutput = createTempDirectory(prefix = "gwkt-classes_")
6466

@@ -67,6 +69,8 @@ private fun compileBinding(sourceFilePaths: List<Path>): Path {
6769
destination = compilationOutput.toString()
6870
classpath = System.getProperty("java.class.path")
6971
freeArgs = sourceFilePaths.map { it.toString() }
72+
languageVersion = TARGET_KOTLIN_VERSION
73+
apiVersion = TARGET_KOTLIN_VERSION
7074
noStdlib = true
7175
noReflect = true
7276
includeRuntime = false

0 commit comments

Comments
 (0)