Browse Source

Fix hadoop client api patch configuration cache compatibility (#119324) (#119340)

Rene Groeschke 9 months ago
parent
commit
110681a9c4
1 changed files with 12 additions and 3 deletions
  1. 12 3
      plugins/repository-hdfs/hadoop-client-api/build.gradle

+ 12 - 3
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()