Skip to content

Commit

Permalink
Fix generation of xcontent provider Manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
breskeby committed Oct 23, 2023
1 parent cfb0780 commit ee2980a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,15 +36,13 @@ public GenerateProviderManifest() {}
@InputFiles
abstract public ConfigurableFileCollection getProviderImplClasspath();

@Input
abstract public Property<String> 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");
}

Expand Down
7 changes: 3 additions & 4 deletions libs/x-content/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ee2980a

Please sign in to comment.