mirror of
https://github.com/apple/pkl.git
synced 2026-04-10 18:57:00 +02:00
Support building with JDK 21 (#234)
- Update google-java-format to a version compatible with JDK 21 and run "gw spotlessApply". - Fix wrong test assumption JavaCodeGenerator writes a properties file using java.util.Properties, which doesn't guarantee order of entries. - Fix most deprecation warnings - Add CI job for JDK 21
This commit is contained in:
@@ -4,7 +4,6 @@ import java.io.File
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.VersionCatalog
|
||||
import org.gradle.api.artifacts.VersionCatalogsExtension
|
||||
import org.gradle.api.artifacts.VersionConstraint
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
|
||||
// `buildInfo` in main build scripts
|
||||
@@ -109,7 +108,7 @@ open class BuildInfo(project: Project) {
|
||||
// only run command once per build invocation
|
||||
if (project === project.rootProject) {
|
||||
Runtime.getRuntime()
|
||||
.exec("git rev-parse --short HEAD", arrayOf(), project.rootDir)
|
||||
.exec(arrayOf("git", "rev-parse", "--short", "HEAD"), arrayOf(), project.rootDir)
|
||||
.inputStream.reader().readText().trim()
|
||||
} else {
|
||||
project.rootProject.extensions.getByType(BuildInfo::class.java).commitId
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import java.net.URL
|
||||
import org.gradle.util.GradleVersion
|
||||
import groovy.json.JsonSlurper
|
||||
import java.net.URI
|
||||
|
||||
@Suppress("unused")
|
||||
class GradleVersionInfo(json: Map<String, Any>) {
|
||||
@@ -50,18 +50,18 @@ class GradleVersionInfo(json: Map<String, Any>) {
|
||||
|
||||
private fun fetchSingle(url: String): GradleVersionInfo {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return GradleVersionInfo(JsonSlurper().parse(URL(url)) as Map<String, Any>)
|
||||
return GradleVersionInfo(JsonSlurper().parse(URI(url).toURL()) as Map<String, Any>)
|
||||
}
|
||||
|
||||
private fun fetchSingleOrNull(url: String): GradleVersionInfo? {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val json = JsonSlurper().parse(URL(url)) as Map<String, Any>
|
||||
val json = JsonSlurper().parse(URI(url).toURL()) as Map<String, Any>
|
||||
return if (json.isEmpty()) null else GradleVersionInfo(json)
|
||||
}
|
||||
|
||||
private fun fetchMultiple(url: String): List<GradleVersionInfo> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return (JsonSlurper().parse(URL(url)) as List<Map<String, Any>>)
|
||||
return (JsonSlurper().parse(URI(url).toURL()) as List<Map<String, Any>>)
|
||||
.map { GradleVersionInfo(it) }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user