Skip to content

Commit

Permalink
Make pegasus artifacts reproducible
Browse files Browse the repository at this point in the history
  • Loading branch information
DPUkyle committed Mar 23, 2021
1 parent 12d42a5 commit 0d198cb
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.Sync;
import org.gradle.api.tasks.TaskProvider;
import org.gradle.api.tasks.bundling.AbstractArchiveTask;
import org.gradle.api.tasks.bundling.Jar;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
Expand Down Expand Up @@ -1831,8 +1832,13 @@ protected GenerateDataTemplateTask configureDataTemplateGeneration(Project proje
// FIXME change to #getArchiveFile(); breaks backwards-compatibility before 5.1
project.getDependencies().add(compileConfigName, project.files(dataTemplateJarTask.getArchivePath()));

project.getPlugins().withId("ivy-publish", ivyPublish -> {
// TODO if !atLeastGradle53 throw
// make pegasus artifacts reproducible
// see https://docs.gradle.org/6.8.3/userguide/working_with_files.html#sec:reproducible_archives
project.getTasks().withType(AbstractArchiveTask.class).configureEach(task -> {
task.setPreserveFileTimestamps(false);
task.setReproducibleFileOrder(true);
});

project.getPlugins().withType(IvyPublishPlugin.class, ivyPublish -> {
if (!isAtLeastGradle61()) {
throw new GradleException("Using the ivy-publish plugin with the pegasus plugin requires Gradle 6.1 or higher " +
Expand Down

0 comments on commit 0d198cb

Please sign in to comment.