mirror of
https://github.com/apple/pkl.git
synced 2026-03-24 10:01:10 +01:00
Update Kotlin to 2.0 (#900)
- update Kotlin from 1.7.10 to 2.0.21
- Kotlin 1.6 dependencies in Gradle lock files are expected because kotlinc,
which is also used by some tests, internally uses some 1.6 dependencies
for backwards compatibility reasons.
- update kotlinx-html and kotlinx-serialization
- adapt Kotlin code where necessary
- use Kotlin stdlib Path APIs where possible
- fix IntelliJ Kotlin inspection warnings
- reformat code with `./gradlew spotlessApply`
- ktfmt adds lots of trailing commas
- Add workaround to fix IntelliJ "unresolved reference" errors
This commit is contained in:
@@ -3,26 +3,31 @@
|
||||
# This file is expected to be part of source control.
|
||||
com.tunnelvisionlabs:antlr4-runtime:4.9.0=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
net.bytebuddy:byte-buddy:1.15.11=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeOnlyDependenciesMetadata
|
||||
org.assertj:assertj-core:3.27.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.sdk:graal-sdk:23.0.6=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.graalvm.truffle:truffle-api:23.0.6=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:1.7.10=kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-reflect:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains:annotations:13.0=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-common:2.0.21=kotlinBuildToolsApiClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-api:2.0.21=kotlinBuildToolsApiClasspath
|
||||
org.jetbrains.kotlin:kotlin-build-tools-impl:2.0.21=kotlinBuildToolsApiClasspath
|
||||
org.jetbrains.kotlin:kotlin-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-compiler-runner:2.0.21=kotlinBuildToolsApiClasspath
|
||||
org.jetbrains.kotlin:kotlin-daemon-client:2.0.21=kotlinBuildToolsApiClasspath
|
||||
org.jetbrains.kotlin:kotlin-daemon-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:2.0.21=kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-native-prebuilt:2.0.21=kotlinNativeBundleConfiguration
|
||||
org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-script-runtime:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains.kotlin:kotlin-scripting-common:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
|
||||
org.jetbrains:annotations:13.0=compileClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-api:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.junit.jupiter:junit-jupiter-engine:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
|
||||
org.junit.jupiter:junit-jupiter-params:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ class ServerMessagePackEncoder(packer: MessagePacker) : BaseMessagePackEncoder(p
|
||||
packKeyValue("sha256", checksums.sha256)
|
||||
}
|
||||
|
||||
private fun MessagePacker.packExternalReader(spec: ExternalReader) {
|
||||
private fun packExternalReader(spec: ExternalReader) {
|
||||
packMapHeader(1, spec.arguments)
|
||||
packKeyValue("executable", spec.executable)
|
||||
spec.arguments?.let { packKeyValue("arguments", it) }
|
||||
@@ -141,7 +141,7 @@ class ServerMessagePackEncoder(packer: MessagePacker) : BaseMessagePackEncoder(p
|
||||
packer.packMapHeader(msg.externalModuleReaders.size)
|
||||
for ((scheme, spec) in msg.externalModuleReaders) {
|
||||
packer.packString(scheme)
|
||||
packer.packExternalReader(spec)
|
||||
packExternalReader(spec)
|
||||
}
|
||||
}
|
||||
if (msg.externalResourceReaders != null) {
|
||||
@@ -149,7 +149,7 @@ class ServerMessagePackEncoder(packer: MessagePacker) : BaseMessagePackEncoder(p
|
||||
packer.packMapHeader(msg.externalResourceReaders.size)
|
||||
for ((scheme, spec) in msg.externalResourceReaders) {
|
||||
packer.packString(scheme)
|
||||
packer.packExternalReader(spec)
|
||||
packExternalReader(spec)
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,6 +50,7 @@ private val threadLocalEncoder: ThreadLocal<(Message) -> ByteArray> =
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
internal fun encode(message: Message): ByteArray {
|
||||
return threadLocalEncoder.get()(message)
|
||||
}
|
||||
@@ -60,6 +61,7 @@ internal fun encode(message: Message): ByteArray {
|
||||
*
|
||||
* [Future.get] will wrap any exception in [ExecutionException], which is kind of silly.
|
||||
*/
|
||||
@Suppress("unused")
|
||||
fun <T> Future<T>.getUnderlying(): T =
|
||||
try {
|
||||
get()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ abstract class AbstractServerTest {
|
||||
|
||||
companion object {
|
||||
/** Set to `true` to bypass messagepack serialization when running [JvmServerTest]. */
|
||||
const val USE_DIRECT_TRANSPORT = false
|
||||
internal const val USE_DIRECT_TRANSPORT = false
|
||||
|
||||
val executor: ExecutorService =
|
||||
if (USE_DIRECT_TRANSPORT) {
|
||||
@@ -77,7 +77,7 @@ abstract class AbstractServerTest {
|
||||
}
|
||||
"""
|
||||
.trimIndent(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -104,7 +104,7 @@ abstract class AbstractServerTest {
|
||||
foo = trace(1 + 2 + 3)
|
||||
"""
|
||||
.trimIndent(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -131,7 +131,7 @@ abstract class AbstractServerTest {
|
||||
result = foo()
|
||||
"""
|
||||
.trimIndent(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -153,7 +153,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = read("bahumbug:/foo.pkl").text""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -166,7 +166,7 @@ abstract class AbstractServerTest {
|
||||
readResourceMsg.requestId,
|
||||
evaluatorId,
|
||||
"my bahumbug".toByteArray(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -192,7 +192,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId = evaluatorId,
|
||||
moduleUri = URI("repl:text"),
|
||||
moduleText = """res = read("bahumbug:/foo.pkl").text""",
|
||||
expr = "res"
|
||||
expr = "res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -225,7 +225,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = read("bahumbug:/foo.txt").text""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -236,7 +236,7 @@ abstract class AbstractServerTest {
|
||||
readResourceMsg.requestId,
|
||||
evaluatorId,
|
||||
byteArrayOf(),
|
||||
"cannot read my bahumbug"
|
||||
"cannot read my bahumbug",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -258,7 +258,7 @@ abstract class AbstractServerTest {
|
||||
res = read*("bird:/**.txt").keys
|
||||
"""
|
||||
.trimIndent(),
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
val listResourcesRequest = client.receive<ListResourcesRequest>()
|
||||
@@ -268,7 +268,7 @@ abstract class AbstractServerTest {
|
||||
listResourcesRequest.requestId,
|
||||
listResourcesRequest.evaluatorId,
|
||||
listOf(PathElement("foo.txt", false), PathElement("subdir", true)),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
val listResourcesRequest2 = client.receive<ListResourcesRequest>()
|
||||
@@ -277,10 +277,8 @@ abstract class AbstractServerTest {
|
||||
ListResourcesResponse(
|
||||
listResourcesRequest2.requestId,
|
||||
listResourcesRequest2.evaluatorId,
|
||||
listOf(
|
||||
PathElement("bar.txt", false),
|
||||
),
|
||||
null
|
||||
listOf(PathElement("bar.txt", false)),
|
||||
null,
|
||||
)
|
||||
)
|
||||
val evaluateResponse = client.receive<EvaluateResponse>()
|
||||
@@ -309,7 +307,7 @@ abstract class AbstractServerTest {
|
||||
res = read*("bird:/**.txt").keys
|
||||
"""
|
||||
.trimIndent(),
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
val listResourcesRequest = client.receive<ListResourcesRequest>()
|
||||
@@ -318,7 +316,7 @@ abstract class AbstractServerTest {
|
||||
listResourcesRequest.requestId,
|
||||
listResourcesRequest.evaluatorId,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
val evaluateResponse = client.receive<EvaluateResponse>()
|
||||
@@ -345,7 +343,7 @@ abstract class AbstractServerTest {
|
||||
res = read*("bird:/**.txt").keys
|
||||
"""
|
||||
.trimIndent(),
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
val listResourcesRequest = client.receive<ListResourcesRequest>()
|
||||
@@ -355,7 +353,7 @@ abstract class AbstractServerTest {
|
||||
listResourcesRequest.requestId,
|
||||
listResourcesRequest.evaluatorId,
|
||||
null,
|
||||
"didnt work"
|
||||
"didnt work",
|
||||
)
|
||||
)
|
||||
val evaluateResponse = client.receive<EvaluateResponse>()
|
||||
@@ -390,7 +388,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = import("bird:/pigeon.pkl").value""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -418,7 +416,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId = evaluatorId,
|
||||
moduleUri = URI("repl:text"),
|
||||
moduleText = """res = import("bird:/pigeon.pkl")""",
|
||||
expr = "res"
|
||||
expr = "res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -448,7 +446,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = import("bird:/pigeon.pkl").value""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -475,7 +473,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = import*("bird:/**.pkl").keys""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -489,9 +487,9 @@ abstract class AbstractServerTest {
|
||||
listOf(
|
||||
PathElement("birds", true),
|
||||
PathElement("majesticBirds", true),
|
||||
PathElement("Person.pkl", false)
|
||||
PathElement("Person.pkl", false),
|
||||
),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
val listModulesMsg2 = client.receive<ListModulesRequest>()
|
||||
@@ -501,11 +499,8 @@ abstract class AbstractServerTest {
|
||||
ListModulesResponse(
|
||||
listModulesMsg2.requestId,
|
||||
listModulesMsg2.evaluatorId,
|
||||
listOf(
|
||||
PathElement("pigeon.pkl", false),
|
||||
PathElement("parrot.pkl", false),
|
||||
),
|
||||
null
|
||||
listOf(PathElement("pigeon.pkl", false), PathElement("parrot.pkl", false)),
|
||||
null,
|
||||
)
|
||||
)
|
||||
val listModulesMsg3 = client.receive<ListModulesRequest>()
|
||||
@@ -515,11 +510,8 @@ abstract class AbstractServerTest {
|
||||
ListModulesResponse(
|
||||
listModulesMsg3.requestId,
|
||||
listModulesMsg3.evaluatorId,
|
||||
listOf(
|
||||
PathElement("barnOwl.pkl", false),
|
||||
PathElement("elfOwl.pkl", false),
|
||||
),
|
||||
null
|
||||
listOf(PathElement("barnOwl.pkl", false), PathElement("elfOwl.pkl", false)),
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -550,7 +542,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = import*("bird:/**.pkl").keys""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
val listModulesMsg = client.receive<ListModulesRequest>()
|
||||
@@ -578,7 +570,7 @@ abstract class AbstractServerTest {
|
||||
evaluatorId,
|
||||
URI("repl:text"),
|
||||
"""res = import*("bird:/**.pkl").keys""",
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -669,7 +661,7 @@ abstract class AbstractServerTest {
|
||||
res = buz.res
|
||||
"""
|
||||
.trimIndent(),
|
||||
"res"
|
||||
"res",
|
||||
)
|
||||
)
|
||||
val readModuleRequest = client.receive<ReadModuleRequest>()
|
||||
@@ -679,7 +671,7 @@ abstract class AbstractServerTest {
|
||||
readModuleRequest.requestId,
|
||||
readModuleRequest.evaluatorId,
|
||||
null,
|
||||
"not here"
|
||||
"not here",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -690,7 +682,7 @@ abstract class AbstractServerTest {
|
||||
readModuleRequest2.requestId,
|
||||
readModuleRequest2.evaluatorId,
|
||||
"res = 1",
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -714,15 +706,7 @@ abstract class AbstractServerTest {
|
||||
val reader = ModuleReaderSpec("bird", true, false, false)
|
||||
val evaluatorId = client.sendCreateEvaluatorRequest(moduleReaders = listOf(reader))
|
||||
|
||||
client.send(
|
||||
EvaluateRequest(
|
||||
1,
|
||||
evaluatorId,
|
||||
URI("bird:/pigeon.pkl"),
|
||||
null,
|
||||
"output.text",
|
||||
)
|
||||
)
|
||||
client.send(EvaluateRequest(1, evaluatorId, URI("bird:/pigeon.pkl"), null, "output.text"))
|
||||
|
||||
val readModuleRequest = client.receive<ReadModuleRequest>()
|
||||
assertThat(readModuleRequest.uri.toString()).isEqualTo("bird:/pigeon.pkl")
|
||||
@@ -737,7 +721,7 @@ abstract class AbstractServerTest {
|
||||
fullName = firstName + " " + lastName
|
||||
"""
|
||||
.trimIndent(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -759,15 +743,7 @@ abstract class AbstractServerTest {
|
||||
fun `concurrent evaluations`() {
|
||||
val reader = ModuleReaderSpec("bird", true, false, false)
|
||||
val evaluatorId = client.sendCreateEvaluatorRequest(moduleReaders = listOf(reader))
|
||||
client.send(
|
||||
EvaluateRequest(
|
||||
1,
|
||||
evaluatorId,
|
||||
URI("bird:/pigeon.pkl"),
|
||||
null,
|
||||
"output.text",
|
||||
)
|
||||
)
|
||||
client.send(EvaluateRequest(1, evaluatorId, URI("bird:/pigeon.pkl"), null, "output.text"))
|
||||
|
||||
client.send(EvaluateRequest(2, evaluatorId, URI("bird:/parrot.pkl"), null, "output.text"))
|
||||
|
||||
@@ -785,7 +761,7 @@ abstract class AbstractServerTest {
|
||||
fullName = firstName + " " + lastName
|
||||
"""
|
||||
.trimIndent(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -815,7 +791,7 @@ abstract class AbstractServerTest {
|
||||
fullName = firstName + " " + lastName
|
||||
"""
|
||||
.trimIndent(),
|
||||
null
|
||||
null,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -923,20 +899,12 @@ abstract class AbstractServerTest {
|
||||
Project(
|
||||
libDir.toUri().resolve("PklProject"),
|
||||
URI("package://localhost:0/lib@5.0.0"),
|
||||
emptyMap()
|
||||
)
|
||||
)
|
||||
)
|
||||
emptyMap(),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
client.send(
|
||||
EvaluateRequest(
|
||||
1,
|
||||
evaluatorId,
|
||||
module.toUri(),
|
||||
null,
|
||||
"output.text",
|
||||
)
|
||||
)
|
||||
client.send(EvaluateRequest(1, evaluatorId, module.toUri(), null, "output.text"))
|
||||
val resp2 = client.receive<EvaluateResponse>()
|
||||
assertThat(resp2.error).isNull()
|
||||
assertThat(resp2.result).isNotNull()
|
||||
@@ -987,7 +955,7 @@ abstract class AbstractServerTest {
|
||||
project,
|
||||
http,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
)
|
||||
|
||||
send(message)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,7 +55,7 @@ class BinaryEvaluatorSnippetTestEngine : InputOutputTestEngine() {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
null,
|
||||
)
|
||||
|
||||
private fun String.stripFilePaths() =
|
||||
@@ -67,5 +67,5 @@ class BinaryEvaluatorSnippetTestEngine : InputOutputTestEngine() {
|
||||
}
|
||||
}
|
||||
|
||||
val ByteArray.debugRendering
|
||||
val ByteArray.debugRendering: String
|
||||
get() = MessagePackDebugRenderer(this).output
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -100,7 +100,7 @@ class MessagePackDebugRenderer(bytes: ByteArray) {
|
||||
}
|
||||
}
|
||||
|
||||
val output by lazy {
|
||||
val output: String by lazy {
|
||||
renderValue()
|
||||
sb.toString().removePrefix("\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user