mirror of
https://github.com/apple/pkl.git
synced 2026-05-21 22:36:57 +02:00
ad06a96a8a
Changes: - Update wrapper by running the following command: ./gradlew wrapper --gradle-version 8.11 --gradle-distribution-sha256-sum 57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9 - Verify wrapper JAR integrity according to: https://docs.gradle.org/current/userguide/gradle_wrapper.html# manually_verifying_the_gradle_wrapper_jar - Replace usages of deprecated method `Project.exec` with `ExecOperations.exec` - Convert extension function `Task.configureInstallGraalVm` to task class `InstallGraalVm` - a task class is the cleanest way to get hold of `ExecOperations` - Move extension property `BuildInfo.GraalVm.downloadFile` into class `GraalVm` - Don't apply plugin `pklGraalVm` in project `bench` (unnecessary, now causes error)
75 lines
2.3 KiB
Kotlin
75 lines
2.3 KiB
Kotlin
/*
|
|
* Copyright © 2024 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.
|
|
*/
|
|
import de.undercouch.gradle.tasks.download.Download
|
|
import de.undercouch.gradle.tasks.download.Verify
|
|
|
|
plugins { id("de.undercouch.download") }
|
|
|
|
val buildInfo = project.extensions.getByType<BuildInfo>()
|
|
|
|
// tries to minimize chance of corruption by download-to-temp-file-and-move
|
|
val downloadGraalVmAarch64 by
|
|
tasks.registering(Download::class) { configureDownloadGraalVm(buildInfo.graalVmAarch64) }
|
|
|
|
val downloadGraalVmAmd64 by
|
|
tasks.registering(Download::class) { configureDownloadGraalVm(buildInfo.graalVmAmd64) }
|
|
|
|
fun Download.configureDownloadGraalVm(graalvm: BuildInfo.GraalVm) {
|
|
onlyIf { !graalvm.installDir.exists() }
|
|
doLast { println("Downloaded GraalVm to ${graalvm.downloadFile}") }
|
|
|
|
src(graalvm.downloadUrl)
|
|
dest(graalvm.downloadFile)
|
|
overwrite(false)
|
|
tempAndMove(true)
|
|
}
|
|
|
|
val verifyGraalVmAarch64 by
|
|
tasks.registering(Verify::class) {
|
|
configureVerifyGraalVm(buildInfo.graalVmAarch64)
|
|
dependsOn(downloadGraalVmAarch64)
|
|
}
|
|
|
|
val verifyGraalVmAmd64 by
|
|
tasks.registering(Verify::class) {
|
|
configureVerifyGraalVm(buildInfo.graalVmAmd64)
|
|
dependsOn(downloadGraalVmAmd64)
|
|
}
|
|
|
|
fun Verify.configureVerifyGraalVm(graalvm: BuildInfo.GraalVm) {
|
|
onlyIf { !graalvm.installDir.exists() }
|
|
|
|
src(graalvm.downloadFile)
|
|
checksum(
|
|
buildInfo.libs.findVersion("graalVmSha256-${graalvm.osName}-${graalvm.arch}").get().toString()
|
|
)
|
|
algorithm("SHA-256")
|
|
}
|
|
|
|
@Suppress("unused")
|
|
val installGraalVmAarch64 by
|
|
tasks.registering(InstallGraalVm::class) {
|
|
dependsOn(verifyGraalVmAarch64)
|
|
graalVm = buildInfo.graalVmAarch64
|
|
}
|
|
|
|
@Suppress("unused")
|
|
val installGraalVmAmd64 by
|
|
tasks.registering(InstallGraalVm::class) {
|
|
dependsOn(verifyGraalVmAmd64)
|
|
graalVm = buildInfo.graalVmAmd64
|
|
}
|