From ee2980a9397e3829f584b969f53c3f8be657447f Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Mon, 23 Oct 2023 10:08:02 +0200 Subject: [PATCH] Fix generation of xcontent provider Manifest Fixes #101191 --- .../gradle/internal/GenerateProviderManifest.java | 13 +++++++------ libs/x-content/build.gradle | 7 +++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/GenerateProviderManifest.java b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/GenerateProviderManifest.java index 6f07b198e7e8a..9420f732cd14d 100644 --- a/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/GenerateProviderManifest.java +++ b/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/GenerateProviderManifest.java @@ -12,11 +12,14 @@ import org.gradle.api.DefaultTask; import org.gradle.api.file.ConfigurableFileCollection; import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.file.RegularFile; +import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.Property; import org.gradle.api.tasks.Classpath; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFiles; import org.gradle.api.tasks.OutputDirectory; +import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; import java.io.File; @@ -33,15 +36,13 @@ public GenerateProviderManifest() {} @InputFiles abstract public ConfigurableFileCollection getProviderImplClasspath(); - @Input - abstract public Property getManifestName(); - - @OutputDirectory - abstract DirectoryProperty getOutputDir(); + @OutputFile + abstract RegularFileProperty getManifestFile(); @TaskAction void generateManifest() { - File manifestFile = getOutputDir().file(getManifestName().get()).get().getAsFile(); + File manifestFile = getManifestFile().get().getAsFile(); + manifestFile.getParentFile().mkdirs(); FileUtils.write(manifestFile, generateManifestContent(), "UTF-8"); } diff --git a/libs/x-content/build.gradle b/libs/x-content/build.gradle index f934d7ce09386..5c9dd49c007b8 100644 --- a/libs/x-content/build.gradle +++ b/libs/x-content/build.gradle @@ -67,15 +67,14 @@ tasks.named("dependencyLicenses").configure { mapping from: /jackson-.*/, to: 'jackson' } -File generatedResourcesDir = new File(buildDir, 'generated-resources') +Directory generatedResourcesDir = layout.buildDirectory.dir('generated-resources').get() def generateProviderManifest = tasks.register("generateProviderManifest", GenerateProviderManifest.class) { - outputDir = layout.buildDirectory.dir('generated-resources') - manifestName = "LISTING.TXT" + manifestFile = generatedResourcesDir.file("LISTING.TXT") getProviderImplClasspath().from(configurations.providerImpl) } def generateProviderImpl = tasks.register("generateProviderImpl", Sync) { - destinationDir = new File(generatedResourcesDir, "impl") + destinationDir = generatedResourcesDir.dir("impl").getAsFile() into("IMPL-JARS/x-content") { from(configurations.providerImpl) from(generateProviderManifest)