diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 2fd0229e..d723e4a1 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -74,4 +74,4 @@
-
\ No newline at end of file
+
diff --git a/bench/gradle.lockfile b/bench/gradle.lockfile
index 54d2a994..66a959fd 100644
--- a/bench/gradle.lockfile
+++ b/bench/gradle.lockfile
@@ -3,7 +3,6 @@
# This file is expected to be part of source control.
com.tunnelvisionlabs:antlr4-runtime:4.9.0=jmh,jmhCompileClasspath,jmhImplementationDependenciesMetadata,jmhRuntimeClasspath
net.bytebuddy:byte-buddy:1.15.11=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
net.sf.jopt-simple:jopt-simple:5.0.4=jmh,jmhCompileClasspath,jmhImplementationDependenciesMetadata,jmhRuntimeClasspath
org.apache.commons:commons-math3:3.6.1=jmh,jmhCompileClasspath,jmhImplementationDependenciesMetadata,jmhRuntimeClasspath
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeOnlyDependenciesMetadata
@@ -11,21 +10,27 @@ org.assertj:assertj-core:3.27.2=testCompileClasspath,testImplementationDependenc
org.graalvm.compiler:compiler:23.0.6=graal
org.graalvm.sdk:graal-sdk:23.0.6=graal,jmh,jmhRuntimeClasspath,truffle
org.graalvm.truffle:truffle-api:23.0.6=graal,jmh,jmhRuntimeClasspath,truffle
-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,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
-org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10=kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=kotlinCompilerClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-scripting-common:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains:annotations:13.0=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathJmh,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-engine:5.11.4=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-params:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 709448c3..09576ef8 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -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.
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
+
plugins { `kotlin-dsl` }
dependencies {
@@ -31,4 +33,4 @@ java {
targetCompatibility = JavaVersion.VERSION_17
}
-kotlin { target { compilations.configureEach { kotlinOptions { jvmTarget = "17" } } } }
+kotlin { compilerOptions { jvmTarget = JvmTarget.JVM_17 } }
diff --git a/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts b/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts
index 4b036cbe..c470ff65 100644
--- a/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts
+++ b/buildSrc/src/main/kotlin/pklAllProjects.gradle.kts
@@ -15,6 +15,7 @@
*/
import com.diffplug.gradle.spotless.KotlinGradleExtension
import org.gradle.accessors.dm.LibrariesForLibs
+import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { id("com.diffplug.spotless") }
@@ -48,9 +49,9 @@ plugins.withType(JavaPlugin::class).configureEach {
}
tasks.withType().configureEach {
- kotlinOptions {
- jvmTarget = "17"
- freeCompilerArgs = freeCompilerArgs + listOf("-Xjsr305=strict", "-Xjvm-default=all")
+ compilerOptions {
+ jvmTarget = JvmTarget.JVM_17
+ freeCompilerArgs.addAll("-Xjsr305=strict", "-Xjvm-default=all")
}
}
diff --git a/docs/gradle.lockfile b/docs/gradle.lockfile
index c4b02948..59f311db 100644
--- a/docs/gradle.lockfile
+++ b/docs/gradle.lockfile
@@ -4,26 +4,32 @@
com.tunnelvisionlabs:antlr4-runtime:4.9.0=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
io.leangen.geantyref:geantyref:1.3.16=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=testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=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,testRuntimeClasspath
-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=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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-reflect:2.0.21=testRuntimeClasspath
+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=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains:annotations:13.0=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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
diff --git a/docs/src/test/kotlin/DocSnippetTests.kt b/docs/src/test/kotlin/DocSnippetTests.kt
index 5a5bb56b..03de67df 100644
--- a/docs/src/test/kotlin/DocSnippetTests.kt
+++ b/docs/src/test/kotlin/DocSnippetTests.kt
@@ -38,7 +38,7 @@ class DocSnippetTestsEngine : HierarchicalTestEngine {
val match = cmdRegex.matchEntire(input) ?: return listOf()
val (cmd, ws, arg) = match.destructured
- return Command.values()
+ return Command.entries
.filter { it.toString().lowercase().startsWith(cmd) }
.map { ParsedCommand(it, cmd, ws, arg) }
}
@@ -29,7 +29,7 @@ internal data class ParsedCommand(
val type: Command,
val cmd: String,
val ws: String,
- val arg: String
+ val arg: String,
)
internal enum class Command {
diff --git a/pkl-cli/src/main/kotlin/org/pkl/cli/repl/ReplCompleters.kt b/pkl-cli/src/main/kotlin/org/pkl/cli/repl/ReplCompleters.kt
index f585899c..d15e43c8 100644
--- a/pkl-cli/src/main/kotlin/org/pkl/cli/repl/ReplCompleters.kt
+++ b/pkl-cli/src/main/kotlin/org/pkl/cli/repl/ReplCompleters.kt
@@ -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.
@@ -40,7 +40,7 @@ internal abstract class JLineFileNameCompleter : Completer {
override fun complete(
reader: LineReader,
commandLine: ParsedLine,
- candidates: MutableList
+ candidates: MutableList,
) {
val buffer = commandLine.word().substring(0, commandLine.wordCursor())
val current: Path
@@ -78,7 +78,7 @@ internal abstract class JLineFileNameCompleter : Completer {
null,
if (reader.isSet(LineReader.Option.AUTO_REMOVE_SLASH)) sep else null,
null,
- false
+ false,
)
)
} else {
@@ -90,7 +90,7 @@ internal abstract class JLineFileNameCompleter : Completer {
null,
null,
null,
- true
+ true,
)
)
}
@@ -122,7 +122,7 @@ internal abstract class JLineFileNameCompleter : Completer {
terminal: Terminal,
path: Path,
resolver: StyleResolver,
- separator: String
+ separator: String,
): String {
val builder = AttributedStringBuilder()
val name = path.fileName.toString()
@@ -162,7 +162,7 @@ internal class FileCompleter(override val userDir: Path) : JLineFileNameComplete
override fun complete(
reader: LineReader,
commandLine: ParsedLine,
- candidates: MutableList
+ candidates: MutableList,
) {
val loadCmd =
getMatchingCommands(commandLine.line()).find { it.type == Command.Load && it.ws.isNotEmpty() }
@@ -174,7 +174,7 @@ internal class FileCompleter(override val userDir: Path) : JLineFileNameComplete
internal object CommandCompleter : Completer {
private val commandCandidates: List =
- Command.values().map { Candidate(":" + it.toString().lowercase()) }
+ Command.entries.map { Candidate(":" + it.toString().lowercase()) }
override fun complete(reader: LineReader, line: ParsedLine, candidates: MutableList) {
if (line.wordIndex() == 0) candidates.addAll(commandCandidates)
diff --git a/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt b/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
index 7572c91a..c1361d6d 100644
--- a/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
+++ b/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
@@ -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.
@@ -49,6 +49,7 @@ import org.pkl.core.OutputFormat
import org.pkl.core.SecurityManagers
import org.pkl.core.util.IoUtils
+@OptIn(ExperimentalPathApi::class)
@WireMockTest(httpsEnabled = true, proxyMode = true)
class CliEvaluatorTest {
companion object {
@@ -88,19 +89,20 @@ class CliEvaluatorTest {
val sourceFiles = listOf(writePklFile("test.pkl"))
val outputFiles =
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles),
- outputFormat = "pcf",
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "pcf")
)
assertThat(outputFiles).hasSize(1)
- checkOutputFile(outputFiles[0], "test.pcf", """
+ checkOutputFile(
+ outputFiles[0],
+ "test.pcf",
+ """
person {
name = "pigeon"
age = 30
}
- """)
+ """,
+ )
}
@Test
@@ -108,10 +110,7 @@ person {
val sourceFiles = listOf(writePklFile("test.pkl"))
val outputFiles =
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles),
- outputFormat = "json",
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "json")
)
assertThat(outputFiles).hasSize(1)
@@ -125,7 +124,7 @@ person {
"age": 30
}
}
- """
+ """,
)
}
@@ -134,18 +133,19 @@ person {
val sourceFiles = listOf(writePklFile("test.pkl"))
val outputFiles =
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles),
- outputFormat = "yaml",
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "yaml")
)
assertThat(outputFiles).hasSize(1)
- checkOutputFile(outputFiles[0], "test.yaml", """
+ checkOutputFile(
+ outputFiles[0],
+ "test.yaml",
+ """
person:
name: pigeon
age: 30
- """)
+ """,
+ )
}
@Test
@@ -153,10 +153,7 @@ person:
val sourceFiles = listOf(writePklFile("test.pkl"))
val outputFiles =
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles),
- outputFormat = "plist",
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "plist")
)
assertThat(outputFiles).hasSize(1)
@@ -178,7 +175,7 @@ person:
- """
+ """,
)
}
@@ -187,10 +184,7 @@ person:
val sourceFiles = listOf(writePklFile("test.pkl"))
val outputFiles =
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles),
- outputFormat = "xml",
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "xml")
)
assertThat(outputFiles).hasSize(1)
@@ -205,7 +199,7 @@ person:
30
- """
+ """,
)
}
@@ -229,14 +223,11 @@ person:
listOf(
writePklFile("file1.pkl", "x = 1 + 1"),
writePklFile("file2.pkl", "x = 2 + 2"),
- writePklFile("file3.pkl", "x = 3 + 3")
+ writePklFile("file3.pkl", "x = 3 + 3"),
)
val outputFiles =
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles),
- outputFormat = "pcf",
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "pcf")
)
assertThat(outputFiles).hasSize(3)
@@ -269,20 +260,24 @@ person:
CliBaseOptions(
sourceModules =
listOf(URI("modulepath:/foo/bar/test.pkl"), URI("modulepath:/foo/bar/test2.pkl")),
- modulePath = listOf(tempDir)
+ modulePath = listOf(tempDir),
),
outputFormat = "pcf",
- outputPath = "$tempDir/%{moduleName}.%{outputFormat}"
+ outputPath = "$tempDir/%{moduleName}.%{outputFormat}",
)
)
assertThat(outputFiles).hasSize(2)
- checkOutputFile(outputFiles[0], "test.pcf", """
+ checkOutputFile(
+ outputFiles[0],
+ "test.pcf",
+ """
person {
name = "pigeon"
age = 30
}
- """)
+ """,
+ )
checkOutputFile(
outputFiles[1],
"test2.pcf",
@@ -291,7 +286,7 @@ person {
name = "barn owl"
age = 30
}
- """
+ """,
)
}
@@ -306,7 +301,7 @@ person {
name = read("prop:name")
age = read("prop:age").toInt()
}
- """
+ """,
)
)
@@ -315,19 +310,23 @@ person {
CliEvaluatorOptions(
CliBaseOptions(
sourceModules = sourceFiles,
- externalProperties = mapOf("name" to "pigeon", "age" to "30")
+ externalProperties = mapOf("name" to "pigeon", "age" to "30"),
),
outputFormat = "pcf",
)
)
assertThat(outputFiles).hasSize(1)
- checkOutputFile(outputFiles[0], "test.pcf", """
+ checkOutputFile(
+ outputFiles[0],
+ "test.pcf",
+ """
person {
name = "pigeon"
age = 30
}
- """)
+ """,
+ )
}
@Test
@@ -351,21 +350,25 @@ person {
sourceModules = listOf(file.toUri()),
workingDir =
if (relativePath) IoUtils.getCurrentWorkingDir().relativize(dir.parent)
- else dir.parent
+ else dir.parent,
),
outputFormat = "pcf",
- outputPath = "baz/%{moduleName}.pcf"
+ outputPath = "baz/%{moduleName}.pcf",
)
)
assertThat(outputFiles).hasSize(1)
assertThat(outputFiles[0].normalize()).isEqualTo(dir.parent.resolve("baz/test.pcf"))
- checkOutputFile(outputFiles[0], "test.pcf", """
+ checkOutputFile(
+ outputFiles[0],
+ "test.pcf",
+ """
person {
name = "pigeon"
age = 30
}
- """)
+ """,
+ )
}
@Test
@@ -377,17 +380,21 @@ person {
evalToFiles(
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(URI("foo/test.pkl")), workingDir = tempDir),
- outputFormat = "pcf"
+ outputFormat = "pcf",
)
)
assertThat(outputFiles).hasSize(1)
- checkOutputFile(outputFiles[0], "test.pcf", """
+ checkOutputFile(
+ outputFiles[0],
+ "test.pcf",
+ """
person {
name = "pigeon"
age = 30
}
- """)
+ """,
+ )
}
@Test
@@ -396,10 +403,13 @@ person {
libDir.resolve("someLib.pkl").writeString("x = 1")
val pklScript =
- writePklFile("test.pkl", """
+ writePklFile(
+ "test.pkl",
+ """
import "modulepath:/foo/someLib.pkl"
result = someLib.x
- """)
+ """,
+ )
val outputFiles =
evalToFiles(
@@ -407,9 +417,9 @@ result = someLib.x
CliBaseOptions(
sourceModules = listOf(pklScript),
workingDir = tempDir,
- modulePath = listOf("lib".toPath())
+ modulePath = listOf("lib".toPath()),
),
- outputFormat = "pcf"
+ outputFormat = "pcf",
)
)
@@ -427,7 +437,7 @@ result = someLib.x
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(file), workingDir = workingDir),
outputPath = "%{moduleDir}/result.pcf",
- outputFormat = "pcf"
+ outputFormat = "pcf",
)
)
assertThat(outputFiles).hasSize(1)
@@ -449,7 +459,7 @@ result = someLib.x
evalToFiles(
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(file), workingDir = workingDir),
- outputFormat = "pcf"
+ outputFormat = "pcf",
)
)
assertThat(outputFiles).hasSize(1)
@@ -465,10 +475,10 @@ result = someLib.x
CliEvaluator(
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(URI("repl:text"))),
- outputFormat = "pcf"
+ outputFormat = "pcf",
),
stdin,
- stdout
+ stdout,
)
evaluator.run()
assertThat(stdout.toString().trim()).isEqualTo(defaultContents.replace("20 + 10", "30").trim())
@@ -480,11 +490,7 @@ result = someLib.x
val module2 = writePklFile("mod2.pkl", "y = 11 + 11")
val output =
- evalToConsole(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = listOf(module1, module2)),
- )
- )
+ evalToConsole(CliEvaluatorOptions(CliBaseOptions(sourceModules = listOf(module1, module2))))
assertThat(output).isEqualTo("x = 42\n---\ny = 22\n")
}
@@ -498,7 +504,7 @@ result = someLib.x
"""
function fib(n) = if (n < 2) 0 else fib(n - 1) + fib(n - 2)
x = fib(100)
- """
+ """,
)
)
@@ -507,7 +513,7 @@ result = someLib.x
evalToFiles(
CliEvaluatorOptions(
CliBaseOptions(sourceModules = sourceFiles, timeout = Duration.ofMillis(100)),
- outputFormat = "pcf"
+ outputFormat = "pcf",
)
)
}
@@ -516,16 +522,20 @@ result = someLib.x
@Test
fun `cannot import module located outside root dir`() {
- val sourceFiles = listOf(writePklFile("test.pkl", """
+ val sourceFiles =
+ listOf(
+ writePklFile(
+ "test.pkl",
+ """
amends "/non/existing.pkl"
- """))
+ """,
+ )
+ )
val e =
assertThrows {
evalToFiles(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = sourceFiles, rootDir = tempDir),
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles, rootDir = tempDir))
)
}
@@ -538,7 +548,7 @@ result = someLib.x
listOf(
writePklFile("test1.pkl", "x = 1"),
writePklFile("test2.pkl", "x = 2"),
- writePklFile("test3.pkl", "x = 3")
+ writePklFile("test3.pkl", "x = 3"),
)
val outputFile = tempDir.resolve("output.yaml")
@@ -547,7 +557,7 @@ result = someLib.x
CliEvaluatorOptions(
CliBaseOptions(sourceModules = sourceFiles),
outputFile.toString(),
- "yaml"
+ "yaml",
)
)
@@ -560,18 +570,18 @@ result = someLib.x
listOf(
writePklFile(
"test0.pkl",
- "output { value = List(); renderer = new YamlRenderer { isStream = true } }"
+ "output { value = List(); renderer = new YamlRenderer { isStream = true } }",
),
writePklFile("test1.pkl", "x = 1"),
writePklFile(
"test2.pkl",
- "output { value = List(); renderer = new YamlRenderer { isStream = true } }"
+ "output { value = List(); renderer = new YamlRenderer { isStream = true } }",
),
writePklFile("test3.pkl", "x = 3"),
writePklFile(
"test4.pkl",
- "output { value = List(); renderer = new YamlRenderer { isStream = true } }"
- )
+ "output { value = List(); renderer = new YamlRenderer { isStream = true } }",
+ ),
)
val outputFile = tempDir.resolve("output.yaml")
@@ -580,7 +590,7 @@ result = someLib.x
CliEvaluatorOptions(
CliBaseOptions(sourceModules = sourceFiles),
outputFile.toString(),
- "yaml"
+ "yaml",
)
)
@@ -593,7 +603,7 @@ result = someLib.x
listOf(
writePklFile("test1.pkl", "x = 1"),
writePklFile("test2.pkl", "x = 2"),
- writePklFile("test3.pkl", "x = 3")
+ writePklFile("test3.pkl", "x = 3"),
)
val outputFile = tempDir.resolve("output.pcf")
@@ -603,7 +613,7 @@ result = someLib.x
CliBaseOptions(sourceModules = sourceFiles),
outputFile.toString(),
outputFormat = "pcf",
- moduleOutputSeparator = "// my module separator"
+ moduleOutputSeparator = "// my module separator",
)
)
@@ -617,7 +627,7 @@ result = someLib.x
// my module separator
x = 3
"""
- .trimIndent()
+ .trimIndent(),
)
}
@@ -627,7 +637,7 @@ result = someLib.x
listOf(
writePklFile("test1.pkl", "x = 1"),
writePklFile("test2.pkl", "y = 2"),
- writePklFile("test3.pkl", "z = 3")
+ writePklFile("test3.pkl", "z = 3"),
)
val outputFile = tempDir.resolve("output.pcf")
@@ -637,7 +647,7 @@ result = someLib.x
CliBaseOptions(sourceModules = sourceFiles),
outputFile.toString(),
outputFormat = "pcf",
- moduleOutputSeparator = ""
+ moduleOutputSeparator = "",
)
)
@@ -651,7 +661,7 @@ result = someLib.x
z = 3
"""
- .trimIndent()
+ .trimIndent(),
)
}
@@ -661,11 +671,13 @@ result = someLib.x
listOf(
writePklFile("test1.pkl", "x = 1"),
writePklFile("test2.pkl", "x = 2"),
- writePklFile("test3.pkl", "x = 3")
+ writePklFile("test3.pkl", "x = 3"),
)
val output =
- evalToConsole(CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), null, "yaml"))
+ evalToConsole(
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "yaml")
+ )
assertThat(output).isEqualTo("x: 1\n---\nx: 2\n---\nx: 3\n")
}
@@ -676,22 +688,24 @@ result = someLib.x
listOf(
writePklFile(
"test0.pkl",
- "output { value = List(); renderer = new YamlRenderer { isStream = true } }"
+ "output { value = List(); renderer = new YamlRenderer { isStream = true } }",
),
writePklFile("test1.pkl", "x = 1"),
writePklFile(
"test2.pkl",
- "output { value = List(); renderer = new YamlRenderer { isStream = true } }"
+ "output { value = List(); renderer = new YamlRenderer { isStream = true } }",
),
writePklFile("test3.pkl", "x = 3"),
writePklFile(
"test4.pkl",
- "output { value = List(); renderer = new YamlRenderer { isStream = true } }"
- )
+ "output { value = List(); renderer = new YamlRenderer { isStream = true } }",
+ ),
)
val output =
- evalToConsole(CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), null, "yaml"))
+ evalToConsole(
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = sourceFiles), outputFormat = "yaml")
+ )
assertThat(output).isEqualTo("x: 1\n---\nx: 3\n")
}
@@ -705,8 +719,7 @@ result = someLib.x
evalToConsole(
CliEvaluatorOptions(
CliBaseOptions(sourceModules = sourceFiles),
- null,
- outputFormat.toString()
+ outputFormat = outputFormat.toString(),
)
)
assertThat(output).endsWith("\n")
@@ -750,7 +763,7 @@ result = someLib.x
"""
["bar"] = "baz"
"""
- .trimIndent()
+ .trimIndent(),
)
checkOutputFile(
tempDir.resolve(".my-output/bar/baz.pcf"),
@@ -758,7 +771,7 @@ result = someLib.x
"""
["baz"] = "biz"
"""
- .trimIndent()
+ .trimIndent(),
)
checkOutputFile(tempDir.resolve(".my-output/buz.txt"), "buz.txt", "buz")
}
@@ -796,7 +809,7 @@ result = someLib.x
}
"""
.trimIndent(),
- )
+ ),
)
val options =
CliEvaluatorOptions(
@@ -823,7 +836,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
),
writePklFile(
"foo.pkl",
@@ -836,7 +849,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
),
)
val options =
@@ -849,11 +862,7 @@ result = someLib.x
@Test
fun `multiple file output writes nothing if output files is null`() {
- val moduleUri =
- writePklFile(
- "test.pkl",
- "",
- )
+ val moduleUri = writePklFile("test.pkl", "")
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
@@ -878,12 +887,12 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
- multipleFileOutputPath = ".output"
+ multipleFileOutputPath = ".output",
)
assertThatCode { evalToConsole(options) }
.hasMessageStartingWith("Output file conflict:")
@@ -904,7 +913,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
),
writePklFile(
"test2.pkl",
@@ -915,14 +924,14 @@ result = someLib.x
}
}
"""
- .trimIndent()
- )
+ .trimIndent(),
+ ),
)
for (moduleUri in moduleUris) {
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
- multipleFileOutputPath = ".output"
+ multipleFileOutputPath = ".output",
)
assertThatCode { evalToConsole(options) }
.hasMessageStartingWith("Output file conflict:")
@@ -943,7 +952,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
),
writePklFile(
"test2.pkl",
@@ -954,13 +963,13 @@ result = someLib.x
}
}
"""
- .trimIndent()
- )
+ .trimIndent(),
+ ),
)
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = moduleUris, workingDir = tempDir),
- multipleFileOutputPath = ".output"
+ multipleFileOutputPath = ".output",
)
assertThatCode { evalToConsole(options) }
.hasMessageContaining("Output file conflict:")
@@ -980,12 +989,12 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
- multipleFileOutputPath = ".output"
+ multipleFileOutputPath = ".output",
)
assertThatCode { evalToConsole(options) }
.hasMessageContaining("Output file conflict:")
@@ -1005,13 +1014,13 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
- multipleFileOutputPath = ".output"
+ multipleFileOutputPath = ".output",
)
assertThatCode { evalToConsole(options) }
.hasMessageContaining("Path spec `foo:bar` contains illegal character `:`.")
@@ -1030,13 +1039,13 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
- multipleFileOutputPath = ".output"
+ multipleFileOutputPath = ".output",
)
assertThatCode { evalToConsole(options) }
.hasMessageContaining("Path spec `foo\\bar` contains illegal character `\\`.")
@@ -1052,7 +1061,7 @@ result = someLib.x
bar = 1
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
@@ -1083,7 +1092,7 @@ result = someLib.x
}
person: Person = new { name = "Frodo" }
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
@@ -1105,7 +1114,7 @@ result = someLib.x
friend { name = "Bilbo" }
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
@@ -1125,7 +1134,7 @@ result = someLib.x
"""
res = 1
"""
- .trimIndent()
+ .trimIndent(),
)
writePklFile(
"PklProject",
@@ -1134,11 +1143,11 @@ result = someLib.x
package = throw("invalid project package")
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
- CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir, noProject = true),
+ CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir, noProject = true)
)
val buffer = StringWriter()
CliEvaluator(options, consoleWriter = buffer).run()
@@ -1154,7 +1163,7 @@ result = someLib.x
"""
res = read*("env:**")
"""
- .trimIndent()
+ .trimIndent(),
)
writePklFile(
"PklProject",
@@ -1169,12 +1178,10 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir),
- )
+ CliEvaluatorOptions(CliBaseOptions(sourceModules = listOf(moduleUri), workingDir = tempDir))
val buffer = StringWriter()
CliEvaluator(options, consoleWriter = buffer).run()
assertThat(buffer.toString())
@@ -1200,7 +1207,7 @@ result = someLib.x
res = Swallow
"""
- .trimIndent()
+ .trimIndent(),
)
val buffer = StringWriter()
val options =
@@ -1211,8 +1218,8 @@ result = someLib.x
moduleCacheDir = tempDir,
noCache = true,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = packageServer.port
- ),
+ testPort = packageServer.port,
+ )
)
CliEvaluator(options, consoleWriter = buffer).run()
assertThat(buffer.toString())
@@ -1278,7 +1285,7 @@ result = someLib.x
sourceModules = listOf(URI("http://not.a.valid.host/bar.pkl")),
httpProxy = URI("http://localhost:${wwRuntimeInfo.httpPort}"),
allowedModules = SecurityManagers.defaultAllowedModules + Pattern.compile("http:"),
- ),
+ )
)
val output = evalToConsole(options)
assertThat(output).isEqualTo("foo = 1\n")
@@ -1317,7 +1324,7 @@ result = someLib.x
noCache = true,
httpProxy = URI(wwRuntimeInfo.httpBaseUrl),
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- allowedModules = SecurityManagers.defaultAllowedModules + Pattern.compile("http:")
+ allowedModules = SecurityManagers.defaultAllowedModules + Pattern.compile("http:"),
)
)
val output = evalToConsole(options)
@@ -1340,7 +1347,7 @@ result = someLib.x
@Test
fun `eval http module from proxy -- configured in settings`(
@TempDir tempDir: Path,
- wwRuntimeInfo: WireMockRuntimeInfo
+ wwRuntimeInfo: WireMockRuntimeInfo,
) {
val settingsModule =
tempDir.writeFile(
@@ -1354,7 +1361,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
stubFor(
@@ -1366,7 +1373,7 @@ result = someLib.x
sourceModules = listOf(URI("http://not.a.valid.host/bar.pkl")),
settings = settingsModule.toUri(),
allowedModules = SecurityManagers.defaultAllowedModules + Pattern.compile("http:"),
- ),
+ )
)
val output = evalToConsole(options)
assertThat(output).isEqualTo("foo = 1\n")
@@ -1375,7 +1382,7 @@ result = someLib.x
@Test
fun `eval http module from proxy -- configured in PklProject`(
@TempDir tempDir: Path,
- wwRuntimeInfo: WireMockRuntimeInfo
+ wwRuntimeInfo: WireMockRuntimeInfo,
) {
tempDir.writeFile(
"PklProject",
@@ -1390,7 +1397,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
stubFor(
@@ -1401,8 +1408,8 @@ result = someLib.x
CliBaseOptions(
sourceModules = listOf(URI("http://not.a.valid.host/bar.pkl")),
allowedModules = SecurityManagers.defaultAllowedModules + Pattern.compile("http:"),
- projectDir = tempDir
- ),
+ projectDir = tempDir,
+ )
)
val output = evalToConsole(options)
assertThat(output).isEqualTo("foo = 1\n")
@@ -1411,7 +1418,7 @@ result = someLib.x
@Test
fun `eval http module from proxy -- PklProject beats user settings`(
@TempDir tempDir: Path,
- wwRuntimeInfo: WireMockRuntimeInfo
+ wwRuntimeInfo: WireMockRuntimeInfo,
) {
val projectDir = tempDir.resolve("my-project")
projectDir.writeFile(
@@ -1427,7 +1434,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val homeDir = tempDir.resolve("my-home")
homeDir.writeFile(
@@ -1441,7 +1448,7 @@ result = someLib.x
}
}
"""
- .trimIndent()
+ .trimIndent(),
)
val options =
CliEvaluatorOptions(
@@ -1449,8 +1456,8 @@ result = someLib.x
sourceModules = listOf(URI("http://not.a.valid.host/bar.pkl")),
allowedModules = SecurityManagers.defaultAllowedModules + Pattern.compile("http:"),
projectDir = projectDir,
- settings = homeDir.resolve("settings.pkl").toUri()
- ),
+ settings = homeDir.resolve("settings.pkl").toUri(),
+ )
)
stubFor(get(anyUrl()).willReturn(ok("result = 1")))
val output = evalToConsole(options)
@@ -1477,14 +1484,9 @@ result = someLib.x
importGlob = import*("./日*.pkl").keys
importGlobFile = import*("$tempDirUri**/*.pkl").keys.map((it) -> it.replaceAll("$tempDirUri".replaceAll("///", "/"), ""))
"""
- .trimIndent()
- )
- val output =
- evalToConsole(
- CliEvaluatorOptions(
- CliBaseOptions(sourceModules = listOf(file)),
- )
+ .trimIndent(),
)
+ val output = evalToConsole(CliEvaluatorOptions(CliBaseOptions(sourceModules = listOf(file))))
val tripleQuote = "\"\"\""
assertThat(output)
@@ -1521,7 +1523,7 @@ result = someLib.x
import "package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"
res = Swallow
- """
+ """,
)
val options =
@@ -1531,8 +1533,8 @@ result = someLib.x
caCertificates = buildList { if (certsFile != null) add(certsFile) },
workingDir = tempDir,
noCache = true,
- testPort = testPort
- ),
+ testPort = testPort,
+ )
)
CliEvaluator(options).run()
}
diff --git a/pkl-cli/src/test/kotlin/org/pkl/cli/CliPackageDownloaderTest.kt b/pkl-cli/src/test/kotlin/org/pkl/cli/CliPackageDownloaderTest.kt
index 968017aa..70f8f13d 100644
--- a/pkl-cli/src/test/kotlin/org/pkl/cli/CliPackageDownloaderTest.kt
+++ b/pkl-cli/src/test/kotlin/org/pkl/cli/CliPackageDownloaderTest.kt
@@ -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.
@@ -28,7 +28,7 @@ import org.pkl.core.packages.PackageUri
class CliPackageDownloaderTest {
companion object {
- val server = PackageServer()
+ private val server = PackageServer()
@AfterAll
@JvmStatic
@@ -45,15 +45,15 @@ class CliPackageDownloaderTest {
CliBaseOptions(
moduleCacheDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris =
listOf(
PackageUri("package://localhost:0/birds@0.5.0"),
PackageUri("package://localhost:0/fruit@1.0.5"),
- PackageUri("package://localhost:0/fruit@1.1.0")
+ PackageUri("package://localhost:0/fruit@1.1.0"),
),
- noTransitive = true
+ noTransitive = true,
)
cmd.run()
assertThat(tempDir.resolve("package-2/localhost(3a)0/birds@0.5.0/birds@0.5.0.zip")).exists()
@@ -75,7 +75,7 @@ class CliPackageDownloaderTest {
moduleCacheDir = ".my-cache"
}
"""
- .trimIndent()
+ .trimIndent(),
)
val cmd =
@@ -84,10 +84,10 @@ class CliPackageDownloaderTest {
CliBaseOptions(
workingDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris = listOf(PackageUri("package://localhost:0/birds@0.5.0")),
- noTransitive = true
+ noTransitive = true,
)
cmd.run()
assertThat(tempDir.resolve(".my-cache/package-2/localhost(3a)0/birds@0.5.0/birds@0.5.0.zip"))
@@ -104,13 +104,13 @@ class CliPackageDownloaderTest {
CliBaseOptions(
moduleCacheDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris =
listOf(
- PackageUri("package://localhost:0/birds@0.5.0::sha256:${PackageServer.BIRDS_SHA}"),
+ PackageUri("package://localhost:0/birds@0.5.0::sha256:${PackageServer.BIRDS_SHA}")
),
- noTransitive = true
+ noTransitive = true,
)
cmd.run()
assertThat(tempDir.resolve("package-2/localhost(3a)0/birds@0.5.0/birds@0.5.0.zip")).exists()
@@ -125,13 +125,13 @@ class CliPackageDownloaderTest {
CliBaseOptions(
moduleCacheDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris =
listOf(
- PackageUri("package://localhost:0/birds@0.5.0::sha256:intentionallyBogusChecksum"),
+ PackageUri("package://localhost:0/birds@0.5.0::sha256:intentionallyBogusChecksum")
),
- noTransitive = true
+ noTransitive = true,
)
assertThatCode { cmd.run() }
.hasMessage(
@@ -152,7 +152,7 @@ class CliPackageDownloaderTest {
CliPackageDownloader(
baseOptions = CliBaseOptions(workingDir = tempDir, noCache = true),
packageUris = listOf(PackageUri("package://localhost:0/birds@0.5.0")),
- noTransitive = true
+ noTransitive = true,
)
assertThatCode { cmd.run() }
.hasMessage("Cannot download packages because no cache directory is specified.")
@@ -166,10 +166,10 @@ class CliPackageDownloaderTest {
CliBaseOptions(
moduleCacheDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris = listOf(PackageUri("package://localhost:0/badChecksum@1.0.0")),
- noTransitive = true
+ noTransitive = true,
)
assertThatCode { cmd.run() }
.hasMessageStartingWith(
@@ -185,14 +185,14 @@ class CliPackageDownloaderTest {
CliBaseOptions(
moduleCacheDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris =
listOf(
PackageUri("package://localhost:0/badChecksum@1.0.0"),
- PackageUri("package://bogus.domain/notAPackage@1.0.0")
+ PackageUri("package://bogus.domain/notAPackage@1.0.0"),
),
- noTransitive = true
+ noTransitive = true,
)
assertThatCode { cmd.run() }
.hasMessage(
@@ -222,10 +222,10 @@ class CliPackageDownloaderTest {
CliBaseOptions(
moduleCacheDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
- testPort = server.port
+ testPort = server.port,
),
packageUris = listOf(PackageUri("package://localhost:0/birds@0.5.0")),
- noTransitive = false
+ noTransitive = false,
)
.run()
assertThat(tempDir.resolve("package-2/localhost(3a)0/birds@0.5.0/birds@0.5.0.zip")).exists()
diff --git a/pkl-cli/src/test/kotlin/org/pkl/cli/testExtensions.kt b/pkl-cli/src/test/kotlin/org/pkl/cli/testExtensions.kt
index 6b292765..1d63de41 100644
--- a/pkl-cli/src/test/kotlin/org/pkl/cli/testExtensions.kt
+++ b/pkl-cli/src/test/kotlin/org/pkl/cli/testExtensions.kt
@@ -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.
@@ -17,7 +17,7 @@ package org.pkl.cli
import java.nio.charset.StandardCharsets
import java.nio.file.Path
-import org.pkl.commons.createParentDirectories
+import kotlin.io.path.createParentDirectories
import org.pkl.commons.writeString
fun Path.writeFile(fileName: String, contents: String): Path {
diff --git a/pkl-codegen-java/gradle.lockfile b/pkl-codegen-java/gradle.lockfile
index 4710d629..b3cd061e 100644
--- a/pkl-codegen-java/gradle.lockfile
+++ b/pkl-codegen-java/gradle.lockfile
@@ -7,26 +7,32 @@ com.palantir.javapoet:javapoet:0.6.0=compileClasspath,implementationDependencies
com.tunnelvisionlabs:antlr4-runtime:4.9.0=runtimeClasspath,testRuntimeClasspath
io.leangen.geantyref:geantyref:1.3.16=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=runtimeClasspath,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=runtimeClasspath,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-common:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+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
diff --git a/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/CliJavaCodeGenerator.kt b/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/CliJavaCodeGenerator.kt
index 2c251ea8..cc4d58fc 100644
--- a/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/CliJavaCodeGenerator.kt
+++ b/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/CliJavaCodeGenerator.kt
@@ -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.
@@ -16,9 +16,9 @@
package org.pkl.codegen.java
import java.io.IOException
+import kotlin.io.path.createParentDirectories
import org.pkl.commons.cli.CliCommand
import org.pkl.commons.cli.CliException
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.writeString
import org.pkl.core.Closeables
import org.pkl.core.ModuleSource
diff --git a/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt b/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt
index d0cf7636..251c39a3 100644
--- a/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt
+++ b/pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt
@@ -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.
@@ -18,7 +18,6 @@ package org.pkl.codegen.java
import com.palantir.javapoet.*
import java.io.StringWriter
import java.lang.Deprecated
-import java.net.URI
import java.util.*
import java.util.regex.Pattern
import javax.lang.model.element.Modifier
@@ -91,13 +90,13 @@ data class JavaCodeGeneratorOptions(
* Can be used when the class or package name in the generated source code should be different
* from the corresponding name derived from the Pkl module declaration .
*/
- val renames: Map = emptyMap()
+ val renames: Map = emptyMap(),
)
/** Entrypoint for the Java code generator API. */
class JavaCodeGenerator(
private val schema: ModuleSchema,
- private val codegenOptions: JavaCodeGeneratorOptions
+ private val codegenOptions: JavaCodeGeneratorOptions,
) {
companion object {
@@ -115,7 +114,7 @@ class JavaCodeGenerator(
private val PMODULE = ClassName.get(PModule::class.java)
private val PCLASS = ClassName.get(PClass::class.java)
private val PATTERN = ClassName.get(Pattern::class.java)
- private val URI = ClassName.get(URI::class.java)
+ private val URI = ClassName.get(java.net.URI::class.java)
private val VERSION = ClassName.get(Version::class.java)
private const val PROPERTY_PREFIX: String = "org.pkl.config.java.mapper."
@@ -241,7 +240,7 @@ class JavaCodeGenerator(
fun addCtorParameter(
builder: MethodSpec.Builder,
propJavaName: String,
- property: PClass.Property
+ property: PClass.Property,
) {
val paramBuilder = ParameterSpec.builder(property.type.toJavaPoetName(), propJavaName)
if (paramsAnnotationName != null) {
@@ -305,7 +304,7 @@ class JavaCodeGenerator(
"if (!\$T.equals(this.$accessor, other.$accessor)) return false",
Objects::class.java,
propertyName,
- propertyName
+ propertyName,
)
}
@@ -326,7 +325,7 @@ class JavaCodeGenerator(
builder.addStatement(
"result = 31 * result + \$T.hashCode($accessor)",
Objects::class.java,
- propertyName
+ propertyName,
)
}
@@ -348,7 +347,7 @@ class JavaCodeGenerator(
appendBuilder.addStatement(
"appendProperty(builder, \$S, this.\$N)",
propertyName,
- propertyName
+ propertyName,
)
}
@@ -357,7 +356,7 @@ class JavaCodeGenerator(
"\$T builder = new \$T(\$L)",
StringBuilder::class.java,
StringBuilder::class.java,
- builderSize
+ builderSize,
)
.addStatement("builder.append(\$T.class.getSimpleName()).append(\" {\")", javaPoetClassName)
.addCode(appendBuilder.build())
@@ -381,7 +380,7 @@ class JavaCodeGenerator(
annotations: Collection,
hasJavadoc: Boolean,
addAnnotation: (Class<*>) -> Unit,
- addJavadoc: (String) -> Unit
+ addJavadoc: (String) -> Unit,
) {
annotations
.firstOrNull { it.classInfo == PClassInfo.Deprecated }
@@ -417,7 +416,7 @@ class JavaCodeGenerator(
property.annotations,
hasJavadoc,
{ builder.addAnnotation(it) },
- { builder.addJavadoc(it) }
+ { builder.addJavadoc(it) },
)
builder.addModifiers(Modifier.PUBLIC)
}
@@ -430,7 +429,7 @@ class JavaCodeGenerator(
fun generateGetter(
propertyName: String,
property: PClass.Property,
- isOverridden: Boolean
+ isOverridden: Boolean,
): MethodSpec {
val propertyType = property.type
val isBooleanProperty =
@@ -460,7 +459,7 @@ class JavaCodeGenerator(
property.annotations,
hasJavadoc,
{ builder.addAnnotation(it) },
- { builder.addJavadoc(it) }
+ { builder.addJavadoc(it) },
)
return builder.build()
@@ -479,7 +478,7 @@ class JavaCodeGenerator(
property.annotations,
false,
{ methodBuilder.addAnnotation(it) },
- { methodBuilder.addJavadoc(it) }
+ { methodBuilder.addJavadoc(it) },
)
val codeBuilder = CodeBlock.builder()
@@ -535,7 +534,7 @@ class JavaCodeGenerator(
AnnotationSpec.builder(
ClassName.get(
"org.springframework.boot.context.properties",
- "ConfigurationProperties"
+ "ConfigurationProperties",
)
)
// use "value" instead of "prefix" to entice JavaPoet to generate a single-line
@@ -572,7 +571,7 @@ class JavaCodeGenerator(
pClass.annotations,
hasJavadoc,
{ builder.addAnnotation(it) },
- { builder.addJavadoc(it) }
+ { builder.addJavadoc(it) },
)
if (!isModuleClass) {
@@ -632,7 +631,7 @@ class JavaCodeGenerator(
private fun generateEnumTypeSpec(
typeAlias: TypeAlias,
- stringLiterals: Set
+ stringLiterals: Set,
): TypeSpec.Builder {
val enumConstantToPklNames =
stringLiterals
@@ -674,7 +673,7 @@ class JavaCodeGenerator(
for ((enumConstantName, pklName) in enumConstantToPklNames) {
builder.addEnumConstant(
enumConstantName,
- TypeSpec.anonymousClassBuilder("\$S", pklName).build()
+ TypeSpec.anonymousClassBuilder("\$S", pklName).build(),
)
}
@@ -694,7 +693,7 @@ class JavaCodeGenerator(
.addStatement(
"\$T lines = \$T.toString(value).split(\"\\n\")",
ArrayTypeName.of(String::class.java),
- Objects::class.java
+ Objects::class.java,
)
.addStatement("builder.append(lines[0])")
.beginControlFlow("for (int i = 1; i < lines.length; i++)")
@@ -718,7 +717,7 @@ class JavaCodeGenerator(
/** Generate `List extends Foo>` if `Foo` is `abstract` or `open`, to allow subclassing. */
private fun PType.toJavaPoetTypeArgumentName(): TypeName {
- val baseName = toJavaPoetName(nullable = false, boxed = true)
+ val baseName = toJavaPoetName(boxed = true)
return if (this is PType.Class && (pClass.isAbstract || pClass.isOpen)) {
WildcardTypeName.subtypeOf(baseName)
} else {
@@ -757,7 +756,7 @@ class JavaCodeGenerator(
OBJECT
} else {
typeArguments[1].toJavaPoetTypeArgumentName()
- }
+ },
)
.nullableIf(nullable)
PClassInfo.Collection ->
@@ -767,7 +766,7 @@ class JavaCodeGenerator(
OBJECT
} else {
typeArguments[0].toJavaPoetTypeArgumentName()
- }
+ },
)
.nullableIf(nullable)
PClassInfo.List,
@@ -778,7 +777,7 @@ class JavaCodeGenerator(
OBJECT
} else {
typeArguments[0].toJavaPoetTypeArgumentName()
- }
+ },
)
.nullableIf(nullable)
}
@@ -789,7 +788,7 @@ class JavaCodeGenerator(
OBJECT
} else {
typeArguments[0].toJavaPoetTypeArgumentName()
- }
+ },
)
.nullableIf(nullable)
PClassInfo.Map,
@@ -805,7 +804,7 @@ class JavaCodeGenerator(
OBJECT
} else {
typeArguments[1].toJavaPoetTypeArgumentName()
- }
+ },
)
.nullableIf(nullable)
PClassInfo.Module -> PMODULE.nullableIf(nullable)
@@ -942,5 +941,5 @@ internal val javaReservedWords =
"try",
"void",
"volatile",
- "while"
+ "while",
)
diff --git a/pkl-codegen-java/src/test/kotlin/org/pkl/codegen/java/PklModule.kt b/pkl-codegen-java/src/test/kotlin/org/pkl/codegen/java/PklModule.kt
index 07f88605..49a0cb55 100644
--- a/pkl-codegen-java/src/test/kotlin/org/pkl/codegen/java/PklModule.kt
+++ b/pkl-codegen-java/src/test/kotlin/org/pkl/codegen/java/PklModule.kt
@@ -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.
@@ -16,7 +16,7 @@
package org.pkl.codegen.java
import java.nio.file.Path
-import org.pkl.commons.createParentDirectories
+import kotlin.io.path.createParentDirectories
import org.pkl.commons.writeString
data class PklModule(val name: String, val content: String) {
diff --git a/pkl-codegen-kotlin/gradle.lockfile b/pkl-codegen-kotlin/gradle.lockfile
index 89fb22a2..54048da7 100644
--- a/pkl-codegen-kotlin/gradle.lockfile
+++ b/pkl-codegen-kotlin/gradle.lockfile
@@ -7,29 +7,44 @@ com.squareup:kotlinpoet:1.6.0=compileClasspath,implementationDependenciesMetadat
com.tunnelvisionlabs:antlr4-runtime:4.9.0=runtimeClasspath,testRuntimeClasspath
io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
net.bytebuddy:byte-buddy:1.15.11=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testRuntimeClasspath
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=runtimeClasspath,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-compiler-embeddable:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-daemon-client:1.7.10=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-daemon-embeddable:1.7.10=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:1.7.10=kotlinKlibCommonizerClasspath
-org.jetbrains.kotlin:kotlin-reflect:1.7.10=compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-script-runtime:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-script-util:1.7.10=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-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,testRuntimeOnlyDependenciesMetadata
-org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
-org.jetbrains:annotations:13.0=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
+org.jetbrains.intellij.deps:trove4j:1.0.20200330=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
+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,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-compiler-runner:2.0.21=kotlinBuildToolsApiClasspath
+org.jetbrains.kotlin:kotlin-daemon-client:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-daemon-client:2.0.21=kotlinBuildToolsApiClasspath
+org.jetbrains.kotlin:kotlin-daemon-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testRuntimeClasspath
+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-reflect:2.0.21=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-script-runtime:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-script-runtime:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-script-util:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-scripting-common:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-scripting-jsr223:2.0.21=testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-scripting-jvm-host:2.0.21=testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-stdlib-common:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+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:1.7.10=testRuntimeOnlyDependenciesMetadata
+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.5.0=testRuntimeOnlyDependenciesMetadata
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,testRuntimeClasspath
+org.jetbrains:annotations:13.0=compileClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
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
diff --git a/pkl-codegen-kotlin/pkl-codegen-kotlin.gradle.kts b/pkl-codegen-kotlin/pkl-codegen-kotlin.gradle.kts
index b8e0916c..9fe0fa55 100644
--- a/pkl-codegen-kotlin/pkl-codegen-kotlin.gradle.kts
+++ b/pkl-codegen-kotlin/pkl-codegen-kotlin.gradle.kts
@@ -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.
@@ -43,12 +43,13 @@ dependencies {
api(projects.pklCommonsCli)
api(projects.pklCore)
- implementation(libs.kotlinPoet)
+ implementation(libs.kotlinPoet) {
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
+ }
implementation(libs.kotlinReflect)
testImplementation(projects.pklConfigKotlin)
testImplementation(projects.pklCommonsTest)
- testImplementation(libs.kotlinCompilerEmbeddable)
- testRuntimeOnly(libs.kotlinScriptingCompilerEmbeddable)
- testRuntimeOnly(libs.kotlinScriptUtil)
+ testRuntimeOnly(libs.kotlinScripting)
}
diff --git a/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/CliKotlinCodeGenerator.kt b/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/CliKotlinCodeGenerator.kt
index ac0b5860..16b7d377 100644
--- a/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/CliKotlinCodeGenerator.kt
+++ b/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/CliKotlinCodeGenerator.kt
@@ -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.
@@ -16,9 +16,9 @@
package org.pkl.codegen.kotlin
import java.io.IOException
+import kotlin.io.path.createParentDirectories
import org.pkl.commons.cli.CliCommand
import org.pkl.commons.cli.CliException
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.writeString
import org.pkl.core.Closeables
import org.pkl.core.ModuleSource
diff --git a/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt b/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt
index a99c9d45..4666e291 100644
--- a/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt
+++ b/pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt
@@ -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.
@@ -18,7 +18,6 @@ package org.pkl.codegen.kotlin
import com.squareup.kotlinpoet.*
import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy
import java.io.StringWriter
-import java.net.URI
import java.util.*
import org.pkl.commons.NameMapper
import org.pkl.core.*
@@ -76,7 +75,7 @@ class KotlinCodeGenerator(
private val PMODULE = PModule::class.asClassName()
private val PCLASS = PClass::class.asClassName()
private val REGEX = Regex::class.asClassName()
- private val URI = URI::class.asClassName()
+ private val URI = java.net.URI::class.asClassName()
private val VERSION = Version::class.asClassName()
private const val PROPERTY_PREFIX: String = "org.pkl.config.java.mapper."
@@ -134,7 +133,7 @@ class KotlinCodeGenerator(
fun generateCompanionRelatedCode(
builder: TypeSpec.Builder,
- isModuleType: Boolean = false
+ isModuleType: Boolean = false,
): TypeSpec.Builder {
// ensure that at most one companion object is generated for this type
val companionObjectBuilder: Lazy = lazy {
@@ -153,7 +152,7 @@ class KotlinCodeGenerator(
"serialVersionUID",
Long::class.java,
KModifier.PRIVATE,
- KModifier.CONST
+ KModifier.CONST,
)
.initializer("0L")
.build()
@@ -307,7 +306,7 @@ class KotlinCodeGenerator(
builder.addStatement(
"if (this.$accessor != other.$accessor) return false",
propertyName,
- propertyName
+ propertyName,
)
}
@@ -329,7 +328,7 @@ class KotlinCodeGenerator(
builder.addStatement(
"result = 31 * result + %T.hashCode($accessor)",
Objects::class,
- propertyName
+ propertyName,
)
}
@@ -355,14 +354,14 @@ class KotlinCodeGenerator(
}
add(")")
}
- .build()
+ .build(),
)
.build()
}
fun generateDeprecation(
annotations: Collection,
- addAnnotation: (AnnotationSpec) -> Unit
+ addAnnotation: (AnnotationSpec) -> Unit,
) {
annotations
.firstOrNull { it.classInfo == PClassInfo.Deprecated }
@@ -511,7 +510,7 @@ class KotlinCodeGenerator(
private fun generateEnumTypeSpec(
typeAlias: TypeAlias,
- stringLiterals: Set
+ stringLiterals: Set,
): TypeSpec.Builder {
val enumConstantToPklNames =
stringLiterals
@@ -545,7 +544,7 @@ class KotlinCodeGenerator(
for ((enumConstantName, pklName) in enumConstantToPklNames) {
builder.addEnumConstant(
enumConstantName,
- TypeSpec.anonymousClassBuilder().addSuperclassConstructorParameter("%S", pklName).build()
+ TypeSpec.anonymousClassBuilder().addSuperclassConstructorParameter("%S", pklName).build(),
)
}
@@ -636,7 +635,7 @@ class KotlinCodeGenerator(
PClassInfo.Pair ->
KOTLIN_PAIR.parameterizedBy(
if (typeArguments.isEmpty()) ANY_NULL else typeArguments[0].toKotlinPoetName(),
- if (typeArguments.isEmpty()) ANY_NULL else typeArguments[1].toKotlinPoetName()
+ if (typeArguments.isEmpty()) ANY_NULL else typeArguments[1].toKotlinPoetName(),
)
PClassInfo.Collection ->
COLLECTION.parameterizedBy(
@@ -655,7 +654,7 @@ class KotlinCodeGenerator(
PClassInfo.Mapping ->
MAP.parameterizedBy(
if (typeArguments.isEmpty()) ANY_NULL else typeArguments[0].toKotlinPoetName(),
- if (typeArguments.isEmpty()) ANY_NULL else typeArguments[1].toKotlinPoetName()
+ if (typeArguments.isEmpty()) ANY_NULL else typeArguments[1].toKotlinPoetName(),
)
PClassInfo.Module -> PMODULE
PClassInfo.Class -> PCLASS
diff --git a/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/InMemoryKotlinCompiler.kt b/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/InMemoryKotlinCompiler.kt
index 5fbd9f51..8205bd5a 100644
--- a/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/InMemoryKotlinCompiler.kt
+++ b/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/InMemoryKotlinCompiler.kt
@@ -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.
@@ -20,17 +20,11 @@ import javax.script.ScriptException
import kotlin.reflect.KClass
import kotlin.text.RegexOption.MULTILINE
import kotlin.text.RegexOption.UNIX_LINES
-import org.jetbrains.kotlin.cli.common.environment.setIdeaIoUseFallback
class CompilationFailedException(msg: String?, cause: Throwable? = null) :
RuntimeException(msg, cause)
object InMemoryKotlinCompiler {
- init {
- // prevent "Unable to load JNA library" warning
- setIdeaIoUseFallback()
- }
-
// Implementation notes:
// * all [sourceFiles] are currently combined into a single file
// * implementation makes assumptions about structure of generated source files
@@ -43,14 +37,16 @@ object InMemoryKotlinCompiler {
"^(data |open |enum )?class\\s+(\\w+) *(\\([^)]*\\))?.*$\\n((^ .*\\n|^$\\n)*)",
transform: (String, String) -> Sequence> = { name, body ->
sequenceOf(Pair(name, prefix + name)) + body.findClasses("$prefix$name.")
- }
+ },
): Sequence> = // (simpleName1, qualifiedName1), ...
Regex(regex, setOf(MULTILINE, UNIX_LINES)).findAll(this).flatMap {
transform(it.groupValues[nameGroup], it.groupValues[bodyGroup].trimIndent())
}
fun String.findOuterObjects(): Sequence> = // (simpleName, qualifiedName)
- findClasses("", 1, 2, "^object\\s+(\\w+).*$\n((^ .*$\n|^$\n)*)") { name, body ->
+ findClasses(nameGroup = 1, bodyGroup = 2, regex = "^object\\s+(\\w+).*$\n((^ .*$\n|^$\n)*)") {
+ name,
+ body ->
body.findClasses("$name.")
}
diff --git a/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt b/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt
index cc2749e9..d096c342 100644
--- a/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt
+++ b/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt
@@ -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.
@@ -28,6 +28,7 @@ import org.junit.jupiter.api.assertAll
import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.io.TempDir
+import org.pkl.commons.test.ReflectionUtils.enumValues
import org.pkl.core.*
import org.pkl.core.util.IoUtils
@@ -67,7 +68,7 @@ class KotlinCodeGeneratorTest {
"do",
"when",
"interface",
- "typeof"
+ "typeof",
)
private val simpleClass: KClass<*> by lazy {
@@ -139,7 +140,7 @@ class KotlinCodeGeneratorTest {
pklCode: String,
generateKdoc: Boolean = false,
generateSpringBootConfig: Boolean = false,
- implementSerializable: Boolean = false
+ implementSerializable: Boolean = false,
): KotlinSourceCode {
val module = Evaluator.preconfigured().evaluateSchema(ModuleSource.text(pklCode))
@@ -150,8 +151,8 @@ class KotlinCodeGeneratorTest {
KotlinCodeGeneratorOptions(
generateKdoc = generateKdoc,
generateSpringBootConfig = generateSpringBootConfig,
- implementSerializable = implementSerializable
- )
+ implementSerializable = implementSerializable,
+ ),
)
return KotlinSourceCode(generator.kotlinFile)
}
@@ -435,7 +436,7 @@ class KotlinCodeGeneratorTest {
"digit-1" to "DIGIT_1",
"42" to "_42",
"àœü" to "ÀŒÜ",
- "日本-つくば" to "日本_つくば"
+ "日本-つくば" to "日本_つくば",
)
val kotlinCode =
generateKotlinCode(
@@ -445,27 +446,16 @@ class KotlinCodeGeneratorTest {
"""
.trimIndent()
)
- val kotlinClass = kotlinCode.compile().getValue("MyTypeAlias").java
+ val kotlinClass = kotlinCode.compile().getValue("MyTypeAlias")
- assertThat(kotlinClass.enumConstants.size)
+ assertThat(kotlinClass.enumValues().size)
.isEqualTo(cases.size) // make sure zip doesn't drop cases
assertAll(
- "generated enum constants have correct names",
- kotlinClass.declaredFields.zip(cases) { field, (_, kotlinName) ->
+ kotlinClass.enumValues().zip(cases) { enumValue, (pklName, kotlinName) ->
{
- assertThat(field.name).isEqualTo(kotlinName)
- Unit
- }
- }
- )
-
- assertAll(
- "toString() returns Pkl name",
- kotlinClass.enumConstants.zip(cases) { enumConstant, (pklName, _) ->
- {
- assertThat(enumConstant.toString()).isEqualTo(pklName)
- Unit
+ assertThat(enumValue.name).isEqualTo(kotlinName)
+ assertThat(enumValue.toString()).isEqualTo(pklName)
}
}
)
@@ -1048,7 +1038,7 @@ class KotlinCodeGeneratorTest {
typealias Email = String(contains("@"))
"""
.trimIndent(),
- generateKdoc = true
+ generateKdoc = true,
)
assertThat(kotlinCode).compilesSuccessfully().isEqualToResourceFile("Kdoc.kotlin")
@@ -1066,7 +1056,7 @@ class KotlinCodeGeneratorTest {
class Product
"""
.trimIndent(),
- generateKdoc = true
+ generateKdoc = true,
)
assertThat(kotlinCode)
@@ -1428,7 +1418,7 @@ class KotlinCodeGeneratorTest {
}
"""
.trimIndent(),
- generateSpringBootConfig = true
+ generateSpringBootConfig = true,
)
assertThat(kotlinCode)
@@ -1470,7 +1460,7 @@ class KotlinCodeGeneratorTest {
pigeon: Person
"""
- .trimIndent()
+ .trimIndent(),
)
val client =
@@ -1485,7 +1475,7 @@ class KotlinCodeGeneratorTest {
parrot: library.Person
"""
- .trimIndent()
+ .trimIndent(),
)
val kotlinSourceFiles = generateFiles(library, client)
@@ -1520,7 +1510,7 @@ class KotlinCodeGeneratorTest {
pigeon: Person
"""
- .trimIndent()
+ .trimIndent(),
)
val derived =
@@ -1535,7 +1525,7 @@ class KotlinCodeGeneratorTest {
person1: Person
person2: Person2
"""
- .trimIndent()
+ .trimIndent(),
)
val kotlinSourceFiles = generateFiles(base, derived)
@@ -1584,7 +1574,7 @@ class KotlinCodeGeneratorTest {
typealias Version = "LATEST"|String
"""
- .trimIndent()
+ .trimIndent(),
)
val moduleTwo =
@@ -1597,7 +1587,7 @@ class KotlinCodeGeneratorTest {
v: Version = "1.2.3"
"""
- .trimIndent()
+ .trimIndent(),
)
val kotlinSourceFiles = generateFiles(moduleOne, moduleTwo)
@@ -1638,7 +1628,7 @@ class KotlinCodeGeneratorTest {
prop: Int
}
"""
- .trimIndent()
+ .trimIndent(),
)
val generated = generateFiles(pklModule)
val expectedPropertyFile =
@@ -1692,7 +1682,7 @@ class KotlinCodeGeneratorTest {
abstract class NotSerializable
"""
.trimIndent(),
- implementSerializable = true
+ implementSerializable = true,
)
assertThat(kotlinCode)
@@ -1731,7 +1721,7 @@ class KotlinCodeGeneratorTest {
smallStruct,
Regex("(i?)\\w*"),
smallStruct,
- enumValue
+ enumValue,
)
fun confirmSerDe(instance: Any) {
@@ -1777,7 +1767,7 @@ class KotlinCodeGeneratorTest {
street: String
}
""",
- implementSerializable = true
+ implementSerializable = true,
)
assertThat(kotlinCode)
@@ -1814,7 +1804,7 @@ class KotlinCodeGeneratorTest {
someProp: String
"""
- .trimIndent()
+ .trimIndent(),
)
)
assertThat(kotlinCode).containsKey("kotlin/Foo(2a)Bar.kt")
@@ -1840,7 +1830,7 @@ class KotlinCodeGeneratorTest {
bar: Int = 123
"""
- .trimIndent()
+ .trimIndent(),
)
.toMutableMap()
@@ -1882,7 +1872,7 @@ class KotlinCodeGeneratorTest {
baz: String
"""
- .trimIndent()
+ .trimIndent(),
)
.toMutableMap()
@@ -1897,7 +1887,7 @@ class KotlinCodeGeneratorTest {
// ---
"kotlin/w/org/baz/Module3.kt" to listOf("package w.org.baz", "data class Module3("),
"$MAPPER_PREFIX/org.baz.Module3.properties" to
- listOf("org.pkl.config.java.mapper.org.baz.Module3\\#ModuleClass=w.org.baz.Module3")
+ listOf("org.pkl.config.java.mapper.org.baz.Module3\\#ModuleClass=w.org.baz.Module3"),
)
}
@@ -1909,7 +1899,7 @@ class KotlinCodeGeneratorTest {
mapOf(
"org.foo" to "com.foo.x",
"org.bar.Module2" to "org.bar.RenamedModule",
- "org.baz" to "com.baz.a.b"
+ "org.baz" to "com.baz.a.b",
)
)
.generateFiles(
@@ -1944,7 +1934,7 @@ class KotlinCodeGeneratorTest {
owner: Module2.Group
}
"""
- .trimIndent()
+ .trimIndent(),
)
files.validateContents(
@@ -1961,7 +1951,7 @@ class KotlinCodeGeneratorTest {
"package org.bar",
"import com.foo.x.Module1",
"object RenamedModule {",
- "val owner: Module1.Person"
+ "val owner: Module1.Person",
),
"$MAPPER_PREFIX/org.bar.Module2.properties" to
listOf(
@@ -1974,7 +1964,7 @@ class KotlinCodeGeneratorTest {
"package com.baz.a.b",
"import org.bar.RenamedModule",
"object Module3 {",
- "val owner: RenamedModule.Group"
+ "val owner: RenamedModule.Group",
),
"$MAPPER_PREFIX/org.baz.Module3.properties" to
listOf(
@@ -2004,7 +1994,7 @@ class KotlinCodeGeneratorTest {
bar: Int = 123
"""
- .trimIndent()
+ .trimIndent(),
)
files.validateContents(
@@ -2087,7 +2077,7 @@ class KotlinCodeGeneratorTest {
Regex("(i?)\\w*"),
other,
other,
- enumValue
+ enumValue,
)
return other to propertyTypes
@@ -2099,7 +2089,7 @@ class KotlinCodeGeneratorTest {
private class KotlinSourceCodeAssert(actual: KotlinSourceCode) :
AbstractAssert(
actual,
- KotlinSourceCodeAssert::class.java
+ KotlinSourceCodeAssert::class.java,
) {
fun contains(expected: String): KotlinSourceCodeAssert {
if (!actual.text.contains(expected)) {
diff --git a/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/PklModule.kt b/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/PklModule.kt
index ae6dd2d2..4dad0579 100644
--- a/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/PklModule.kt
+++ b/pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/PklModule.kt
@@ -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.
@@ -16,7 +16,7 @@
package org.pkl.codegen.kotlin
import java.nio.file.Path
-import org.pkl.commons.createParentDirectories
+import kotlin.io.path.createParentDirectories
import org.pkl.commons.writeString
data class PklModule(val name: String, val content: String) {
diff --git a/pkl-codegen-kotlin/src/test/resources/META-INF/services/javax.script.ScriptEngineFactory b/pkl-codegen-kotlin/src/test/resources/META-INF/services/javax.script.ScriptEngineFactory
deleted file mode 100644
index f8f59003..00000000
--- a/pkl-codegen-kotlin/src/test/resources/META-INF/services/javax.script.ScriptEngineFactory
+++ /dev/null
@@ -1 +0,0 @@
-org.jetbrains.kotlin.script.jsr223.KotlinJsr223JvmLocalScriptEngineFactory
\ No newline at end of file
diff --git a/pkl-commons-cli/gradle.lockfile b/pkl-commons-cli/gradle.lockfile
index 26b173e0..5681fe0c 100644
--- a/pkl-commons-cli/gradle.lockfile
+++ b/pkl-commons-cli/gradle.lockfile
@@ -5,26 +5,32 @@ com.github.ajalt.clikt:clikt-jvm:3.5.4=compileClasspath,runtimeClasspath,testCom
com.github.ajalt.clikt:clikt:3.5.4=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
com.tunnelvisionlabs:antlr4-runtime:4.9.0=runtimeClasspath,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=runtimeClasspath,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=runtimeClasspath,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-common:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+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
diff --git a/pkl-commons-cli/pkl-commons-cli.gradle.kts b/pkl-commons-cli/pkl-commons-cli.gradle.kts
index 477422fc..94c74039 100644
--- a/pkl-commons-cli/pkl-commons-cli.gradle.kts
+++ b/pkl-commons-cli/pkl-commons-cli.gradle.kts
@@ -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.
@@ -24,7 +24,7 @@ dependencies {
api(libs.clikt) {
// force clikt to use our version of the kotlin stdlib
exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-jdk8")
- exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib-common")
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-reflect")
}
implementation(projects.pklCommons)
diff --git a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseCommand.kt b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseCommand.kt
index 0de24890..c0b031fd 100644
--- a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseCommand.kt
+++ b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseCommand.kt
@@ -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.
@@ -19,10 +19,6 @@ import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.groups.provideDelegate
abstract class BaseCommand(name: String, helpLink: String, help: String = "") :
- CliktCommand(
- name = name,
- help = help,
- epilog = "For more information, visit $helpLink",
- ) {
- val baseOptions by BaseOptions()
+ CliktCommand(name = name, help = help, epilog = "For more information, visit $helpLink") {
+ val baseOptions: BaseOptions by BaseOptions()
}
diff --git a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt
index 097e1277..d5869dc5 100644
--- a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt
+++ b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/BaseOptions.kt
@@ -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.
@@ -82,7 +82,9 @@ class BaseOptions : OptionGroup() {
fun OptionWithValues.parseExternalReader(
delimiter: String
): OptionWithValues<
- Pair?, Pair, Pair
+ Pair?,
+ Pair,
+ Pair,
> {
return splitPair(delimiter).convert {
val cmd = shlex(it.second)
@@ -99,24 +101,24 @@ class BaseOptions : OptionGroup() {
val allowedModules: List by
option(
names = arrayOf("--allowed-modules"),
- help = "URI patterns that determine which modules can be loaded and evaluated."
+ help = "URI patterns that determine which modules can be loaded and evaluated.",
)
.convert("") { Pattern.compile(it) }
- .splitAll(",")
+ .splitAll()
val allowedResources: List by
option(
names = arrayOf("--allowed-resources"),
- help = "URI patterns that determine which external resources can be read."
+ help = "URI patterns that determine which external resources can be read.",
)
.convert("") { Pattern.compile(it) }
- .splitAll(",")
+ .splitAll()
val rootDir: Path? by
option(
names = arrayOf("--root-dir"),
help =
- "Restricts access to file-based modules and resources to those located under the root directory."
+ "Restricts access to file-based modules and resources to those located under the root directory.",
)
.single()
.path()
@@ -129,7 +131,7 @@ class BaseOptions : OptionGroup() {
val workingDir: Path by
option(
names = arrayOf("-w", "--working-dir"),
- help = "Base path that relative module paths are resolved against."
+ help = "Base path that relative module paths are resolved against.",
)
.single()
.path()
@@ -139,7 +141,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("-p", "--property"),
metavar = "",
- help = "External property to set (repeatable)."
+ help = "External property to set (repeatable).",
)
.associateProps()
@@ -148,7 +150,7 @@ class BaseOptions : OptionGroup() {
names = arrayOf("--color"),
metavar = "",
help =
- "Whether to format messages in ANSI color. Possible values of are 'never', 'auto', and 'always'."
+ "Whether to format messages in ANSI color. Possible values of are 'never', 'auto', and 'always'.",
)
.enum { it.name.lowercase() }
.single()
@@ -162,7 +164,7 @@ class BaseOptions : OptionGroup() {
val format: String? by
option(
names = arrayOf("-f", "--format"),
- help = "Output format to generate. <${output.joinToString()}>"
+ help = "Output format to generate. <${output.joinToString()}>",
)
.single()
@@ -170,7 +172,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("-e", "--env-var"),
metavar = "",
- help = "Environment variable to set (repeatable)."
+ help = "Environment variable to set (repeatable).",
)
.associate()
@@ -179,7 +181,7 @@ class BaseOptions : OptionGroup() {
names = arrayOf("--module-path"),
metavar = "",
help =
- "Directories, ZIP archives, or JAR archives to search when resolving `modulepath:` URIs."
+ "Directories, ZIP archives, or JAR archives to search when resolving `modulepath:` URIs.",
)
.path()
.splitAll(File.pathSeparator)
@@ -193,7 +195,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("-t", "--timeout"),
metavar = "",
- help = "Duration, in seconds, after which evaluation of a source module will be timed out."
+ help = "Duration, in seconds, after which evaluation of a source module will be timed out.",
)
.single()
.long()
@@ -203,7 +205,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("--ca-certificates"),
metavar = "",
- help = "Only trust CA certificates from the provided file(s)."
+ help = "Only trust CA certificates from the provided file(s).",
)
.path()
.multiple()
@@ -212,7 +214,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("--http-proxy"),
metavar = "",
- help = "Proxy to use for HTTP(S) connections."
+ help = "Proxy to use for HTTP(S) connections.",
)
.single()
.convert { URI(it) }
@@ -228,7 +230,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("--http-no-proxy"),
metavar = "",
- help = "Hostnames that should not be connected to via a proxy."
+ help = "Hostnames that should not be connected to via a proxy.",
)
.single()
.split(",")
@@ -237,7 +239,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("--external-module-reader"),
metavar = "='[ ]'",
- help = "External reader registrations for module URI schemes"
+ help = "External reader registrations for module URI schemes",
)
.parseExternalReader("=")
.multiple()
@@ -247,7 +249,7 @@ class BaseOptions : OptionGroup() {
option(
names = arrayOf("--external-resource-reader"),
metavar = "='[ ]'",
- help = "External reader registrations for resource URI schemes"
+ help = "External reader registrations for resource URI schemes",
)
.parseExternalReader("=")
.multiple()
@@ -263,7 +265,7 @@ class BaseOptions : OptionGroup() {
fun baseOptions(
modules: List,
projectOptions: ProjectOptions? = null,
- testMode: Boolean = false
+ testMode: Boolean = false,
): CliBaseOptions {
return CliBaseOptions(
sourceModules = modules,
diff --git a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt
index 2e4edf53..d6be52e4 100644
--- a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt
+++ b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/commands/ModulesCommand.kt
@@ -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.
@@ -22,15 +22,11 @@ import com.github.ajalt.clikt.parameters.groups.provideDelegate
import java.net.URI
abstract class ModulesCommand(name: String, helpLink: String, help: String = "") :
- BaseCommand(
- name = name,
- help = help,
- helpLink = helpLink,
- ) {
+ BaseCommand(name = name, help = help, helpLink = helpLink) {
open val modules: List by
argument(name = "", help = "Module paths or URIs to evaluate.")
.convert { BaseOptions.parseModuleName(it) }
.multiple(required = true)
- protected val projectOptions by ProjectOptions()
+ protected val projectOptions: ProjectOptions by ProjectOptions()
}
diff --git a/pkl-commons-test/gradle.lockfile b/pkl-commons-test/gradle.lockfile
index d78ea214..4c2ae987 100644
--- a/pkl-commons-test/gradle.lockfile
+++ b/pkl-commons-test/gradle.lockfile
@@ -2,24 +2,29 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
net.bytebuddy:byte-buddy:1.15.11=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
org.apiguardian:apiguardian-api:1.1.2=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeOnlyDependenciesMetadata
org.assertj:assertj-core:3.27.2=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=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-engine:5.11.4=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-params:5.11.4=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
diff --git a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/FakeHttpResponse.kt b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/FakeHttpResponse.kt
index 5717c145..e2988d6b 100644
--- a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/FakeHttpResponse.kt
+++ b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/FakeHttpResponse.kt
@@ -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.
@@ -25,6 +25,7 @@ import javax.net.ssl.SSLSession
class FakeHttpResponse : HttpResponse {
companion object {
+ @Suppress("unused")
fun withBody(block: FakeHttpResponse.() -> Unit): FakeHttpResponse =
FakeHttpResponse().apply(block)
diff --git a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/InputOutputTestEngine.kt b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/InputOutputTestEngine.kt
index d9ff0ef1..f671f3b7 100644
--- a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/InputOutputTestEngine.kt
+++ b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/InputOutputTestEngine.kt
@@ -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.
@@ -35,7 +35,7 @@ import org.pkl.commons.toNormalizedPathString
abstract class InputOutputTestEngine :
HierarchicalTestEngine() {
- protected val rootProjectDir = FileTestUtils.rootProjectDir
+ protected val rootProjectDir: Path = FileTestUtils.rootProjectDir
protected abstract val testClass: KClass<*>
@@ -67,7 +67,7 @@ abstract class InputOutputTestEngine :
override fun discover(
discoveryRequest: EngineDiscoveryRequest,
- uniqueId: UniqueId
+ uniqueId: UniqueId,
): TestDescriptor {
val packageSelectors = discoveryRequest.getSelectorsByType(PackageSelector::class.java)
val classSelectors = discoveryRequest.getSelectorsByType(ClassSelector::class.java)
@@ -103,7 +103,7 @@ abstract class InputOutputTestEngine :
private fun doDiscover(
dirNode: InputDirNode,
- uniqueIdSelectors: List
+ uniqueIdSelectors: List,
): TestDescriptor {
dirNode.inputDir.useDirectoryEntries { children ->
for (child in children) {
@@ -128,7 +128,7 @@ abstract class InputOutputTestEngine :
dirNode.addChild(
doDiscover(
InputDirNode(childId, child, DirectorySource.from(child.toFile())),
- uniqueIdSelectors
+ uniqueIdSelectors,
)
)
}
@@ -137,12 +137,13 @@ abstract class InputOutputTestEngine :
return dirNode
}
- override fun createExecutionContext(request: ExecutionRequest) = ExecutionContext()
+ override fun createExecutionContext(request: ExecutionRequest): ExecutionContext =
+ ExecutionContext()
private open inner class InputDirNode(
uniqueId: UniqueId,
val inputDir: Path,
- source: TestSource
+ source: TestSource,
) :
AbstractTestDescriptor(uniqueId, inputDir.fileName.toString(), source), Node {
override fun getType() = Type.CONTAINER
@@ -152,7 +153,7 @@ abstract class InputOutputTestEngine :
AbstractTestDescriptor(
uniqueId,
inputFile.fileName.toString(),
- FileSource.from(inputFile.toFile())
+ FileSource.from(inputFile.toFile()),
),
Node {
@@ -160,7 +161,7 @@ abstract class InputOutputTestEngine :
override fun execute(
context: ExecutionContext,
- dynamicTestExecutor: DynamicTestExecutor
+ dynamicTestExecutor: DynamicTestExecutor,
): ExecutionContext {
val (success, actualOutput) = generateOutputFor(inputFile)
diff --git a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/PackageServer.kt b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/PackageServer.kt
index 869afc14..cafaebe7 100644
--- a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/PackageServer.kt
+++ b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/PackageServer.kt
@@ -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.
@@ -22,10 +22,7 @@ import java.security.KeyStore
import java.util.concurrent.Executors
import javax.net.ssl.KeyManagerFactory
import javax.net.ssl.SSLContext
-import kotlin.io.path.inputStream
-import kotlin.io.path.isRegularFile
-import org.pkl.commons.createParentDirectories
-import org.pkl.commons.deleteRecursively
+import kotlin.io.path.*
/**
* A test HTTP server that serves the Pkl packages defined under
@@ -44,6 +41,7 @@ import org.pkl.commons.deleteRecursively
* 4. Use port `0` in your test. `HttpClient` will replace this port with the server port.
* 4. [Close][close] the server, for example in [AfterAll][org.junit.jupiter.api.AfterAll].
*/
+@OptIn(ExperimentalPathApi::class)
class PackageServer : AutoCloseable {
companion object {
const val BIRDS_SHA = "6f18af649b47986530cd6dc39abe17888db2701bc5381c385fb86a32fda2685e"
diff --git a/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/ReflectionUtils.kt b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/ReflectionUtils.kt
new file mode 100644
index 00000000..de75f94c
--- /dev/null
+++ b/pkl-commons-test/src/main/kotlin/org/pkl/commons/test/ReflectionUtils.kt
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.pkl.commons.test
+
+import kotlin.reflect.KClass
+
+object ReflectionUtils {
+ // https://youtrack.jetbrains.com/issue/KT-14743/Reflection-Access-enum-values-and-valueOf-via-KClass#focus=Comments-27-1745309.0-0
+ @Suppress("UNCHECKED_CAST")
+ fun KClass<*>.enumValues(): Array> = java.enumConstants as Array>
+}
diff --git a/pkl-commons/gradle.lockfile b/pkl-commons/gradle.lockfile
index b79814bd..043bba45 100644
--- a/pkl-commons/gradle.lockfile
+++ b/pkl-commons/gradle.lockfile
@@ -2,24 +2,29 @@
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
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.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=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-params:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
diff --git a/pkl-commons/src/main/kotlin/org/pkl/commons/Paths.kt b/pkl-commons/src/main/kotlin/org/pkl/commons/Paths.kt
index dfb40c7c..679dc8e3 100644
--- a/pkl-commons/src/main/kotlin/org/pkl/commons/Paths.kt
+++ b/pkl-commons/src/main/kotlin/org/pkl/commons/Paths.kt
@@ -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.
@@ -20,10 +20,6 @@ import java.nio.charset.Charset
import java.nio.file.*
import java.nio.file.attribute.FileAttribute
import java.util.stream.Stream
-import kotlin.io.path.createDirectories
-import kotlin.io.path.deleteIfExists
-import kotlin.io.path.exists
-import kotlin.io.path.isSymbolicLink
// not stored to avoid build-time initialization by native-image
val currentWorkingDir: Path
@@ -40,38 +36,21 @@ fun Path.walk(maxDepth: Int = Int.MAX_VALUE, vararg options: FileVisitOption): S
fun Path.createTempFile(
prefix: String? = null,
suffix: String? = null,
- vararg attributes: FileAttribute<*>
+ vararg attributes: FileAttribute<*>,
): Path = Files.createTempFile(this, prefix, suffix, *attributes)
-@Throws(IOException::class)
-fun Path.createParentDirectories(vararg attributes: FileAttribute<*>): Path = apply {
- // Files.createDirectories will throw a FileAlreadyExistsException
- // if the file exists and is not a directory and symlinks are never
- // directories
- if (parent?.isSymbolicLink() != true) {
- parent?.createDirectories(*attributes)
- }
-}
-
/** [Files.writeString] seems more efficient than [kotlin.io.path.writeText]. */
@Throws(IOException::class)
fun Path.writeString(
text: String,
charset: Charset = Charsets.UTF_8,
- vararg options: OpenOption
+ vararg options: OpenOption,
): Path = Files.writeString(this, text, charset, *options)
/** [Files.readString] seems more efficient than [kotlin.io.path.readText]. */
@Throws(IOException::class)
fun Path.readString(charset: Charset = Charsets.UTF_8): String = Files.readString(this, charset)
-@Throws(IOException::class)
-fun Path.deleteRecursively() {
- if (exists()) {
- walk().use { paths -> paths.sorted(Comparator.reverseOrder()).forEach { it.deleteIfExists() } }
- }
-}
-
private val isWindows by lazy { System.getProperty("os.name").contains("Windows") }
/** Copy implementation from IoUtils.toNormalizedPathString */
diff --git a/pkl-commons/src/main/kotlin/org/pkl/commons/Strings.kt b/pkl-commons/src/main/kotlin/org/pkl/commons/Strings.kt
index 0f3a687f..b5191443 100644
--- a/pkl-commons/src/main/kotlin/org/pkl/commons/Strings.kt
+++ b/pkl-commons/src/main/kotlin/org/pkl/commons/Strings.kt
@@ -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.
@@ -18,7 +18,6 @@ package org.pkl.commons
import java.io.File
import java.net.URI
import java.nio.file.Path
-import java.util.*
import java.util.regex.Pattern
fun String.toPath(): Path = Path.of(this)
diff --git a/pkl-config-java/gradle.lockfile b/pkl-config-java/gradle.lockfile
index b58d2b82..07f44ae2 100644
--- a/pkl-config-java/gradle.lockfile
+++ b/pkl-config-java/gradle.lockfile
@@ -8,26 +8,32 @@ com.tunnelvisionlabs:antlr4-runtime:4.9.0=pklCodegenJava,runtimeClasspath,testRu
io.leangen.geantyref:geantyref:1.3.16=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
javax.inject:javax.inject:1=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=pklCodegenJava,runtimeClasspath,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=pklCodegenJava,runtimeClasspath,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=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenJava,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-common:2.0.21=pklCodegenJava
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenJava,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains:annotations:13.0=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenJava,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-engine:5.11.4=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-params:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
diff --git a/pkl-config-kotlin/gradle.lockfile b/pkl-config-kotlin/gradle.lockfile
index 10952dd5..d848baa8 100644
--- a/pkl-config-kotlin/gradle.lockfile
+++ b/pkl-config-kotlin/gradle.lockfile
@@ -7,26 +7,33 @@ com.squareup:kotlinpoet:1.6.0=pklCodegenKotlin
com.tunnelvisionlabs:antlr4-runtime:4.9.0=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
io.leangen.geantyref:geantyref:1.3.16=pklConfigJava,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=pklCodegenKotlin,pklConfigJava,runtimeClasspath,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=pklCodegenKotlin,pklConfigJava,runtimeClasspath,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=compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-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,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenKotlin,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-reflect:2.0.21=compileClasspath,implementationDependenciesMetadata,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+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-common:2.0.21=pklCodegenKotlin
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,pklCodegenKotlin,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=apiDependenciesMetadata,compileClasspath,implementationDependenciesMetadata,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,pklCodegenKotlin,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,pklCodegenKotlin,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=testRuntimeClasspath,testRuntimeOnlyDependenciesMetadata
org.junit.jupiter:junit-jupiter-params:5.11.4=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
diff --git a/pkl-config-kotlin/src/main/kotlin/org/pkl/config/kotlin/ConfigExtensions.kt b/pkl-config-kotlin/src/main/kotlin/org/pkl/config/kotlin/ConfigExtensions.kt
index cd92f10f..6bf47437 100644
--- a/pkl-config-kotlin/src/main/kotlin/org/pkl/config/kotlin/ConfigExtensions.kt
+++ b/pkl-config-kotlin/src/main/kotlin/org/pkl/config/kotlin/ConfigExtensions.kt
@@ -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.
@@ -38,14 +38,15 @@ import org.pkl.config.kotlin.mapper.KotlinConverterFactories
*/
inline fun Config.to(): T {
val javaType = object : JavaType() {}
- val result = `as`(javaType.type)
+ // `as T?` may no longer be required after switching to JSpecify
+ val result = `as`(javaType.type) as T?
if (result == null && null !is T) {
throw ConversionException(
"Expected a non-null value but got `null`. " +
"To allow null values, convert to a nullable Kotlin type, for example `String?`."
)
}
- return result
+ return result as T
}
/**
diff --git a/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/ConfigExtensionsTest.kt b/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/ConfigExtensionsTest.kt
index 61a5c10a..867c628b 100644
--- a/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/ConfigExtensionsTest.kt
+++ b/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/ConfigExtensionsTest.kt
@@ -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.
@@ -171,7 +171,7 @@ class ConfigExtensionsTest {
mapOf(
"l" to SimplePerson("lilly"),
"b" to SimplePerson("bob"),
- "s" to SimplePerson("susan")
+ "s" to SimplePerson("susan"),
)
)
}
@@ -189,14 +189,14 @@ class ConfigExtensionsTest {
mapOf(
"l" to SimplePerson("lilly"),
"b" to SimplePerson("bob"),
- "s" to SimplePerson("susan")
+ "s" to SimplePerson("susan"),
)
)
}
@Test
fun `convert enum with mangled names`() {
- val values = MangledNameEnum.values().map { "\"$it\"" }
+ val values = MangledNameEnum.entries.map { "\"$it\"" }
val config =
evaluator.evaluate(
text(
@@ -208,7 +208,7 @@ class ConfigExtensionsTest {
)
)
val allEnumValues = config["allEnumValues"].to>()
- assertThat(allEnumValues).isEqualTo(MangledNameEnum.values().toSet())
+ assertThat(allEnumValues).isEqualTo(MangledNameEnum.entries.toSet())
}
data class SimplePerson(val name: String)
@@ -218,7 +218,7 @@ class ConfigExtensionsTest {
enum class Hobby {
SWIMMING,
@Suppress("unused") SURFING,
- READING
+ READING,
}
data class Address(val street: T)
@@ -240,7 +240,7 @@ class ConfigExtensionsTest {
class PersonWithDefaults(
val name: String = "Pigeon",
val age: Int = 42,
- val hobbies: List
+ val hobbies: List,
)
@Suppress("NonAsciiCharacters", "EnumEntryName")
@@ -252,6 +252,6 @@ class ConfigExtensionsTest {
_42_FROM_INVALID_START("42-from-invalid-start"),
__EMOJI__("❎Emoji✅✅"),
ÀŒÜ("àœü"),
- 日本_つくば("日本-つくば")
+ 日本_つくば("日本-つくば"),
}
}
diff --git a/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/mapper/KotlinConversionsTest.kt b/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/mapper/KotlinConversionsTest.kt
index 35e94fb9..bf50f1a7 100644
--- a/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/mapper/KotlinConversionsTest.kt
+++ b/pkl-config-kotlin/src/test/kotlin/org/pkl/config/kotlin/mapper/KotlinConversionsTest.kt
@@ -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.
@@ -42,19 +42,19 @@ class KotlinConversionsTest {
@Test
fun pIntToULong() {
- assertThat(KotlinConversions.pIntToULong.converter.convert(0, mapper)).isEqualTo(0UL)
+ assertThat(KotlinConversions.pIntToULong.converter.convert(0L, mapper)).isEqualTo(0UL)
assertThat(KotlinConversions.pIntToULong.converter.convert(Long.MAX_VALUE, mapper))
.isEqualTo(Long.MAX_VALUE.toULong())
assertThrows {
- KotlinConversions.pIntToULong.converter.convert(-1, mapper)
+ KotlinConversions.pIntToULong.converter.convert(-1L, mapper)
}
}
@Test
fun pIntToUInt() {
- assertThat(KotlinConversions.pIntToUInt.converter.convert(0, mapper)).isEqualTo(0u)
+ assertThat(KotlinConversions.pIntToUInt.converter.convert(0L, mapper)).isEqualTo(0u)
assertThat(KotlinConversions.pIntToUInt.converter.convert(UInt.MAX_VALUE.toLong(), mapper))
.isEqualTo(UInt.MAX_VALUE)
@@ -63,12 +63,14 @@ class KotlinConversionsTest {
KotlinConversions.pIntToUInt.converter.convert(UInt.MAX_VALUE.toLong() + 1, mapper)
}
- assertThrows { KotlinConversions.pIntToUInt.converter.convert(-1, mapper) }
+ assertThrows {
+ KotlinConversions.pIntToUInt.converter.convert(-1L, mapper)
+ }
}
@Test
fun pIntToUShort() {
- assertThat(KotlinConversions.pIntToUShort.converter.convert(0, mapper)).isEqualTo(0.toUShort())
+ assertThat(KotlinConversions.pIntToUShort.converter.convert(0L, mapper)).isEqualTo(0.toUShort())
assertThat(KotlinConversions.pIntToUShort.converter.convert(UShort.MAX_VALUE.toLong(), mapper))
.isEqualTo(UShort.MAX_VALUE)
@@ -78,7 +80,7 @@ class KotlinConversionsTest {
}
assertThrows {
- KotlinConversions.pIntToUShort.converter.convert(-1, mapper)
+ KotlinConversions.pIntToUShort.converter.convert(-1L, mapper)
}
}
}
diff --git a/pkl-core/gradle.lockfile b/pkl-core/gradle.lockfile
index 3c750629..6a22b6a7 100644
--- a/pkl-core/gradle.lockfile
+++ b/pkl-core/gradle.lockfile
@@ -7,7 +7,6 @@ com.tunnelvisionlabs:antlr4-annotations:4.9.0=antlr
com.tunnelvisionlabs:antlr4-runtime:4.9.0=antlr,compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
com.tunnelvisionlabs:antlr4:4.9.0=antlr
net.bytebuddy:byte-buddy:1.15.11=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
org.abego.treelayout:org.abego.treelayout.core:1.0.1=antlr
org.antlr:ST4:4.3=antlr
org.antlr:antlr-runtime:3.5.2=antlr
@@ -16,21 +15,27 @@ org.assertj:assertj-core:3.27.2=testCompileClasspath,testImplementationDependenc
org.graalvm.sdk:graal-sdk:23.0.6=compileClasspath,generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=compileClasspath,generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
org.graalvm.truffle:truffle-dsl-processor:23.0.6=annotationProcessor
-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,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
-org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10=kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-scripting-common:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-jvm:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=generatorCompileClasspath,generatorImplementationDependenciesMetadata,generatorRuntimeClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains:annotations:13.0=generatorCompileClasspath,generatorRuntimeClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathGenerator,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/AnalyzerTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/AnalyzerTest.kt
index 4774ecf6..687902f7 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/AnalyzerTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/AnalyzerTest.kt
@@ -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.
@@ -17,10 +17,10 @@ package org.pkl.core
import java.net.URI
import java.nio.file.Path
+import kotlin.io.path.createParentDirectories
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.test.PackageServer
import org.pkl.commons.writeString
import org.pkl.core.http.HttpClient
@@ -36,7 +36,7 @@ class AnalyzerTest {
listOf(ModuleKeyFactories.file, ModuleKeyFactories.standardLibrary, ModuleKeyFactories.pkg),
null,
null,
- HttpClient.dummyClient()
+ HttpClient.dummyClient(),
)
@Test
@@ -62,8 +62,8 @@ class AnalyzerTest {
setOf(
ImportGraph.Import(URI("pkl:base")),
ImportGraph.Import(URI("pkl:json")),
- ImportGraph.Import(URI("pkl:xml"))
- )
+ ImportGraph.Import(URI("pkl:xml")),
+ ),
)
}
@@ -88,8 +88,8 @@ class AnalyzerTest {
file1 to
setOf(ImportGraph.Import(file1), ImportGraph.Import(file2), ImportGraph.Import(file3)),
file2 to emptySet(),
- file3 to emptySet()
- ),
+ file3 to emptySet(),
+ )
)
}
@@ -129,7 +129,7 @@ class AnalyzerTest {
file1 to setOf(ImportGraph.Import(URI("package://localhost:0/birds@0.5.0#/Bird.pkl"))),
URI("package://localhost:0/birds@0.5.0#/Bird.pkl") to
setOf(ImportGraph.Import(URI("package://localhost:0/fruit@1.0.5#/Fruit.pkl"))),
- URI("package://localhost:0/fruit@1.0.5#/Fruit.pkl") to emptySet()
+ URI("package://localhost:0/fruit@1.0.5#/Fruit.pkl") to emptySet(),
)
)
}
@@ -185,11 +185,11 @@ class AnalyzerTest {
ModuleKeyFactories.file,
ModuleKeyFactories.standardLibrary,
ModuleKeyFactories.pkg,
- ModuleKeyFactories.projectpackage
+ ModuleKeyFactories.projectpackage,
),
tempDir.resolve("packages"),
project.dependencies,
- HttpClient.dummyClient()
+ HttpClient.dummyClient(),
)
val file1 =
tempDir
@@ -209,7 +209,7 @@ class AnalyzerTest {
setOf(ImportGraph.Import(URI("projectpackage://localhost:0/birds@0.5.0#/Bird.pkl"))),
URI("projectpackage://localhost:0/birds@0.5.0#/Bird.pkl") to
setOf(ImportGraph.Import(URI("projectpackage://localhost:0/fruit@1.0.5#/Fruit.pkl"))),
- URI("projectpackage://localhost:0/fruit@1.0.5#/Fruit.pkl") to emptySet()
+ URI("projectpackage://localhost:0/fruit@1.0.5#/Fruit.pkl") to emptySet(),
)
)
assertThat(result.resolvedImports)
@@ -219,7 +219,7 @@ class AnalyzerTest {
URI("projectpackage://localhost:0/birds@0.5.0#/Bird.pkl") to
URI("projectpackage://localhost:0/birds@0.5.0#/Bird.pkl"),
URI("projectpackage://localhost:0/fruit@1.0.5#/Fruit.pkl") to
- URI("projectpackage://localhost:0/fruit@1.0.5#/Fruit.pkl")
+ URI("projectpackage://localhost:0/fruit@1.0.5#/Fruit.pkl"),
)
)
}
@@ -297,23 +297,23 @@ class AnalyzerTest {
ModuleKeyFactories.file,
ModuleKeyFactories.standardLibrary,
ModuleKeyFactories.pkg,
- ModuleKeyFactories.projectpackage
+ ModuleKeyFactories.projectpackage,
),
tempDir.resolve("packages"),
project.dependencies,
- HttpClient.dummyClient()
+ HttpClient.dummyClient(),
)
val result = analyzer.importGraph(mainPkl.toUri())
val birdUri = URI("projectpackage://localhost:0/birds@1.0.0#/bird.pkl")
assertThat(result.imports)
.isEqualTo(
- mapOf(mainPkl.toUri() to setOf(ImportGraph.Import(birdUri)), birdUri to emptySet()),
+ mapOf(mainPkl.toUri() to setOf(ImportGraph.Import(birdUri)), birdUri to emptySet())
)
assertThat(result.resolvedImports)
.isEqualTo(
mapOf(
mainPkl.toUri() to mainPkl.toRealPath().toUri(),
- birdUri to birdModule.toRealPath().toUri()
+ birdUri to birdModule.toRealPath().toUri(),
)
)
}
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/DurationTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/DurationTest.kt
index 94bdf98c..298d48c6 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/DurationTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/DurationTest.kt
@@ -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.
@@ -120,6 +120,7 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofNanos(999999999999))
assertThat(Duration(999999999999999.0, NANOS).toJavaDuration())
.isEqualTo(java.time.Duration.ofNanos(999999999999999))
+ @Suppress("FloatingPointLiteralPrecision")
assertThat(Duration(9999999999999999.0, NANOS).toJavaDuration())
.isNotEqualTo(java.time.Duration.ofNanos(9999999999999999))
@@ -133,6 +134,7 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofSeconds(999999999999))
assertThat(Duration(999999999999999.0, SECONDS).toJavaDuration())
.isEqualTo(java.time.Duration.ofSeconds(999999999999999))
+ @Suppress("FloatingPointLiteralPrecision")
assertThat(Duration(9999999999999999.0, SECONDS).toJavaDuration())
.isNotEqualTo(java.time.Duration.ofSeconds(9999999999999999))
@@ -146,6 +148,7 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofMinutes(999999999999))
assertThat(Duration(999999999999999.0, MINUTES).toJavaDuration())
.isEqualTo(java.time.Duration.ofMinutes(999999999999999))
+ @Suppress("FloatingPointLiteralPrecision")
assertThat(Duration(9999999999999999.0, MINUTES).toJavaDuration())
.isNotEqualTo(java.time.Duration.ofMinutes(9999999999999999))
@@ -158,7 +161,10 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofHours(999999999999))
assertThat(Duration(999999999999999.0, HOURS).toJavaDuration())
.isEqualTo(java.time.Duration.ofHours(999999999999999))
- assertThrows { Duration(9999999999999999.0, HOURS).toJavaDuration() }
+ assertThrows {
+ @Suppress("FloatingPointLiteralPrecision")
+ Duration(9999999999999999.0, HOURS).toJavaDuration()
+ }
assertThat(Duration(999.0, DAYS).toJavaDuration()).isEqualTo(java.time.Duration.ofDays(999))
assertThat(Duration(999999.0, DAYS).toJavaDuration())
@@ -181,6 +187,7 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofNanos(-999999999999))
assertThat(Duration(-999999999999999.0, NANOS).toJavaDuration())
.isEqualTo(java.time.Duration.ofNanos(-999999999999999))
+ @Suppress("FloatingPointLiteralPrecision")
assertThat(Duration(-9999999999999999.0, NANOS).toJavaDuration())
.isNotEqualTo(java.time.Duration.ofNanos(-9999999999999999))
@@ -194,6 +201,7 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofSeconds(-999999999999))
assertThat(Duration(-999999999999999.0, SECONDS).toJavaDuration())
.isEqualTo(java.time.Duration.ofSeconds(-999999999999999))
+ @Suppress("FloatingPointLiteralPrecision")
assertThat(Duration(-9999999999999999.0, SECONDS).toJavaDuration())
.isNotEqualTo(java.time.Duration.ofSeconds(-9999999999999999))
@@ -207,6 +215,7 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofMinutes(-999999999999))
assertThat(Duration(-999999999999999.0, MINUTES).toJavaDuration())
.isEqualTo(java.time.Duration.ofMinutes(-999999999999999))
+ @Suppress("FloatingPointLiteralPrecision")
assertThat(Duration(-9999999999999999.0, MINUTES).toJavaDuration())
.isNotEqualTo(java.time.Duration.ofMinutes(-9999999999999999))
@@ -219,7 +228,10 @@ class DurationTest {
.isEqualTo(java.time.Duration.ofHours(-999999999999))
assertThat(Duration(-999999999999999.0, HOURS).toJavaDuration())
.isEqualTo(java.time.Duration.ofHours(-999999999999999))
- assertThrows { Duration(-9999999999999999.0, HOURS).toJavaDuration() }
+ assertThrows {
+ @Suppress("FloatingPointLiteralPrecision")
+ Duration(-9999999999999999.0, HOURS).toJavaDuration()
+ }
assertThat(Duration(-999.0, DAYS).toJavaDuration()).isEqualTo(java.time.Duration.ofDays(-999))
assertThat(Duration(-999999.0, DAYS).toJavaDuration())
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/EvaluateExpressionTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/EvaluateExpressionTest.kt
index faaa6cdd..a13013ae 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/EvaluateExpressionTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/EvaluateExpressionTest.kt
@@ -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.
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.assertThrows
class EvaluateExpressionTest {
companion object {
- val evaluator by lazy { Evaluator.preconfigured() }
+ private val evaluator by lazy { Evaluator.preconfigured() }
@AfterAll
@JvmStatic
@@ -64,7 +64,7 @@ class EvaluateExpressionTest {
}
"""
.trimIndent(),
- "foo.bar"
+ "foo.bar",
)
assertThat(resp).isEqualTo(2L)
@@ -84,7 +84,7 @@ class EvaluateExpressionTest {
}
"""
.trimIndent(),
- "output.text"
+ "output.text",
)
assertThat(result)
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorTest.kt
index bc6891ff..b76b803e 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/EvaluatorTest.kt
@@ -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.
@@ -23,6 +23,7 @@ import java.nio.file.Files
import java.nio.file.Path
import java.util.*
import java.util.regex.Pattern
+import kotlin.io.path.createParentDirectories
import kotlin.io.path.writeText
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatCode
@@ -30,7 +31,6 @@ import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.createTempFile
import org.pkl.commons.test.PackageServer
import org.pkl.commons.toPath
@@ -47,7 +47,7 @@ class EvaluatorTest {
companion object {
private val evaluator = Evaluator.preconfigured()
- private const val sourceText = "name = \"pigeon\"; age = 10 + 20"
+ @Suppress("ConstPropertyName") private const val sourceText = "name = \"pigeon\"; age = 10 + 20"
private object CustomModuleKeyFactory : ModuleKeyFactory {
override fun create(uri: URI): Optional {
@@ -275,7 +275,7 @@ class EvaluatorTest {
SecurityManagers.defaultAllowedModules,
SecurityManagers.defaultAllowedResources,
SecurityManagers.defaultTrustLevels,
- tempDir
+ tempDir,
)
)
.build()
@@ -315,7 +315,7 @@ class EvaluatorTest {
}
"""
.trimIndent()
- val output = evaluator.evaluateOutputFiles(ModuleSource.text(program))
+ val output = evaluator.evaluateOutputFiles(text(program))
assertThat(output.keys).isEqualTo(setOf("foo.yml", "bar.yml", "bar/biz.yml", "bar/../bark.yml"))
assertThat(output["foo.yml"]?.text).isEqualTo("foo: foo text")
assertThat(output["bar.yml"]?.text).isEqualTo("bar: bar text")
@@ -361,7 +361,7 @@ class EvaluatorTest {
ModuleKeyFactories.standardLibrary,
ModuleKeyFactories.pkg,
ModuleKeyFactories.projectpackage,
- ModuleKeyFactories.file
+ ModuleKeyFactories.file,
)
)
}
@@ -430,7 +430,7 @@ class EvaluatorTest {
ModuleKeyFactories.standardLibrary,
ModuleKeyFactories.pkg,
ModuleKeyFactories.projectpackage,
- ModuleKeyFactories.file
+ ModuleKeyFactories.file,
)
)
}
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/LanguageSnippetTestsEngine.kt b/pkl-core/src/test/kotlin/org/pkl/core/LanguageSnippetTestsEngine.kt
index dc0bca58..1baa6110 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/LanguageSnippetTestsEngine.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/LanguageSnippetTestsEngine.kt
@@ -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.
@@ -94,17 +94,17 @@ abstract class AbstractLanguageSnippetTestsEngine : InputOutputTestEngine() {
protected fun String.stripFilePaths(): String =
replace(IoUtils.toNormalizedPathString(snippetsDir), replacement)
- protected fun String.stripLineNumbers() =
+ protected fun String.stripLineNumbers(): String =
replace(lineNumberRegex) { result ->
// replace line number with equivalent number of 'x' characters to keep formatting intact
(result.groups[1]!!.value) + "x".repeat(result.groups[3]!!.value.length) + " |"
}
- protected fun String.stripWebsite() =
+ protected fun String.stripWebsite(): String =
replace(Release.current().documentation().homepage(), "https://\$pklWebsite/")
// can't think of a better solution right now
- protected fun String.stripVersionCheckErrorMessage() =
+ protected fun String.stripVersionCheckErrorMessage(): String =
replace("Pkl version is ${Release.current().version()}", "Pkl version is xxx")
protected fun String.stripStdlibLocationSha(): String {
@@ -114,7 +114,7 @@ abstract class AbstractLanguageSnippetTestsEngine : InputOutputTestEngine() {
else Release.current().commitId()
return replace(
"https://github.com/apple/pkl/blob/${commitIsh}/stdlib/",
- "https://github.com/apple/pkl/blob/\$commitId/stdlib/"
+ "https://github.com/apple/pkl/blob/\$commitId/stdlib/",
)
}
@@ -135,7 +135,7 @@ class LanguageSnippetTestsEngine : AbstractLanguageSnippetTestsEngine() {
"NAME2" to "value2",
"/foo/bar" to "foobar",
"foo bar" to "foo bar",
- "file:///foo/bar" to "file:///foo/bar"
+ "file:///foo/bar" to "file:///foo/bar",
)
)
.setExternalProperties(
@@ -169,7 +169,7 @@ class LanguageSnippetTestsEngine : AbstractLanguageSnippetTestsEngine() {
SecurityManagers.defaultManager,
null,
StackFrameTransformers.empty,
- mapOf()
+ mapOf(),
)
securityManager = null
applyFromProject(project)
@@ -200,13 +200,13 @@ abstract class AbstractNativeLanguageSnippetTestsEngine : AbstractLanguageSnippe
// on the other hand, don't exclude /native/
Regex(".*/import1b\\.pkl"),
// URIs get rendered slightly differently (percent-encoded vs raw)
- Regex(".*日本語_error\\.pkl")
+ Regex(".*日本語_error\\.pkl"),
)
/** Avoid running tests for native binaries when those native binaries have not been built. */
override fun discover(
discoveryRequest: EngineDiscoveryRequest,
- uniqueId: UniqueId
+ uniqueId: UniqueId,
): TestDescriptor {
if (!pklExecutablePath.exists()) {
// return empty descriptor w/o children
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/externalreader/TestExternalReaderProcess.kt b/pkl-core/src/test/kotlin/org/pkl/core/externalreader/TestExternalReaderProcess.kt
index a4454e9b..3c09be23 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/externalreader/TestExternalReaderProcess.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/externalreader/TestExternalReaderProcess.kt
@@ -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.
@@ -98,7 +98,7 @@ class TestExternalReaderProcess(private val transport: MessageTransport) : Exter
companion object {
fun initializeTestHarness(
moduleReaders: List,
- resourceReaders: List
+ resourceReaders: List,
): Pair {
val rxIn = PipedInputStream(10240)
val rxOut = PipedOutputStream(rxIn)
@@ -108,14 +108,12 @@ class TestExternalReaderProcess(private val transport: MessageTransport) : Exter
MessageTransports.stream(
ExternalReaderMessagePackDecoder(rxIn),
ExternalReaderMessagePackEncoder(txOut),
- {}
- )
+ ) {}
val clientTransport =
MessageTransports.stream(
ExternalReaderMessagePackDecoder(txIn),
ExternalReaderMessagePackEncoder(rxOut),
- {}
- )
+ ) {}
val runtime = ExternalReaderRuntime(moduleReaders, resourceReaders, clientTransport)
val proc = TestExternalReaderProcess(serverTransport)
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeyFactoriesTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeyFactoriesTest.kt
index 032fc5fe..58ada865 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeyFactoriesTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeyFactoriesTest.kt
@@ -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.
@@ -18,11 +18,11 @@ package org.pkl.core.module
import java.net.URI
import java.nio.file.Path
import kotlin.io.path.createDirectories
+import kotlin.io.path.createParentDirectories
import kotlin.io.path.outputStream
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.toPath
import org.pkl.commons.writeString
import org.pkl.core.SecurityManagers
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeysTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeysTest.kt
index e9901eab..1b9bde21 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeysTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/module/ModuleKeysTest.kt
@@ -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.
@@ -21,11 +21,11 @@ import java.net.URI
import java.net.URISyntaxException
import java.nio.file.Path
import kotlin.io.path.createFile
+import kotlin.io.path.createParentDirectories
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.toPath
import org.pkl.commons.writeString
import org.pkl.core.SecurityManagers
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/packages/PackageResolversTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/packages/PackageResolversTest.kt
index 550c7220..0e84c019 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/packages/PackageResolversTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/packages/PackageResolversTest.kt
@@ -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.
@@ -18,6 +18,8 @@ package org.pkl.core.packages
import java.io.FileNotFoundException
import java.io.IOException
import java.nio.charset.StandardCharsets
+import kotlin.io.path.ExperimentalPathApi
+import kotlin.io.path.deleteRecursively
import kotlin.io.path.exists
import kotlin.io.path.readBytes
import org.assertj.core.api.Assertions.assertThat
@@ -25,7 +27,6 @@ import org.assertj.core.api.Assertions.assertThatCode
import org.junit.jupiter.api.*
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode
-import org.pkl.commons.deleteRecursively
import org.pkl.commons.readString
import org.pkl.commons.test.FileTestUtils
import org.pkl.commons.test.PackageServer
@@ -118,7 +119,7 @@ class PackageResolversTest {
PathElement("catalog", true),
PathElement("Bird.pkl", false),
PathElement("allFruit.pkl", false),
- PathElement("catalog.pkl", false)
+ PathElement("catalog.pkl", false),
)
)
}
@@ -129,13 +130,13 @@ class PackageResolversTest {
resolver.getBytes(
PackageAssetUri("package://localhost:0/birds@0.5.0#/Bird.pkl"),
false,
- null
+ null,
)
val swallow =
resolver.getBytes(
PackageAssetUri("package://localhost:0/birds@0.5.0#/catalog/Swallow.pkl"),
false,
- null
+ null,
)
assertThat(bird).isEqualTo(packageRoot.resolve("birds@0.5.0/package/Bird.pkl").readBytes())
assertThat(swallow)
@@ -150,12 +151,7 @@ class PackageResolversTest {
.listElements(PackageAssetUri("package://localhost:0/birds@0.5.0#/catalog/"), null)
.toSet()
assertThat(elements)
- .isEqualTo(
- setOf(
- PathElement("Ostrich.pkl", false),
- PathElement("Swallow.pkl", false),
- )
- )
+ .isEqualTo(setOf(PathElement("Ostrich.pkl", false), PathElement("Swallow.pkl", false)))
}
@Test
@@ -174,7 +170,7 @@ class PackageResolversTest {
.getBytes(
PackageAssetUri("package://localhost:0/not-a-package@0.5.0#/Horse.pkl"),
false,
- null
+ null,
)
.toString(StandardCharsets.UTF_8)
}
@@ -186,7 +182,7 @@ class PackageResolversTest {
resolver.getBytes(
PackageAssetUri("package://localhost:0/badPackageZipUrl@1.0.0#/Bug.pkl"),
false,
- null
+ null,
)
}
.hasMessage(
@@ -201,7 +197,7 @@ class PackageResolversTest {
resolver.getBytes(
PackageAssetUri("package://localhost:0/badChecksum@1.0.0#/Bug.pkl"),
false,
- null
+ null,
)
}
assertThat(error)
@@ -215,6 +211,7 @@ class PackageResolversTest {
}
}
+ @ExperimentalPathApi
class DiskCachedPackageResolverTest : AbstractPackageResolverTest() {
private val cacheDir = FileTestUtils.rootProjectDir.resolve("pkl-core/build/test-cache")
@@ -233,7 +230,7 @@ class PackageResolversTest {
PackageResolvers.DiskCachedPackageResolver(
SecurityManagers.defaultManager,
httpClient,
- cacheDir
+ cacheDir,
)
}
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/settings/PklSettingsTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/settings/PklSettingsTest.kt
index 38a1a65e..e6180006 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/settings/PklSettingsTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/settings/PklSettingsTest.kt
@@ -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.
@@ -17,11 +17,11 @@ package org.pkl.core.settings
import java.net.URI
import java.nio.file.Path
+import kotlin.io.path.createParentDirectories
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatCode
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.writeString
import org.pkl.core.Evaluator
import org.pkl.core.ModuleSource
@@ -71,7 +71,7 @@ class PklSettingsTest {
PklEvaluatorSettings.Http(
PklEvaluatorSettings.Proxy(
URI("http://localhost:8080"),
- listOf("example.com", "pkg.pkl-lang.org")
+ listOf("example.com", "pkg.pkl-lang.org"),
)
)
assertThat(settings).isEqualTo(PklSettings(Editor.SYSTEM, expectedHttp))
@@ -95,12 +95,7 @@ class PklSettingsTest {
val settings = PklSettings.loadFromPklHomeDir(tempDir)
val expectedHttp =
- PklEvaluatorSettings.Http(
- PklEvaluatorSettings.Proxy(
- URI("http://localhost:8080"),
- listOf(),
- )
- )
+ PklEvaluatorSettings.Http(PklEvaluatorSettings.Proxy(URI("http://localhost:8080"), listOf()))
assertThat(settings).isEqualTo(PklSettings(Editor.SYSTEM, expectedHttp))
}
diff --git a/pkl-core/src/test/kotlin/org/pkl/core/util/IoUtilsTest.kt b/pkl-core/src/test/kotlin/org/pkl/core/util/IoUtilsTest.kt
index 54a8f013..8a7076c7 100644
--- a/pkl-core/src/test/kotlin/org/pkl/core/util/IoUtilsTest.kt
+++ b/pkl-core/src/test/kotlin/org/pkl/core/util/IoUtilsTest.kt
@@ -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.
@@ -20,12 +20,12 @@ import java.net.URI
import java.net.URISyntaxException
import java.nio.file.Path
import kotlin.io.path.createFile
+import kotlin.io.path.createParentDirectories
import org.assertj.core.api.Assertions.assertThat
import org.assertj.core.api.Assertions.assertThatExceptionOfType
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.toPath
import org.pkl.core.SecurityManager
import org.pkl.core.module.ModuleKeyFactories
@@ -49,7 +49,7 @@ class IoUtilsTest {
ModuleKeyFactories.pkg,
ModuleKeyFactories.file,
ModuleKeyFactories.standardLibrary,
- ModuleKeyFactories.genericUrl
+ ModuleKeyFactories.genericUrl,
)
)
@@ -174,7 +174,7 @@ class IoUtilsTest {
assertThat(
IoUtils.relativize(
URI("https://foo.com/bar/baz.pkl?query"),
- URI("https://foo.com/bar/qux.pkl")
+ URI("https://foo.com/bar/qux.pkl"),
)
)
.isEqualTo(URI("baz.pkl?query"))
@@ -182,7 +182,7 @@ class IoUtilsTest {
assertThat(
IoUtils.relativize(
URI("https://foo.com/bar/baz.pkl#fragment"),
- URI("https://foo.com/bar/qux.pkl")
+ URI("https://foo.com/bar/qux.pkl"),
)
)
.isEqualTo(URI("baz.pkl#fragment"))
@@ -190,7 +190,7 @@ class IoUtilsTest {
assertThat(
IoUtils.relativize(
URI("https://foo.com/bar/baz.pkl?query#fragment"),
- URI("https://foo.com/bar/qux.pkl")
+ URI("https://foo.com/bar/qux.pkl"),
)
)
.isEqualTo(URI("baz.pkl?query#fragment"))
@@ -198,7 +198,7 @@ class IoUtilsTest {
assertThat(
IoUtils.relativize(
URI("https://foo.com/bar/baz.pkl?query#fragment"),
- URI("https://foo.com/bar/qux.pkl?query2#fragment2")
+ URI("https://foo.com/bar/qux.pkl?query2#fragment2"),
)
)
.isEqualTo(URI("baz.pkl?query#fragment"))
@@ -211,7 +211,7 @@ class IoUtilsTest {
assertThat(
IoUtils.relativize(
URI("https://foo.com:80/bar/baz.pkl"),
- URI("https://bar.com:80/bar/baz.pkl")
+ URI("https://bar.com:80/bar/baz.pkl"),
)
)
.isEqualTo(URI("https://foo.com:80/bar/baz.pkl"))
@@ -219,7 +219,7 @@ class IoUtilsTest {
assertThat(
IoUtils.relativize(
URI("https://foo:bar@foo.com:80/bar/baz.pkl"),
- URI("https://foo:baz@bar.com:80/bar/baz.pkl")
+ URI("https://foo:baz@bar.com:80/bar/baz.pkl"),
)
)
.isEqualTo(URI("https://foo:bar@foo.com:80/bar/baz.pkl"))
@@ -282,7 +282,7 @@ class IoUtilsTest {
"modulepath:/foo.pkl" to "foo",
"modulepath:/foo/bar/baz.pkl" to "baz",
"package://example.com/foo/bar@1.0.0#/baz.pkl" to "baz",
- "package://example.com/foo/bar@1.0.0#/baz/biz/qux.pkl" to "qux"
+ "package://example.com/foo/bar@1.0.0#/baz/biz/qux.pkl" to "qux",
)
for ((uriStr, name) in assertions) {
val uri = URI(uriStr)
@@ -356,7 +356,7 @@ class IoUtilsTest {
IoUtils.resolve(
FakeSecurityManager,
key,
- URI(".../core/module/NamedModuleResolversTest.pkl")
+ URI(".../core/module/NamedModuleResolversTest.pkl"),
)
)
.isEqualTo(URI("modulepath:/org/pkl/core/module/NamedModuleResolversTest.pkl"))
@@ -365,7 +365,7 @@ class IoUtilsTest {
IoUtils.resolve(
FakeSecurityManager,
key,
- URI(".../org/pkl/core/module/NamedModuleResolversTest.pkl")
+ URI(".../org/pkl/core/module/NamedModuleResolversTest.pkl"),
)
)
.isEqualTo(URI("modulepath:/org/pkl/core/module/NamedModuleResolversTest.pkl"))
diff --git a/pkl-doc/gradle.lockfile b/pkl-doc/gradle.lockfile
index 270749f6..99156228 100644
--- a/pkl-doc/gradle.lockfile
+++ b/pkl-doc/gradle.lockfile
@@ -19,7 +19,6 @@ commons-io:commons-io:2.4=validator
commons-logging:commons-logging:1.2=validator
isorelax:isorelax:20030108=validator
net.bytebuddy:byte-buddy:1.15.11=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
net.sf.saxon:Saxon-HE:9.6.0-4=validator
nu.validator:cssvalidator:1.0.8=validator
nu.validator:galimatias:0.1.3=validator
@@ -42,33 +41,35 @@ org.graalvm.js:js:23.0.6=testCompileClasspath,testImplementationDependenciesMeta
org.graalvm.regex:regex:23.0.6=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
org.graalvm.sdk:graal-sdk:23.0.6=runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=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-gradle-plugin-api:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:1.7.10=kotlinKlibCommonizerClasspath
-org.jetbrains.kotlin:kotlin-native-utils:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-project-model:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-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-serialization: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.kotlin:kotlin-tooling-core:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlin:kotlin-util-io:1.7.10=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
-org.jetbrains.kotlinx:kotlinx-html-jvm:0.8.1=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-bom:1.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1=compileClasspath,implementationDependenciesMetadata,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-serialization-compiler-plugin-embeddable:2.0.21=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-stdlib-common:2.0.21=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+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.kotlinx:kotlinx-html-jvm:0.11.0=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-bom:1.8.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.8.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.8.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+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
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/DocGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/DocGenerator.kt
index 7210f547..4878302f 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/DocGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/DocGenerator.kt
@@ -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.
@@ -18,11 +18,7 @@ package org.pkl.doc
import java.io.IOException
import java.net.URI
import java.nio.file.Path
-import kotlin.io.path.createSymbolicLinkPointingTo
-import kotlin.io.path.deleteIfExists
-import kotlin.io.path.exists
-import kotlin.io.path.isSameFileAs
-import org.pkl.commons.deleteRecursively
+import kotlin.io.path.*
import org.pkl.core.ModuleSchema
import org.pkl.core.PClassInfo
import org.pkl.core.Version
@@ -33,6 +29,7 @@ import org.pkl.core.util.IoUtils
*
* For the high-level Pkldoc API, see [CliDocGenerator].
*/
+@OptIn(ExperimentalPathApi::class)
class DocGenerator(
/**
* The documentation website to generate.
@@ -62,7 +59,7 @@ class DocGenerator(
* Generates source URLs with fixed line numbers `#L123-L456` to avoid churn in expected output
* files (e.g., when stdlib line numbers change).
*/
- private val isTestMode: Boolean = false
+ private val isTestMode: Boolean = false,
) {
companion object {
internal fun List.current(
@@ -147,7 +144,7 @@ internal class DocPackage(val docPackageInfo: DocPackageInfo, val modules: List<
val minPklVersion: Version? by lazy { docModules.mapNotNull { it.minPklVersion }.maxOrNull() }
- val deprecation: String? = docPackageInfo.annotations.deprecation
+ @Suppress("unused") val deprecation: String? = docPackageInfo.annotations.deprecation
val isUnlisted: Boolean = docPackageInfo.annotations.isUnlisted
@@ -181,7 +178,7 @@ internal class DocPackage(val docPackageInfo: DocPackageInfo, val modules: List<
docPackageInfo.version,
docPackageInfo.getModuleImportUri(mod.moduleName),
docPackageInfo.getModuleSourceCode(mod.moduleName),
- exampleModulesBySubject[mod.moduleName] ?: listOf()
+ exampleModulesBySubject[mod.moduleName] ?: listOf(),
)
}
}
@@ -193,7 +190,7 @@ internal class DocModule(
val version: String,
val importUri: URI,
val sourceUrl: URI?,
- val examples: List
+ val examples: List,
) {
val name: String
get() = schema.moduleName
@@ -212,7 +209,7 @@ internal class DocModule(
version?.let { Version.parse(it) }
}
- val deprecation: String? = schema.annotations.deprecation
+ @Suppress("unused") val deprecation: String? = schema.annotations.deprecation
val isUnlisted: Boolean = schema.annotations.isUnlisted
}
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/DocPackageInfo.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/DocPackageInfo.kt
index 5dc61600..f312e420 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/DocPackageInfo.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/DocPackageInfo.kt
@@ -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.
@@ -101,14 +101,14 @@ data class DocPackageInfo(
version = dependency["version"] as String,
sourceCode = (dependency["sourceCode"] as String?)?.toUri(),
sourceCodeUrlScheme = dependency["sourceCodeUrlScheme"] as String?,
- documentation = (dependency["documentation"] as String?)?.toUri()
+ documentation = (dependency["documentation"] as String?)?.toUri(),
)
},
overview = module["overview"] as String,
overviewImports =
(module["overviewImports"] as Map).mapValues { it.value.toUri() },
annotations = module["annotations"] as List,
- extraAttributes = module["extraAttributes"] as Map
+ extraAttributes = module["extraAttributes"] as Map,
)
}
@@ -122,7 +122,7 @@ data class DocPackageInfo(
dependency.name,
dependency.uri,
dependency.version,
- getModulePath(moduleName, dependency.prefix)
+ getModulePath(moduleName, dependency.prefix),
)
}
}
@@ -138,7 +138,7 @@ data class DocPackageInfo(
version,
getModulePath(moduleName, moduleNamePrefix),
type.simpleName,
- isTypeAlias = type is TypeAlias
+ isTypeAlias = type is TypeAlias,
)
}
for (dependency in dependencies) {
@@ -149,7 +149,7 @@ data class DocPackageInfo(
dependency.version,
getModulePath(moduleName, dependency.prefix),
type.simpleName,
- isTypeAlias = type is TypeAlias
+ isTypeAlias = type is TypeAlias,
)
}
}
@@ -212,6 +212,7 @@ data class DocPackageInfo(
}
}
+ @Suppress("unused")
internal fun getModuleSourceCode(moduleName: String): URI? =
when {
!moduleName.startsWith(prefix) -> null
@@ -223,7 +224,7 @@ data class DocPackageInfo(
internal fun getModuleSourceCodeWithSourceLocation(
moduleName: String,
- sourceLocation: SourceLocation
+ sourceLocation: SourceLocation,
): URI? {
return when {
!moduleName.startsWith(prefix) -> null
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/Main.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/Main.kt
index b3dd0d76..6743b0fe 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/Main.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/Main.kt
@@ -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.
@@ -38,12 +38,12 @@ internal fun main(args: Array) {
}
class DocCommand :
- BaseCommand(name = "pkldoc", helpLink = Release.current().documentation().homepage(), help = "") {
+ BaseCommand(name = "pkldoc", helpLink = Release.current().documentation().homepage()) {
private val modules: List by
argument(
name = "",
- help = "Module paths/uris, or package uris to generate documentation for"
+ help = "Module paths/uris, or package uris to generate documentation for",
)
.convert { parseModuleName(it) }
.multiple(required = true)
@@ -52,7 +52,7 @@ class DocCommand :
option(
names = arrayOf("-o", "--output-dir"),
metavar = "",
- help = "Directory where generated documentation is placed."
+ help = "Directory where generated documentation is placed.",
)
.path()
.required()
@@ -61,14 +61,7 @@ class DocCommand :
override fun run() {
val options =
- CliDocGeneratorOptions(
- baseOptions.baseOptions(
- modules,
- projectOptions,
- ),
- outputDir,
- true
- )
+ CliDocGeneratorOptions(baseOptions.baseOptions(modules, projectOptions), outputDir, true)
CliDocGenerator(options).run()
}
}
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt
index 55d98124..f942cb4b 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/MainPageGenerator.kt
@@ -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.
@@ -20,7 +20,7 @@ import kotlinx.html.*
internal class MainPageGenerator(
docsiteInfo: DocsiteInfo,
private val packagesData: List,
- pageScope: SiteScope
+ pageScope: SiteScope,
) : MainOrPackagePageGenerator(docsiteInfo, pageScope, pageScope) {
override val html: HTML.() -> Unit = {
renderHtmlHead()
@@ -41,7 +41,7 @@ internal class MainPageGenerator(
renderMemberGroupLinks(
Triple("Overview", "#_overview", memberDocs.isExpandable),
- Triple("Packages", "#_packages", packagesData.isNotEmpty())
+ Triple("Packages", "#_packages", packagesData.isNotEmpty()),
)
if (docsiteInfo.overview != null) {
@@ -90,12 +90,12 @@ internal class MainPageGenerator(
for (pkg in sortedPackages) {
val packageScope =
pageScope.packageScopes[pkg.ref.pkg]
- // create scope for previously generated package
- ?: pageScope.createEmptyPackageScope(
+ // create scope for previously generated package
+ ?: pageScope.createEmptyPackageScope(
pkg.ref.pkg,
pkg.ref.version,
pkg.sourceCodeUrlScheme,
- pkg.sourceCode
+ pkg.sourceCode,
)
val memberDocs =
@@ -103,7 +103,6 @@ internal class MainPageGenerator(
pkg.summary,
packageScope,
listOfNotNull(pkg.deprecation?.let { createDeprecatedAnnotation(it) }),
- isDeclaration = false
)
renderModuleOrPackage(pkg.ref.pkg, packageScope, memberDocs)
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/Markdown.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/Markdown.kt
index 47b125b7..fcc39028 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/Markdown.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/Markdown.kt
@@ -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.
@@ -41,7 +41,7 @@ internal class MarkdownParserFactory(private val pageScope: DocScope) : InlinePa
internal class MarkdownParserContext(
private val docScope: DocScope,
private val pageScope: DocScope,
- private val delegate: InlineParserContext
+ private val delegate: InlineParserContext,
) : InlineParserContext {
companion object {
private val keywords = setOf("null", "true", "false", "this", "unknown", "nothing")
@@ -54,7 +54,7 @@ internal class MarkdownParserContext(
}
override fun getDefinition(type: Class, label: String): D? {
- @Suppress("UNCHECKED_CAST", "DEPRECATION")
+ @Suppress("UNCHECKED_CAST")
return when (type) {
LinkReferenceDefinition::class.java -> getLinkReferenceDefinition(label) as D
else -> null
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/ModulePageGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/ModulePageGenerator.kt
index 4797ea11..a8b16a06 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/ModulePageGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/ModulePageGenerator.kt
@@ -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.
@@ -22,14 +22,14 @@ internal class ModulePageGenerator(
docPackage: DocPackage,
docModule: DocModule,
pageScope: ModuleScope,
- isTestMode: Boolean
+ isTestMode: Boolean,
) :
ModuleOrClassPageGenerator(
docsiteInfo,
docModule,
docModule.schema.moduleClass,
pageScope,
- isTestMode
+ isTestMode,
) {
private val module = docModule.schema
@@ -61,7 +61,7 @@ internal class ModulePageGenerator(
pageScope,
clazz.annotations,
isDeclaration = true,
- collectMemberInfo(docModule)
+ collectMemberInfo(docModule),
)
renderMemberGroupLinks(
@@ -69,7 +69,7 @@ internal class ModulePageGenerator(
Triple("Properties", "#_properties", clazz.hasListedProperty),
Triple("Methods", "#_methods", clazz.hasListedMethod),
Triple("Classes", "#_classes", module.hasListedClass),
- Triple("Type Aliases", "#_type-aliases", module.hasListedTypeAlias)
+ Triple("Type Aliases", "#_type-aliases", module.hasListedTypeAlias),
)
renderAnchor("_overview")
@@ -234,13 +234,12 @@ internal class ModulePageGenerator(
"inherited",
"expandable",
"hidden",
- "collapsed"
+ "collapsed",
)
} else setOf("member", "with-page-link")
val classScope = ClassScope(clazz, pageScope.url, pageScope)
- val memberDocs =
- MemberDocs(clazz.docComment, classScope, clazz.annotations, isDeclaration = false)
+ val memberDocs = MemberDocs(clazz.docComment, classScope, clazz.annotations)
memberDocs.renderExpandIcon(this)
renderSelfLink(className)
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt
index e9742e07..f2676b4f 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/PackageDataGenerator.kt
@@ -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.
@@ -18,11 +18,10 @@ package org.pkl.doc
import java.io.IOException
import java.net.URI
import java.nio.file.Path
+import kotlin.io.path.createParentDirectories
import kotlin.io.path.writer
-import kotlin.streams.toList
import kotlinx.serialization.*
import kotlinx.serialization.json.Json
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.readString
import org.pkl.commons.toUri
import org.pkl.commons.walk
@@ -88,7 +87,7 @@ internal data class PackageRef(
override val pkgUri: @Contextual URI?,
/** The package version. */
- override val version: String
+ override val version: String,
) : ElementRef() {
override val pageUrl: URI by lazy { "$pkg/$version/index.html".toUri() }
}
@@ -106,7 +105,7 @@ internal data class ModuleRef(
override val version: String,
/** The module path. */
- val module: String
+ val module: String,
) : ElementRef() {
override val pageUrl: URI by lazy { "$pkg/$version/$module/index.html".toUri() }
@@ -138,7 +137,7 @@ internal data class TypeRef(
val type: String,
/** Whether this is a type alias rather than a class. */
- val isTypeAlias: Boolean = false
+ val isTypeAlias: Boolean = false,
) : ElementRef() {
val id: TypeId by lazy { TypeId(pkg, module, type) }
@@ -191,7 +190,7 @@ internal class PackageData(
val dependencies: List = listOf(),
/** The modules in this package. */
- val modules: List = listOf()
+ val modules: List = listOf(),
) {
companion object {
val json = Json { serializersModule = serializers }
@@ -221,7 +220,7 @@ internal class PackageData(
pkg.docPackageInfo.sourceCode,
pkg.docPackageInfo.sourceCodeUrlScheme,
pkg.docPackageInfo.dependencies.map { DependencyData(PackageRef(it.name, it.uri, it.version)) },
- pkg.docModules.mapNotNull { if (it.isUnlisted) null else ModuleData(pkg, it) }
+ pkg.docModules.mapNotNull { if (it.isUnlisted) null else ModuleData(pkg, it) },
)
fun write(path: Path) {
@@ -255,7 +254,7 @@ internal class ModuleData(
val ref: ModuleRef,
/** The first paragraph of the overview documentation for this module. */
- val summary: String? = null,
+ @Suppress("unused") val summary: String? = null,
/** The deprecation message, or `null` if this module isn't deprecated. */
val deprecation: String? = null,
@@ -270,11 +269,11 @@ internal class ModuleData(
val classes: List = listOf(),
/** The type aliases declared in this module. */
- val typeAliases: List = listOf()
+ @Suppress("unused") val typeAliases: List = listOf(),
) {
constructor(
pkg: DocPackage,
- module: DocModule
+ module: DocModule,
) : this(
ModuleRef(pkg.name, pkg.uri, pkg.version, module.path),
getDocCommentSummary(module.overview),
@@ -289,7 +288,7 @@ internal class ModuleData(
},
module.schema.typeAliases.mapNotNull {
if (it.value.isUnlisted) null else TypeAliasData(pkg, module, it.value)
- }
+ },
)
}
@@ -321,14 +320,14 @@ internal class ClassData(
constructor(
pkg: DocPackage,
module: DocModule,
- clazz: PClass
+ clazz: PClass,
) : this(
TypeRef(pkg.name, pkg.uri, pkg.version, module.path, clazz.simpleName),
generateSequence(clazz.superclass) { it.superclass }
.map { pkg.docPackageInfo.getTypeRef(it) }
.filterNotNull()
.toList(),
- findTypesUsedBy(clazz, pkg.docPackageInfo).toList()
+ findTypesUsedBy(clazz, pkg.docPackageInfo).toList(),
)
}
@@ -339,15 +338,15 @@ internal class TypeAliasData(
override val ref: TypeRef,
/** The types used by this type alias. */
- override val usedTypes: List = listOf()
+ override val usedTypes: List = listOf(),
) : TypeData() {
constructor(
pkg: DocPackage,
module: DocModule,
- alias: TypeAlias
+ alias: TypeAlias,
) : this(
TypeRef(pkg.name, pkg.uri, pkg.version, module.path, alias.simpleName, isTypeAlias = true),
- findTypesUsedBy(alias, pkg.docPackageInfo).toList()
+ findTypesUsedBy(alias, pkg.docPackageInfo).toList(),
)
}
@@ -381,7 +380,7 @@ private fun findTypesUsedBy(
type: PType,
enclosingType: Member /* PClass|TypeAlias */,
enclosingPackage: DocPackageInfo,
- result: MutableSet
+ result: MutableSet,
) {
when (type) {
is PType.Class -> {
@@ -416,7 +415,7 @@ private fun findTypesUsedBy(
enclosingPackage.uri,
enclosingPackage.version,
enclosingType.moduleName.substring(enclosingPackage.name.length + 1).replace('.', '/'),
- PClassInfo.MODULE_CLASS_NAME
+ PClassInfo.MODULE_CLASS_NAME,
)
)
}
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/PackagePageGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/PackagePageGenerator.kt
index fffef4b0..a67d17d0 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/PackagePageGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/PackagePageGenerator.kt
@@ -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.
@@ -20,7 +20,7 @@ import kotlinx.html.*
internal class PackagePageGenerator(
docsiteInfo: DocsiteInfo,
private val docPackage: DocPackage,
- pageScope: PackageScope
+ pageScope: PackageScope,
) : MainOrPackagePageGenerator(docsiteInfo, pageScope, pageScope.parent) {
override val html: HTML.() -> Unit = {
renderHtmlHead()
@@ -50,12 +50,12 @@ internal class PackagePageGenerator(
pageScope,
packageInfo.annotations,
isDeclaration = true,
- collectMemberInfoForPackage(docPackage)
+ collectMemberInfoForPackage(docPackage),
)
renderMemberGroupLinks(
Triple("Overview", "#_overview", memberDocs.isExpandable),
- Triple("Modules", "#_modules", docPackage.hasListedModule)
+ Triple("Modules", "#_modules", docPackage.hasListedModule),
)
renderAnchor("_overview")
@@ -120,8 +120,7 @@ internal class PackagePageGenerator(
module.docComment,
moduleScope,
module.annotations,
- isDeclaration = false,
- collectMemberInfo(docModule)
+ extraMemberInfo = collectMemberInfo(docModule),
)
renderModuleOrPackage(module.moduleName, moduleScope, memberDocs)
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt
index 6bd7d619..04c0136a 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/PageGenerator.kt
@@ -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.
@@ -16,19 +16,19 @@
package org.pkl.doc
import kotlin.io.path.bufferedWriter
+import kotlin.io.path.createParentDirectories
import kotlinx.html.*
import kotlinx.html.stream.appendHTML
import org.commonmark.ext.gfm.tables.TablesExtension
import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.toPath
import org.pkl.core.*
import org.pkl.core.util.IoUtils
internal abstract class PageGenerator(
protected val docsiteInfo: DocsiteInfo,
- protected val pageScope: S
+ protected val pageScope: S,
) where S : PageScope {
private val markdownInlineParserFactory = MarkdownParserFactory(pageScope)
@@ -110,7 +110,7 @@ internal abstract class PageGenerator(
packageName: String?,
packageVersion: String?,
moduleName: String?,
- className: String?
+ className: String?,
) {
header {
if (docsiteInfo.title != null) {
@@ -227,11 +227,11 @@ internal abstract class PageGenerator(
) {
ul {
classes = setOf("member-group-links")
- for ((name, _href, show) in groups) {
+ for ((name, href, show) in groups) {
if (show) {
li {
a {
- href = _href
+ this.href = href
+name
}
}
@@ -280,7 +280,7 @@ internal abstract class PageGenerator(
protected fun HtmlBlockTag.renderTypeAliasName(
typeAlias: TypeAlias,
- cssClass: String = "name-ref"
+ cssClass: String = "name-ref",
) {
val moduleDocUrl = pageScope.resolveModuleNameToDocUrl(typeAlias.moduleName)
@@ -302,7 +302,7 @@ internal abstract class PageGenerator(
protected fun HtmlBlockTag.renderType(
type: PType,
currScope: DocScope,
- isNested: Boolean = false
+ isNested: Boolean = false,
) {
when (type) {
PType.UNKNOWN -> {
@@ -390,7 +390,7 @@ internal abstract class PageGenerator(
private fun HtmlBlockTag.renderTypeVariable(
typeVariable: PType.TypeVariable,
- currentScope: DocScope
+ currentScope: DocScope,
) {
val parameterScope = currentScope.resolveVariable(typeVariable.name) as? ParameterScope
@@ -634,7 +634,7 @@ internal abstract class PageGenerator(
annotations: List,
/** Whether these member docs are for the main declaration at the top of a page. */
private val isDeclaration: Boolean = false,
- private val extraMemberInfo: Map Unit> = mapOf()
+ private val extraMemberInfo: Map Unit> = mapOf(),
) {
init {
markdownInlineParserFactory.docScope = docScope
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/RuntimeDataGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/RuntimeDataGenerator.kt
index f441c6cd..994f4960 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/RuntimeDataGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/RuntimeDataGenerator.kt
@@ -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.
@@ -16,13 +16,15 @@
package org.pkl.doc
import java.nio.file.Path
-import org.pkl.commons.deleteRecursively
+import kotlin.io.path.ExperimentalPathApi
+import kotlin.io.path.deleteRecursively
import org.pkl.core.util.json.JsonWriter
// Note: we don't currently make use of persisted type alias data (needs more thought).
+@OptIn(ExperimentalPathApi::class)
internal class RuntimeDataGenerator(
private val descendingVersionComparator: Comparator,
- private val outputDir: Path
+ private val outputDir: Path,
) {
private val packageVersions = mutableMapOf>()
@@ -95,7 +97,7 @@ internal class RuntimeDataGenerator(
packageVersions.getOrDefault(ref.pkg, setOf()).sortedWith(descendingVersionComparator),
{ it },
{ if (it == ref.version) null else ref.copy(version = it).pageUrlRelativeTo(ref) },
- { if (it == ref.version) CssConstants.CURRENT_VERSION else null }
+ { if (it == ref.version) CssConstants.CURRENT_VERSION else null },
)
writer.writeLinks(
HtmlConstants.KNOWN_USAGES,
@@ -104,7 +106,7 @@ internal class RuntimeDataGenerator(
},
PackageRef::pkg,
{ it.pageUrlRelativeTo(ref) },
- { null }
+ { null },
)
}
}
@@ -122,7 +124,7 @@ internal class RuntimeDataGenerator(
moduleVersions.getOrDefault(ref.id, setOf()).sortedWith(descendingVersionComparator),
{ it },
{ if (it == ref.version) null else ref.copy(version = it).pageUrlRelativeTo(ref) },
- { if (it == ref.version) CssConstants.CURRENT_VERSION else null }
+ { if (it == ref.version) CssConstants.CURRENT_VERSION else null },
)
writer.writeLinks(
HtmlConstants.KNOWN_USAGES,
@@ -131,7 +133,7 @@ internal class RuntimeDataGenerator(
},
TypeRef::displayName,
{ it.pageUrlRelativeTo(ref) },
- { null }
+ { null },
)
writer.writeLinks(
HtmlConstants.KNOWN_SUBTYPES,
@@ -140,7 +142,7 @@ internal class RuntimeDataGenerator(
},
TypeRef::displayName,
{ it.pageUrlRelativeTo(ref) },
- { null }
+ { null },
)
}
}
@@ -158,7 +160,7 @@ internal class RuntimeDataGenerator(
classVersions.getOrDefault(ref.id, setOf()).sortedWith(descendingVersionComparator),
{ it },
{ if (it == ref.version) null else ref.copy(version = it).pageUrlRelativeTo(ref) },
- { if (it == ref.version) CssConstants.CURRENT_VERSION else null }
+ { if (it == ref.version) CssConstants.CURRENT_VERSION else null },
)
writer.writeLinks(
HtmlConstants.KNOWN_USAGES,
@@ -167,7 +169,7 @@ internal class RuntimeDataGenerator(
},
TypeRef::displayName,
{ it.pageUrlRelativeTo(ref) },
- { null }
+ { null },
)
writer.writeLinks(
HtmlConstants.KNOWN_SUBTYPES,
@@ -176,7 +178,7 @@ internal class RuntimeDataGenerator(
},
TypeRef::displayName,
{ it.pageUrlRelativeTo(ref) },
- { null }
+ { null },
)
}
}
@@ -191,7 +193,7 @@ internal class RuntimeDataGenerator(
// link href
href: (T) -> String?,
// link CSS classes
- classes: (T) -> String?
+ classes: (T) -> String?,
) {
if (items.isEmpty()) return
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt
index c7ccf926..fb6c4865 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/SearchIndexGenerator.kt
@@ -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.
@@ -17,7 +17,7 @@ package org.pkl.doc
import java.nio.file.Path
import kotlin.io.path.bufferedWriter
-import org.pkl.commons.createParentDirectories
+import kotlin.io.path.createParentDirectories
import org.pkl.core.Member
import org.pkl.core.PClass.Method
import org.pkl.core.PClass.Property
diff --git a/pkl-doc/src/main/kotlin/org/pkl/doc/Util.kt b/pkl-doc/src/main/kotlin/org/pkl/doc/Util.kt
index 081e9f4a..b7cced54 100644
--- a/pkl-doc/src/main/kotlin/org/pkl/doc/Util.kt
+++ b/pkl-doc/src/main/kotlin/org/pkl/doc/Util.kt
@@ -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.
@@ -19,8 +19,8 @@ import java.io.InputStream
import java.net.URI
import java.nio.file.Path
import kotlin.io.path.bufferedWriter
+import kotlin.io.path.createParentDirectories
import kotlin.io.path.outputStream
-import org.pkl.commons.createParentDirectories
import org.pkl.core.*
import org.pkl.core.parser.Lexer
import org.pkl.core.util.IoUtils
@@ -62,7 +62,7 @@ internal val List.isUnlisted: Boolean
internal val List.deprecation: String?
get() = find { it.classInfo == PClassInfo.Deprecated }?.get("message") as String?
-@Suppress("UNCHECKED_CAST")
+@Suppress("UNCHECKED_CAST", "unused")
internal val List.alsoKnownAs: List?
get() = find { it.classInfo == PClassInfo.AlsoKnownAs }?.get("names") as List?
@@ -111,7 +111,7 @@ internal inline fun JsonWriter.array(body: JsonWriter.() -> Unit) {
internal fun String.replaceSourceCodePlaceholders(
path: String,
- sourceLocation: Member.SourceLocation
+ sourceLocation: Member.SourceLocation,
): String {
return replace("%{path}", path)
.replace("%{line}", sourceLocation.startLine().toString())
diff --git a/pkl-doc/src/test/kotlin/org/pkl/doc/CliDocGeneratorTest.kt b/pkl-doc/src/test/kotlin/org/pkl/doc/CliDocGeneratorTest.kt
index 0ecec6ad..74826874 100644
--- a/pkl-doc/src/test/kotlin/org/pkl/doc/CliDocGeneratorTest.kt
+++ b/pkl-doc/src/test/kotlin/org/pkl/doc/CliDocGeneratorTest.kt
@@ -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.
@@ -30,7 +30,6 @@ import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import org.pkl.commons.cli.CliBaseOptions
import org.pkl.commons.cli.CliException
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.readString
import org.pkl.commons.test.FileTestUtils
import org.pkl.commons.test.PackageServer
@@ -106,12 +105,7 @@ class CliDocGeneratorTest {
actualOutputFiles.map { IoUtils.toNormalizedPathString(actualOutputDir.relativize(it)) }
}
- private val binaryFileExtensions =
- setOf(
- "woff2",
- "png",
- "svg",
- )
+ private val binaryFileExtensions = setOf("woff2", "png", "svg")
private fun runDocGenerator(outputDir: Path, cacheDir: Path?) {
CliDocGenerator(
@@ -127,10 +121,10 @@ class CliDocGeneratorTest {
URI("package://localhost:0/unlisted@1.0.0"),
URI("package://localhost:0/deprecated@1.0.0"),
) + package1InputModules + package2InputModules,
- moduleCacheDir = cacheDir
+ moduleCacheDir = cacheDir,
),
outputDir = outputDir,
- isTestMode = true
+ isTestMode = true,
)
)
.run()
@@ -172,7 +166,7 @@ class CliDocGeneratorTest {
CliDocGeneratorOptions(
CliBaseOptions(sourceModules = listOf(descriptor1.toUri(), descriptor2.toUri())),
outputDir = tmpOutputDir,
- isTestMode = true
+ isTestMode = true,
)
)
@@ -192,7 +186,7 @@ class CliDocGeneratorTest {
CliDocGeneratorOptions(
CliBaseOptions(sourceModules = listOf(module1.toUri())),
outputDir = tmpOutputDir,
- isTestMode = true
+ isTestMode = true,
)
)
@@ -212,7 +206,7 @@ class CliDocGeneratorTest {
CliDocGeneratorOptions(
CliBaseOptions(sourceModules = listOf(descriptor1.toUri())),
outputDir = tmpOutputDir,
- isTestMode = true
+ isTestMode = true,
)
)
@@ -286,17 +280,14 @@ class CliDocGeneratorTest {
sourceCode = URI.create("foo.pkl"),
issueTracker = URI.create("https://github.com/apple/pkl/issues"),
overview = "my overview",
- sourceCodeUrlScheme = "https://example.com/blob/$version%{path}#L%{line}-%{endLine}"
+ sourceCodeUrlScheme = "https://example.com/blob/$version%{path}#L%{line}-%{endLine}",
),
- modules = emptyList()
- ),
+ modules = emptyList(),
+ )
)
val packages: List =
- listOf(
- createPackageData("1.2.3"),
- createPackageData("1.3.0-SNAPSHOT"),
- )
+ listOf(createPackageData("1.2.3"), createPackageData("1.3.0-SNAPSHOT"))
val comparator =
Comparator { v1, v2 -> Version.parse(v1).compareTo(Version.parse(v2)) }.reversed()
diff --git a/pkl-executor/gradle.lockfile b/pkl-executor/gradle.lockfile
index 0dc09840..d6223145 100644
--- a/pkl-executor/gradle.lockfile
+++ b/pkl-executor/gradle.lockfile
@@ -3,26 +3,31 @@
# This file is expected to be part of source control.
com.tunnelvisionlabs:antlr4-runtime:4.9.0=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=testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=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=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.6.4=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains:annotations:13.0=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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
diff --git a/pkl-gradle/gradle.lockfile b/pkl-gradle/gradle.lockfile
index fc32578f..6a0bcc2a 100644
--- a/pkl-gradle/gradle.lockfile
+++ b/pkl-gradle/gradle.lockfile
@@ -4,24 +4,30 @@
com.github.ajalt.clikt:clikt-jvm:3.5.4=compileClasspath
com.github.ajalt.clikt:clikt:3.5.4=compileClasspath,compileOnlyDependenciesMetadata
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.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=compileClasspath,compileOnlyDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=compileClasspath,compileOnlyDependenciesMetadata,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=compileClasspath,compileOnlyDependenciesMetadata,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=compileClasspath,compileOnlyDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
-org.jetbrains:annotations:13.0=compileClasspath,compileOnlyDependenciesMetadata,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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-common:2.0.21=compileClasspath,compileOnlyDependenciesMetadata
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=compileClasspath,compileOnlyDependenciesMetadata,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=compileClasspath,compileOnlyDependenciesMetadata,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=compileClasspath,compileOnlyDependenciesMetadata,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath,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,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
diff --git a/pkl-gradle/pkl-gradle.gradle.kts b/pkl-gradle/pkl-gradle.gradle.kts
index 199b3694..68c589cd 100644
--- a/pkl-gradle/pkl-gradle.gradle.kts
+++ b/pkl-gradle/pkl-gradle.gradle.kts
@@ -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.
@@ -53,7 +53,13 @@ sourceSets {
test {
// Remove Gradle distribution JARs from test compile classpath.
// This prevents a conflict between Gradle's and Pkl's Kotlin versions.
- compileClasspath = compileClasspath.filter { !(it.path.contains("dists")) }
+ //
+ // For some reason, IntelliJ import turns pklCommonsTest into a runtime dependency
+ // if `compileClasspath` is filtered, causing "unresolved reference" errors in IntelliJ.
+ // As a workaround, don't perform filtering for IntelliJ (import).
+ if (System.getProperty("idea.sync.active") == null) {
+ compileClasspath = compileClasspath.filter { !(it.path.contains("dists")) }
+ }
}
}
@@ -99,4 +105,6 @@ signing {
// (Apparently, gradle-api.jar now contains metadata that causes kotlinc to enforce Gradle's Kotlin
// version.)
// A more robust solution would be to port plugin tests to Java.
-tasks.compileTestKotlin { kotlinOptions { freeCompilerArgs += "-Xskip-metadata-version-check" } }
+tasks.compileTestKotlin {
+ compilerOptions { freeCompilerArgs.add("-Xskip-metadata-version-check") }
+}
diff --git a/pkl-gradle/src/test/kotlin/org/pkl/gradle/AbstractTest.kt b/pkl-gradle/src/test/kotlin/org/pkl/gradle/AbstractTest.kt
index 7bc47cbd..90f81e90 100644
--- a/pkl-gradle/src/test/kotlin/org/pkl/gradle/AbstractTest.kt
+++ b/pkl-gradle/src/test/kotlin/org/pkl/gradle/AbstractTest.kt
@@ -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.
@@ -17,14 +17,14 @@ package org.pkl.gradle
import java.net.URI
import java.nio.file.Path
+import kotlin.io.path.createParentDirectories
+import kotlin.io.path.writeText
import org.assertj.core.api.Assertions.assertThat
import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.GradleRunner
import org.gradle.testkit.runner.UnexpectedBuildFailure
import org.junit.jupiter.api.io.TempDir
-import org.pkl.commons.createParentDirectories
import org.pkl.commons.readString
-import org.pkl.commons.writeString
abstract class AbstractTest {
private val gradleVersion: String? = System.getProperty("testGradleVersion")
@@ -57,10 +57,10 @@ abstract class AbstractTest {
}
protected fun writeFile(fileName: String, contents: String): Path {
- return testProjectDir
- .resolve(fileName)
- .apply { createParentDirectories() }
- .writeString(contents.trimIndent())
+ return testProjectDir.resolve(fileName).apply {
+ createParentDirectories()
+ writeText(contents.trimIndent())
+ }
}
protected fun checkFileContents(file: Path, contents: String) {
diff --git a/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt b/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt
index 0cf9fe7e..68a5b533 100644
--- a/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt
+++ b/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt
@@ -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.
@@ -31,7 +31,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
val baseDir = testProjectDir.resolve("build/generated/java/foo/bar")
val moduleFile = baseDir.resolve("Mod.java")
- assertThat(baseDir.listDirectoryEntries().count()).isEqualTo(1)
+ assertThat(baseDir.listDirectoryEntries().size).isEqualTo(1)
assertThat(moduleFile).exists()
val text = moduleFile.readText()
@@ -44,7 +44,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
"""
|public final class Mod {
| public final @Nonnull Object other;
- """
+ """,
)
checkTextContains(
@@ -54,7 +54,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
| public final @Nonnull String name;
|
| public final @Nonnull List addresses;
- """
+ """,
)
checkTextContains(
@@ -64,7 +64,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
| public final @Nonnull String street;
|
| public final long zip;
- """
+ """,
)
}
@@ -100,7 +100,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
}
}
}
- """
+ """,
)
val result = runTask("evalTest", true)
@@ -139,7 +139,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
}
}
}
- """
+ """,
)
}
@@ -160,7 +160,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
}
other = 42
- """
+ """,
)
}
}
diff --git a/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt b/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt
index d91874d0..2b9ffc88 100644
--- a/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt
+++ b/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt
@@ -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.
@@ -31,7 +31,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
val baseDir = testProjectDir.resolve("build/generated/kotlin/foo/bar")
val kotlinFile = baseDir.resolve("Mod.kt")
- assertThat(baseDir.listDirectoryEntries().count()).isEqualTo(1)
+ assertThat(baseDir.listDirectoryEntries().size).isEqualTo(1)
assertThat(kotlinFile).exists()
val text = kotlinFile.readText()
@@ -39,11 +39,14 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
// shading must not affect generated code
assertThat(text).doesNotContain("org.pkl.thirdparty")
- checkTextContains(text, """
+ checkTextContains(
+ text,
+ """
|data class Mod(
| val other: Any?
|)
- """)
+ """,
+ )
checkTextContains(
text,
@@ -52,7 +55,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
| val name: String,
| val addresses: List
| )
- """
+ """,
)
checkTextContains(
@@ -62,7 +65,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
| open val street: String,
| open val zip: Long
| )
- """
+ """,
)
}
@@ -97,7 +100,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
}
}
}
- """
+ """,
)
val result = runTask("evalTest", true)
@@ -148,7 +151,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
}
}
}
- """
+ """,
)
}
@@ -170,7 +173,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
}
other = 42
- """
+ """,
)
}
}
diff --git a/pkl-server/gradle.lockfile b/pkl-server/gradle.lockfile
index 9a5e9e71..314693dc 100644
--- a/pkl-server/gradle.lockfile
+++ b/pkl-server/gradle.lockfile
@@ -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
diff --git a/pkl-server/src/main/kotlin/org/pkl/server/ServerMessagePackEncoder.kt b/pkl-server/src/main/kotlin/org/pkl/server/ServerMessagePackEncoder.kt
index 0c3193cf..111bc259 100644
--- a/pkl-server/src/main/kotlin/org/pkl/server/ServerMessagePackEncoder.kt
+++ b/pkl-server/src/main/kotlin/org/pkl/server/ServerMessagePackEncoder.kt
@@ -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
diff --git a/pkl-server/src/main/kotlin/org/pkl/server/Utils.kt b/pkl-server/src/main/kotlin/org/pkl/server/Utils.kt
index c5b7536d..b749f0dd 100644
--- a/pkl-server/src/main/kotlin/org/pkl/server/Utils.kt
+++ b/pkl-server/src/main/kotlin/org/pkl/server/Utils.kt
@@ -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 Future.getUnderlying(): T =
try {
get()
diff --git a/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt b/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt
index d18c58f9..00a7ab51 100644
--- a/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt
+++ b/pkl-server/src/test/kotlin/org/pkl/server/AbstractServerTest.kt
@@ -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()
@@ -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()
@@ -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()
@@ -309,7 +307,7 @@ abstract class AbstractServerTest {
res = read*("bird:/**.txt").keys
"""
.trimIndent(),
- "res"
+ "res",
)
)
val listResourcesRequest = client.receive()
@@ -318,7 +316,7 @@ abstract class AbstractServerTest {
listResourcesRequest.requestId,
listResourcesRequest.evaluatorId,
null,
- null
+ null,
)
)
val evaluateResponse = client.receive()
@@ -345,7 +343,7 @@ abstract class AbstractServerTest {
res = read*("bird:/**.txt").keys
"""
.trimIndent(),
- "res"
+ "res",
)
)
val listResourcesRequest = client.receive()
@@ -355,7 +353,7 @@ abstract class AbstractServerTest {
listResourcesRequest.requestId,
listResourcesRequest.evaluatorId,
null,
- "didnt work"
+ "didnt work",
)
)
val evaluateResponse = client.receive()
@@ -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()
@@ -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()
@@ -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()
@@ -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()
@@ -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()
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()
assertThat(resp2.error).isNull()
assertThat(resp2.result).isNotNull()
@@ -987,7 +955,7 @@ abstract class AbstractServerTest {
project,
http,
null,
- null
+ null,
)
send(message)
diff --git a/pkl-server/src/test/kotlin/org/pkl/server/BinaryEvaluatorSnippetTests.kt b/pkl-server/src/test/kotlin/org/pkl/server/BinaryEvaluatorSnippetTests.kt
index a14ff93c..e8bfc77f 100644
--- a/pkl-server/src/test/kotlin/org/pkl/server/BinaryEvaluatorSnippetTests.kt
+++ b/pkl-server/src/test/kotlin/org/pkl/server/BinaryEvaluatorSnippetTests.kt
@@ -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
diff --git a/pkl-server/src/test/kotlin/org/pkl/server/MessagePackDebugRenderer.kt b/pkl-server/src/test/kotlin/org/pkl/server/MessagePackDebugRenderer.kt
index bf6d34c0..71e7f715 100644
--- a/pkl-server/src/test/kotlin/org/pkl/server/MessagePackDebugRenderer.kt
+++ b/pkl-server/src/test/kotlin/org/pkl/server/MessagePackDebugRenderer.kt
@@ -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")
}
diff --git a/pkl-tools/gradle.lockfile b/pkl-tools/gradle.lockfile
index ce508df2..6c205ae2 100644
--- a/pkl-tools/gradle.lockfile
+++ b/pkl-tools/gradle.lockfile
@@ -12,17 +12,17 @@ org.commonmark:commonmark:0.24.0=runtimeClasspath,testRuntimeClasspath
org.fusesource.jansi:jansi:2.4.1=runtimeClasspath,testRuntimeClasspath
org.graalvm.sdk:graal-sdk:23.0.6=runtimeClasspath,testRuntimeClasspath
org.graalvm.truffle:truffle-api:23.0.6=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-reflect:1.7.10=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-common:1.7.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlin:kotlin-stdlib:1.7.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-html-jvm:0.8.1=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-bom:1.5.1=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.5.1=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.5.1=runtimeClasspath,testRuntimeClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-reflect:2.0.21=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-common:2.0.21=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.0.21=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.21=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.0.21=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-html-jvm:0.11.0=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-bom:1.8.0=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.8.0=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-core:1.8.0=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.8.0=runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0=runtimeClasspath,testRuntimeClasspath
org.jetbrains:annotations:13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
org.jline:jline-native:3.23.0=runtimeClasspath,testRuntimeClasspath
org.jline:jline-reader:3.23.0=runtimeClasspath,testRuntimeClasspath
diff --git a/pkl-tools/pkl-tools.gradle.kts b/pkl-tools/pkl-tools.gradle.kts
index df6fed1a..980d79c5 100644
--- a/pkl-tools/pkl-tools.gradle.kts
+++ b/pkl-tools/pkl-tools.gradle.kts
@@ -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.
@@ -39,6 +39,7 @@ dependencies {
api(projects.pklConfigJava)
api(projects.pklCore)
api(projects.pklDoc)
+ api(projects.pklCommons)
// used by `pklFatJar` plugin (ideally this would be inferred automatically)
firstPartySourcesJars(project(":pkl-cli", "sourcesJar"))