From dee3c6e44facda3dd68c2e2f190cd5db87a59d05 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Mon, 30 Dec 2024 09:52:20 +0100 Subject: [PATCH] Fix hadoop client api patch configuration cache compatibility (#119324) --- .../hadoop-client-api/build.gradle | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/repository-hdfs/hadoop-client-api/build.gradle b/plugins/repository-hdfs/hadoop-client-api/build.gradle index 5e87b8129250..213dd02f9bd1 100644 --- a/plugins/repository-hdfs/hadoop-client-api/build.gradle +++ b/plugins/repository-hdfs/hadoop-client-api/build.gradle @@ -1,3 +1,5 @@ +import org.gradle.api.file.ArchiveOperations + apply plugin: 'elasticsearch.java' sourceSets { @@ -27,16 +29,23 @@ def patchTask = tasks.register("patchClasses", JavaExec) { outputs.dir(outputDir) classpath = sourceSets.patcher.runtimeClasspath mainClass = 'org.elasticsearch.hdfs.patch.HdfsClassPatcher' + def thejar = configurations.thejar doFirst { - args(configurations.thejar.singleFile, outputDir.get().asFile) + args(thejar.singleFile, outputDir.get().asFile) } } + +interface InjectedArchiveOps { + @Inject ArchiveOperations getArchiveOperations() +} + tasks.named('jar').configure { dependsOn(configurations.thejar) - + def injected = project.objects.newInstance(InjectedArchiveOps) + def thejar = configurations.thejar from(patchTask) - from({ project.zipTree(configurations.thejar.singleFile) }) { + from({ injected.getArchiveOperations().zipTree(thejar.singleFile) }) { eachFile { if (outputDir.get().file(it.relativePath.pathString).asFile.exists()) { it.exclude()