Update to Gradle 8.6 (#245)

- Fix and clean up the pkl-commons-test build script.
- Change tests to read test packages/certs directly from
  the file system instead of packaging and reading them
  from the class path.
- Update expected checksums of some test packages.
- Fix a conflict between Pkl's and Gradle's
  Kotlin libraries in the pkl-gradle project.
- Fix build deprecation warnings.
- Ensure Gradle distribution integrity with `distributionSha256Sum`.
- Manually verify integrity of Gradle wrapper added by this commit.
This commit is contained in:
translatenix
2024-03-15 17:00:23 -07:00
committed by GitHub
parent faa7ac69bb
commit 496e064caf
26 changed files with 220 additions and 189 deletions

View File

@@ -7,7 +7,7 @@
"fruities": {
"uri": "package://localhost:12110/fruit@1.0.5",
"checksums": {
"sha256": "b4ea243de781feeab7921227591e6584db5d0673340f30fab2ffe8ad5c9f75f5"
"sha256": "abd173e8a25f5b930b0e34269a441e32c9d95e0b0a715bc6eff918f0afd0688e"
}
}
},

View File

@@ -22,6 +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
@@ -66,26 +67,20 @@ class PackageServer : AutoCloseable {
// Modified by RequestRewritingClient if testPort is set.
private const val PORT = 12110
// When tests are run via Gradle (i.e. from ./gradlew check), resources are packaged into a jar.
// When run directly in IntelliJ, resources are just directories.
private val packagesDir: Path by lazy {
val uri = PackageServer::class.java.getResource("packages")!!.toURI()
try {
Path.of(uri)
} catch (e: FileSystemNotFoundException) {
FileSystems.newFileSystem(uri, mapOf<String, String>())
Path.of(uri)
}
}
private val packagesDir: Path =
FileTestUtils.rootProjectDir.resolve("pkl-commons-test/build/test-packages")
private val simpleHttpsConfigurator by lazy {
val sslContext =
SSLContext.getInstance("SSL").apply {
val pass = "password".toCharArray()
val keystore = PackageServer::class.java.getResource("/localhost.p12")!!
val ks = KeyStore.getInstance("PKCS12").apply { load(keystore.openStream(), pass) }
val kmf = KeyManagerFactory.getInstance("SunX509").apply { init(ks, pass) }
init(kmf.keyManagers, null, null)
val keystore =
FileTestUtils.rootProjectDir.resolve("pkl-commons-test/build/keystore/localhost.p12")
keystore.inputStream().use { stream ->
val ks = KeyStore.getInstance("PKCS12").apply { load(stream, pass) }
val kmf = KeyManagerFactory.getInstance("SunX509").apply { init(ks, pass) }
init(kmf.keyManagers, null, null)
}
}
val engine = sslContext.createSSLEngine()
object : HttpsConfigurator(sslContext) {