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 cd1a263 commit f461c10
Showing 1 changed file with 8 additions and 0 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,6 +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()));

// 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 f461c10

Please sign in to comment.