Use sorted properties to ensure output is repeatable

Closes gh-21593
pull/21605/head
Andy Wilkinson 5 years ago
parent 343e4d4318
commit b50b00d629

@ -30,6 +30,8 @@ import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskAction;
import org.springframework.core.CollectionFactory;
/**
* A {@link Task} for generating metadata describing a project's auto-configuration
* classes.
@ -73,7 +75,7 @@ public class AutoConfigurationMetadata extends AbstractTask {
}
private Properties readAutoConfiguration() throws IOException {
Properties autoConfiguration = new Properties();
Properties autoConfiguration = CollectionFactory.createSortedProperties(true);
Properties springFactories = readSpringFactories(
new File(this.sourceSet.getOutput().getResourcesDir(), "META-INF/spring.factories"));
autoConfiguration.setProperty("autoConfigurationClassNames",

@ -32,6 +32,8 @@ import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;
import org.springframework.core.CollectionFactory;
/**
* A {@link Task} for generating metadata that describes a starter.
*
@ -68,7 +70,7 @@ public class StarterMetadata extends AbstractTask {
@TaskAction
void generateMetadata() throws IOException {
Properties properties = new Properties();
Properties properties = CollectionFactory.createSortedProperties(true);
properties.setProperty("name", getProject().getName());
properties.setProperty("description", getProject().getDescription());
properties.setProperty("dependencies", String.join(",", this.dependencies.getResolvedConfiguration()

@ -42,6 +42,7 @@ import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskAction;
import org.springframework.core.CollectionFactory;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.classreading.MetadataReader;
@ -91,7 +92,7 @@ public class TestSliceMetadata extends AbstractTask {
}
private Properties readTestSlices() throws IOException {
Properties testSlices = new Properties();
Properties testSlices = CollectionFactory.createSortedProperties(true);
try (URLClassLoader classLoader = new URLClassLoader(
StreamSupport.stream(this.sourceSet.getRuntimeClasspath().spliterator(), false).map(this::toURL)
.toArray(URL[]::new))) {

Loading…
Cancel
Save