Enable caching of native image building and test tasks (#409)

Enable caching for the native image building task and improves the caching effectiveness of some of the test tasks in the project.
This commit is contained in:
Stefano Baghino
2024-04-18 17:28:56 +02:00
committed by GitHub
parent 31917d1556
commit 81bfdb7cbd
4 changed files with 16 additions and 14 deletions

View File

@@ -138,9 +138,11 @@ fun Exec.configureExecutable(isEnabled: Boolean, outputFile: Provider<RegularFil
enabled = isEnabled
dependsOn(":installGraalVm")
inputs.files(sourceSets.main.map { it.output })
inputs.files(configurations.runtimeClasspath)
inputs.files(sourceSets.main.map { it.output }).withPropertyName("mainSourceSets").withPathSensitivity(PathSensitivity.RELATIVE)
inputs.files(configurations.runtimeClasspath).withPropertyName("runtimeClasspath").withNormalizer(ClasspathNormalizer::class)
inputs.files(file(buildInfo.graalVm.baseDir).resolve("bin/native-image")).withPropertyName("graalVmNativeImage").withPathSensitivity(PathSensitivity.ABSOLUTE)
outputs.file(outputFile)
outputs.cacheIf { true }
workingDir(outputFile.map { it.asFile.parentFile })
executable = "${buildInfo.graalVm.baseDir}/bin/native-image"