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)