Build with Gradle 9.1.0
This commit is contained in:
parent
2440667aab
commit
44099d3d21
|
@ -80,7 +80,6 @@ tasks.register("integrationTest") {
|
||||||
ant.propertyref(name: "ivy.class.path")
|
ant.propertyref(name: "ivy.class.path")
|
||||||
}
|
}
|
||||||
plainlistener()
|
plainlistener()
|
||||||
file(layout.buildDirectory.dir("test-results/integrationTest")).mkdirs()
|
|
||||||
xmllistener(toDir: resultsDir)
|
xmllistener(toDir: resultsDir)
|
||||||
fileset(dir: layout.buildDirectory.dir("it").get().asFile.toString(), includes: "**/build.xml")
|
fileset(dir: layout.buildDirectory.dir("it").get().asFile.toString(), includes: "**/build.xml")
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,9 +141,13 @@ final class ApplicationPluginAction implements PluginApplicationAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void configureFileMode(CopySpec copySpec, int mode) {
|
private void configureFileMode(CopySpec copySpec, int mode) {
|
||||||
copySpec.setFileMode(mode);
|
try {
|
||||||
|
copySpec.getClass().getMethod("setFileMode", Integer.class).invoke(copySpec, Integer.valueOf(mode));
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
throw new RuntimeException("Failed to set file mode on CopySpec", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,6 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||||
private void configureProductionRuntimeClasspathConfiguration(Project project) {
|
private void configureProductionRuntimeClasspathConfiguration(Project project) {
|
||||||
Configuration productionRuntimeClasspath = project.getConfigurations()
|
Configuration productionRuntimeClasspath = project.getConfigurations()
|
||||||
.create(SpringBootPlugin.PRODUCTION_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
|
.create(SpringBootPlugin.PRODUCTION_RUNTIME_CLASSPATH_CONFIGURATION_NAME);
|
||||||
productionRuntimeClasspath.setVisible(false);
|
|
||||||
Configuration runtimeClasspath = project.getConfigurations()
|
Configuration runtimeClasspath = project.getConfigurations()
|
||||||
.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
|
.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
|
||||||
productionRuntimeClasspath.attributes((attributes) -> {
|
productionRuntimeClasspath.attributes((attributes) -> {
|
||||||
|
|
|
@ -104,7 +104,6 @@ class WarPluginAction implements PluginApplicationAction {
|
||||||
.set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility()));
|
.set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility()));
|
||||||
bootWar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts());
|
bootWar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts());
|
||||||
});
|
});
|
||||||
bootWarProvider.map(War::getClasspath);
|
|
||||||
return bootWarProvider;
|
return bootWarProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.springframework.util.Assert;
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
@CacheableTask
|
@CacheableTask
|
||||||
public class ProcessTestAot extends AbstractAot {
|
public abstract class ProcessTestAot extends AbstractAot {
|
||||||
|
|
||||||
private @Nullable FileCollection classpathRoots;
|
private @Nullable FileCollection classpathRoots;
|
||||||
|
|
||||||
|
|
|
@ -22,25 +22,19 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.gradle.api.file.ConfigurableFilePermissions;
|
import org.gradle.api.file.ConfigurableFilePermissions;
|
||||||
import org.gradle.api.file.CopySpec;
|
import org.gradle.api.file.CopySpec;
|
||||||
import org.gradle.api.file.FileCopyDetails;
|
import org.gradle.api.file.FileCopyDetails;
|
||||||
import org.gradle.api.file.FileTreeElement;
|
import org.gradle.api.file.FileTreeElement;
|
||||||
import org.gradle.api.file.RelativePath;
|
|
||||||
import org.gradle.api.internal.file.copy.CopyAction;
|
import org.gradle.api.internal.file.copy.CopyAction;
|
||||||
import org.gradle.api.internal.file.copy.CopyActionProcessingStream;
|
|
||||||
import org.gradle.api.internal.file.copy.FileCopyDetailsInternal;
|
|
||||||
import org.gradle.api.java.archives.Attributes;
|
import org.gradle.api.java.archives.Attributes;
|
||||||
import org.gradle.api.java.archives.Manifest;
|
import org.gradle.api.java.archives.Manifest;
|
||||||
import org.gradle.api.provider.Property;
|
import org.gradle.api.provider.Property;
|
||||||
import org.gradle.api.specs.Spec;
|
import org.gradle.api.specs.Spec;
|
||||||
import org.gradle.api.specs.Specs;
|
import org.gradle.api.specs.Specs;
|
||||||
import org.gradle.api.tasks.WorkResult;
|
|
||||||
import org.gradle.api.tasks.bundling.Jar;
|
import org.gradle.api.tasks.bundling.Jar;
|
||||||
import org.gradle.api.tasks.util.PatternSet;
|
import org.gradle.api.tasks.util.PatternSet;
|
||||||
import org.gradle.util.GradleVersion;
|
import org.gradle.util.GradleVersion;
|
||||||
|
@ -142,7 +136,7 @@ class BootArchiveSupport {
|
||||||
CopyAction action = new BootZipCopyAction(output, manifest, preserveFileTimestamps, dirPermissions,
|
CopyAction action = new BootZipCopyAction(output, manifest, preserveFileTimestamps, dirPermissions,
|
||||||
filePermissions, includeDefaultLoader, jarmodeToolsLocation, requiresUnpack, exclusions, launchScript,
|
filePermissions, includeDefaultLoader, jarmodeToolsLocation, requiresUnpack, exclusions, launchScript,
|
||||||
librarySpec, compressionResolver, encoding, resolvedDependencies, supportsSignatureFile, layerResolver);
|
librarySpec, compressionResolver, encoding, resolvedDependencies, supportsSignatureFile, layerResolver);
|
||||||
return jar.isReproducibleFileOrder() ? new ReproducibleOrderingCopyAction(action) : action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable Integer getUnixNumericDirPermissions(CopySpec copySpec) {
|
private @Nullable Integer getUnixNumericDirPermissions(CopySpec copySpec) {
|
||||||
|
@ -159,14 +153,22 @@ class BootArchiveSupport {
|
||||||
return permissions.isPresent() ? permissions.get().toUnixNumeric() : null;
|
return permissions.isPresent() ? permissions.get().toUnixNumeric() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private @Nullable Integer getDirMode(CopySpec copySpec) {
|
private @Nullable Integer getDirMode(CopySpec copySpec) {
|
||||||
return copySpec.getDirMode();
|
try {
|
||||||
|
return (Integer) copySpec.getClass().getMethod("getDirMode").invoke(copySpec);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
throw new RuntimeException("Failed to get dir mode from CopySpec", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private @Nullable Integer getFileMode(CopySpec copySpec) {
|
private @Nullable Integer getFileMode(CopySpec copySpec) {
|
||||||
return copySpec.getFileMode();
|
try {
|
||||||
|
return (Integer) copySpec.getClass().getMethod("getFileMode").invoke(copySpec);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
throw new RuntimeException("Failed to get file mode from CopySpec", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUsingDefaultLoader(Jar jar) {
|
private boolean isUsingDefaultLoader(Jar jar) {
|
||||||
|
@ -229,26 +231,4 @@ class BootArchiveSupport {
|
||||||
details.setRelativePath(details.getRelativeSourcePath());
|
details.setRelativePath(details.getRelativeSourcePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link CopyAction} variant that sorts entries to ensure reproducible ordering.
|
|
||||||
*/
|
|
||||||
private static final class ReproducibleOrderingCopyAction implements CopyAction {
|
|
||||||
|
|
||||||
private final CopyAction delegate;
|
|
||||||
|
|
||||||
private ReproducibleOrderingCopyAction(CopyAction delegate) {
|
|
||||||
this.delegate = delegate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public WorkResult execute(CopyActionProcessingStream stream) {
|
|
||||||
return this.delegate.execute((action) -> {
|
|
||||||
Map<RelativePath, FileCopyDetailsInternal> detailsByPath = new TreeMap<>();
|
|
||||||
stream.process((details) -> detailsByPath.put(details.getRelativePath(), details));
|
|
||||||
detailsByPath.values().forEach(action::processFile);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,9 +504,13 @@ class BootZipCopyAction implements CopyAction {
|
||||||
? details.getPermissions().toUnixNumeric() : getMode(details);
|
? details.getPermissions().toUnixNumeric() : getMode(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private int getMode(FileCopyDetails details) {
|
private int getMode(FileCopyDetails details) {
|
||||||
return details.getMode();
|
try {
|
||||||
|
return (int) details.getClass().getMethod("getMode").invoke(details);
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
throw new RuntimeException("Failed to get mode from FileCopyDetails", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,6 @@ import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.internal.project.ProjectInternal;
|
|
||||||
import org.gradle.initialization.GradlePropertiesController;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.io.TempDir;
|
import org.junit.jupiter.api.io.TempDir;
|
||||||
|
|
||||||
|
@ -173,11 +171,7 @@ class BuildInfoTests {
|
||||||
|
|
||||||
private Project createProject(String projectName) {
|
private Project createProject(String projectName) {
|
||||||
File projectDir = new File(this.temp, projectName);
|
File projectDir = new File(this.temp, projectName);
|
||||||
Project project = GradleProjectBuilder.builder().withProjectDir(projectDir).withName(projectName).build();
|
return GradleProjectBuilder.builder().withProjectDir(projectDir).withName(projectName).build();
|
||||||
((ProjectInternal) project).getServices()
|
|
||||||
.get(GradlePropertiesController.class)
|
|
||||||
.loadGradlePropertiesFrom(projectDir, false);
|
|
||||||
return project;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BuildInfo createTask(Project project) {
|
private BuildInfo createTask(Project project) {
|
||||||
|
|
|
@ -233,14 +233,8 @@ abstract class AbstractBootArchiveIntegrationTests {
|
||||||
.filter((entry) -> !entry.isDirectory())
|
.filter((entry) -> !entry.isDirectory())
|
||||||
.map(JarEntry::getName)
|
.map(JarEntry::getName)
|
||||||
.filter((name) -> name.startsWith(this.libPath));
|
.filter((name) -> name.startsWith(this.libPath));
|
||||||
if (this.gradleBuild.gradleVersionIsLessThan("9.0.0-rc-1")) {
|
assertThat(libEntryNames).containsExactly(this.libPath + "two-1.0.jar",
|
||||||
assertThat(libEntryNames).containsExactly(this.libPath + "two-1.0.jar",
|
this.libPath + "commons-io-2.19.0.jar");
|
||||||
this.libPath + "commons-io-2.19.0.jar");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
assertThat(libEntryNames).containsExactly(this.libPath + "commons-io-2.19.0.jar",
|
|
||||||
this.libPath + "two-1.0.jar");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.nio.file.attribute.PosixFilePermission;
|
import java.nio.file.attribute.PosixFilePermission;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -35,6 +37,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.jar.JarOutputStream;
|
import java.util.jar.JarOutputStream;
|
||||||
|
@ -407,23 +410,46 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void reproducibleOrderingCanBeEnabled() throws IOException {
|
void archiveIsReproducibleByDefault() throws IOException {
|
||||||
this.task.getMainClass().set("com.example.Main");
|
this.task.getMainClass().set("com.example.Main");
|
||||||
this.task.from(newFile("bravo.txt"), newFile("alpha.txt"), newFile("charlie.txt"));
|
this.task.from(newFiles("files/b/bravo.txt", "files/a/alpha.txt", "files/c/charlie.txt"));
|
||||||
this.task.setReproducibleFileOrder(true);
|
|
||||||
executeTask();
|
executeTask();
|
||||||
assertThat(this.task.getArchiveFile().get().getAsFile()).exists();
|
assertThat(this.task.getArchiveFile().get().getAsFile()).exists();
|
||||||
List<String> textFiles = new ArrayList<>();
|
List<String> files = new ArrayList<>();
|
||||||
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
|
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
|
||||||
Enumeration<JarEntry> entries = jarFile.entries();
|
Enumeration<JarEntry> entries = jarFile.entries();
|
||||||
while (entries.hasMoreElements()) {
|
while (entries.hasMoreElements()) {
|
||||||
JarEntry entry = entries.nextElement();
|
JarEntry entry = entries.nextElement();
|
||||||
if (entry.getName().endsWith(".txt")) {
|
OffsetDateTime lastModifiedTime = entry.getLastModifiedTime().toInstant().atOffset(ZoneOffset.UTC);
|
||||||
textFiles.add(entry.getName());
|
assertThat(lastModifiedTime).isEqualTo(OffsetDateTime.of(1980, 2, 1, 0, 0, 0, 0, ZoneOffset.UTC));
|
||||||
|
if (entry.getName().startsWith("files/")) {
|
||||||
|
files.add(entry.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assertThat(files).containsExactly("files/", "files/a/", "files/a/alpha.txt", "files/b/", "files/b/bravo.txt",
|
||||||
|
"files/c/", "files/c/charlie.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void archiveReproducibilityCanBeDisabled() throws IOException {
|
||||||
|
this.task.getMainClass().set("com.example.Main");
|
||||||
|
this.task.from(newFiles("files/b/bravo.txt", "files/a/alpha.txt", "files/c/charlie.txt"));
|
||||||
|
this.task.setPreserveFileTimestamps(true);
|
||||||
|
this.task.setReproducibleFileOrder(false);
|
||||||
|
executeTask();
|
||||||
|
assertThat(this.task.getArchiveFile().get().getAsFile()).exists();
|
||||||
|
try (JarFile jarFile = new JarFile(this.task.getArchiveFile().get().getAsFile())) {
|
||||||
|
Enumeration<JarEntry> entries = jarFile.entries();
|
||||||
|
while (entries.hasMoreElements()) {
|
||||||
|
JarEntry entry = entries.nextElement();
|
||||||
|
if (entry.getName().endsWith(".txt") || entry.getName().startsWith("BOOT-INF/lib/")) {
|
||||||
|
OffsetDateTime lastModifiedTime = entry.getLastModifiedTime().toInstant().atOffset(ZoneOffset.UTC);
|
||||||
|
assertThat(lastModifiedTime)
|
||||||
|
.isNotEqualTo(OffsetDateTime.of(1980, 2, 1, 0, 0, 0, 0, ZoneOffset.UTC));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assertThat(textFiles).containsExactly("alpha.txt", "bravo.txt", "charlie.txt");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -663,6 +689,19 @@ abstract class AbstractBootArchiveTests<T extends Jar & BootArchive> {
|
||||||
return entryNames;
|
return entryNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected File newFiles(String... names) throws IOException {
|
||||||
|
File dir = new File(this.temp, UUID.randomUUID().toString());
|
||||||
|
dir.mkdir();
|
||||||
|
List<File> files = new ArrayList<>();
|
||||||
|
for (String name : names) {
|
||||||
|
File file = new File(dir, name);
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
file.createNewFile();
|
||||||
|
files.add(file);
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
protected File newFile(String name) throws IOException {
|
protected File newFile(String name) throws IOException {
|
||||||
File file = new File(this.temp, name);
|
File file = new File(this.temp, name);
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
|
|
|
@ -66,18 +66,10 @@ class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
|
||||||
copyClasspathApplication();
|
copyClasspathApplication();
|
||||||
BuildResult result = this.gradleBuild.build("launch");
|
BuildResult result = this.gradleBuild.build("launch");
|
||||||
String output = result.getOutput();
|
String output = result.getOutput();
|
||||||
if (this.gradleBuild.gradleVersionIsLessThan("9.0.0-rc-1")) {
|
assertThat(output).containsPattern("1\\. .*classes");
|
||||||
assertThat(output).containsPattern("1\\. .*classes");
|
assertThat(output).containsPattern("2\\. .*library-1.0-SNAPSHOT.jar");
|
||||||
assertThat(output).containsPattern("2\\. .*library-1.0-SNAPSHOT.jar");
|
assertThat(output).containsPattern("3\\. .*commons-lang3-3.9.jar");
|
||||||
assertThat(output).containsPattern("3\\. .*commons-lang3-3.9.jar");
|
assertThat(output).containsPattern("4\\. .*spring-boot-jarmode-tools.*.jar");
|
||||||
assertThat(output).containsPattern("4\\. .*spring-boot-jarmode-tools.*.jar");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
assertThat(output).containsPattern("1\\. .*classes");
|
|
||||||
assertThat(output).containsPattern("2\\. .*commons-lang3-3.9.jar");
|
|
||||||
assertThat(output).containsPattern("3\\. .*library-1.0-SNAPSHOT.jar");
|
|
||||||
assertThat(output).containsPattern("4\\. .*spring-boot-jarmode-tools.*.jar");
|
|
||||||
}
|
|
||||||
assertThat(output).doesNotContain("5. ");
|
assertThat(output).doesNotContain("5. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,18 +78,10 @@ class BootJarIntegrationTests extends AbstractBootArchiveIntegrationTests {
|
||||||
copyClasspathApplication();
|
copyClasspathApplication();
|
||||||
BuildResult result = this.gradleBuild.build("launch");
|
BuildResult result = this.gradleBuild.build("launch");
|
||||||
String output = result.getOutput();
|
String output = result.getOutput();
|
||||||
if (this.gradleBuild.gradleVersionIsLessThan("9.0.0-rc-1")) {
|
assertThat(output).containsPattern("1\\. .*classes");
|
||||||
assertThat(output).containsPattern("1\\. .*classes");
|
assertThat(output).containsPattern("2\\. .*spring-boot-jarmode-tools.*.jar");
|
||||||
assertThat(output).containsPattern("2\\. .*spring-boot-jarmode-tools.*.jar");
|
assertThat(output).containsPattern("3\\. .*library-1.0-SNAPSHOT.jar");
|
||||||
assertThat(output).containsPattern("3\\. .*library-1.0-SNAPSHOT.jar");
|
assertThat(output).containsPattern("4\\. .*commons-lang3-3.9.jar");
|
||||||
assertThat(output).containsPattern("4\\. .*commons-lang3-3.9.jar");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
assertThat(output).containsPattern("1\\. .*classes");
|
|
||||||
assertThat(output).containsPattern("2\\. .*spring-boot-jarmode-tools.*.jar");
|
|
||||||
assertThat(output).containsPattern("3\\. .*commons-lang3-3.9.jar");
|
|
||||||
assertThat(output).containsPattern("4\\. .*library-1.0-SNAPSHOT.jar");
|
|
||||||
}
|
|
||||||
assertThat(output).doesNotContain("5. ");
|
assertThat(output).doesNotContain("5. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ plugins {
|
||||||
|
|
||||||
bootJar {
|
bootJar {
|
||||||
mainClass = 'com.example.Application'
|
mainClass = 'com.example.Application'
|
||||||
preserveFileTimestamps = false
|
if (GradleVersion.current().compareTo(GradleVersion.version("9.0.0-rc-1")) < 0) {
|
||||||
reproducibleFileOrder = true
|
preserveFileTimestamps = false
|
||||||
|
reproducibleFileOrder = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ plugins {
|
||||||
|
|
||||||
bootWar {
|
bootWar {
|
||||||
mainClass = 'com.example.Application'
|
mainClass = 'com.example.Application'
|
||||||
preserveFileTimestamps = false
|
if (GradleVersion.current().compareTo(GradleVersion.version("9.0.0-rc-1")) < 0) {
|
||||||
reproducibleFileOrder = true
|
preserveFileTimestamps = false
|
||||||
|
reproducibleFileOrder = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class OptionalDependenciesPlugin implements Plugin<Project> {
|
||||||
@Override
|
@Override
|
||||||
public void apply(Project project) {
|
public void apply(Project project) {
|
||||||
Configuration optional = project.getConfigurations().create("optional");
|
Configuration optional = project.getConfigurations().create("optional");
|
||||||
optional.setCanBeConsumed(false);
|
optional.setCanBeConsumed(true);
|
||||||
optional.setCanBeResolved(false);
|
optional.setCanBeResolved(false);
|
||||||
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
||||||
SourceSetContainer sourceSets = project.getExtensions()
|
SourceSetContainer sourceSets = project.getExtensions()
|
||||||
|
|
|
@ -166,6 +166,7 @@ class TestFailuresPluginIntegrationTests {
|
||||||
writer.println("dependencies {");
|
writer.println("dependencies {");
|
||||||
writer.println(" testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'");
|
writer.println(" testImplementation 'org.junit.jupiter:junit-jupiter:5.6.0'");
|
||||||
writer.println(" testImplementation 'org.assertj:assertj-core:3.11.1'");
|
writer.println(" testImplementation 'org.assertj:assertj-core:3.11.1'");
|
||||||
|
writer.println(" testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.6.0'");
|
||||||
writer.println("}");
|
writer.println("}");
|
||||||
writer.println();
|
writer.println();
|
||||||
writer.println("test {");
|
writer.println("test {");
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
||||||
|
|
||||||
import org.springframework.boot.build.docs.ConfigureJavadocLinks
|
import org.springframework.boot.build.docs.ConfigureJavadocLinks
|
||||||
|
import org.springframework.boot.build.optional.OptionalDependenciesPlugin
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "dev.adamko.dokkatoo-html"
|
id "dev.adamko.dokkatoo-html"
|
||||||
|
@ -237,9 +238,48 @@ dokkatoo {
|
||||||
moduleName.set("Spring Boot Kotlin API")
|
moduleName.set("Spring Boot Kotlin API")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
javadoc {
|
||||||
|
canBeConsumed = true
|
||||||
|
canBeResolved = false
|
||||||
|
attributes {
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
|
||||||
|
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EMBEDDED))
|
||||||
|
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, DocsType.JAVADOC))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
javadocSource {
|
||||||
|
transitive = false
|
||||||
|
canBeConsumed = false
|
||||||
|
canBeResolved = true
|
||||||
|
attributes {
|
||||||
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.VERIFICATION))
|
||||||
|
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, DocsType.SOURCES))
|
||||||
|
attribute(VerificationType.VERIFICATION_TYPE_ATTRIBUTE, objects.named(VerificationType.class, VerificationType.MAIN_SOURCES))
|
||||||
|
}
|
||||||
|
extendsFrom configurations.javadoc
|
||||||
|
}
|
||||||
|
javadocClasspath {
|
||||||
|
canBeConsumed = false
|
||||||
|
canBeResolved = true
|
||||||
|
attributes {
|
||||||
|
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
|
||||||
|
}
|
||||||
|
extendsFrom configurations.javadoc
|
||||||
|
resolutionStrategy.eachDependency {
|
||||||
|
if (it.requested.group == 'org.opensaml') {
|
||||||
|
it.useVersion '4.0.1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def aggregatedJavadoc = tasks.register('aggregatedJavadoc', Javadoc) {
|
def aggregatedJavadoc = tasks.register('aggregatedJavadoc', Javadoc) {
|
||||||
dependsOn configurations.resolvedBom
|
dependsOn configurations.resolvedBom
|
||||||
destinationDir = project.file(project.layout.buildDirectory.dir("docs/javadoc"))
|
destinationDir = project.file(project.layout.buildDirectory.dir("docs/javadoc"))
|
||||||
|
source = configurations.javadocSource
|
||||||
|
classpath = configurations.javadocClasspath
|
||||||
|
include("**/*.java")
|
||||||
options {
|
options {
|
||||||
author = true
|
author = true
|
||||||
docTitle = "Spring Boot ${project.version} API"
|
docTitle = "Spring Boot ${project.version} API"
|
||||||
|
@ -253,7 +293,7 @@ def aggregatedJavadoc = tasks.register('aggregatedJavadoc', Javadoc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
project.rootProject.gradle.projectsEvaluated {
|
project.rootProject.gradle.projectsEvaluated {
|
||||||
Set<Project> publishedProjects = rootProject.subprojects
|
rootProject.subprojects
|
||||||
.findAll { it != project }
|
.findAll { it != project }
|
||||||
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
|
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
|
||||||
.findAll { !it.path.contains(":build-plugin:") }
|
.findAll { !it.path.contains(":build-plugin:") }
|
||||||
|
@ -262,11 +302,14 @@ project.rootProject.gradle.projectsEvaluated {
|
||||||
.findAll { !it.path.contains(":core:spring-boot-properties-migrator") }
|
.findAll { !it.path.contains(":core:spring-boot-properties-migrator") }
|
||||||
.findAll { !it.path.contains(":loader:spring-boot-jarmode-tools") }
|
.findAll { !it.path.contains(":loader:spring-boot-jarmode-tools") }
|
||||||
.findAll { !it.name.startsWith('spring-boot-starter') }
|
.findAll { !it.name.startsWith('spring-boot-starter') }
|
||||||
aggregatedJavadoc.configure {
|
.each { javadocProject ->
|
||||||
dependsOn publishedProjects.javadoc
|
dependencies {
|
||||||
source publishedProjects.javadoc.source
|
javadoc(project(javadocProject.path))
|
||||||
classpath = project.files(publishedProjects.javadoc.classpath)
|
if (javadocProject.plugins.hasPlugin(OptionalDependenciesPlugin)) {
|
||||||
}
|
javadoc(project(path: javadocProject.path, configuration: 'optional'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aggregates {
|
aggregates {
|
||||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015-2021 the original authors.
|
# Copyright © 2015 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
|
@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||||
NONSTOP* ) nonstop=true ;;
|
NONSTOP* ) nonstop=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
CLASSPATH="\\\"\\\""
|
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
|
@ -172,7 +171,6 @@ fi
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if "$cygwin" || "$msys" ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
-classpath "$CLASSPATH" \
|
|
||||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
|
|
@ -70,11 +70,10 @@ goto fail
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
set CLASSPATH=
|
|
||||||
|
|
||||||
|
|
||||||
@rem Execute Gradle
|
@rem Execute Gradle
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
|
|
@ -43,7 +43,7 @@ tasks.register("bootJarUnpack", BootJar.class) {
|
||||||
classpath = bootJar.classpath
|
classpath = bootJar.classpath
|
||||||
requiresUnpack '**/bcprov-jdk18on-*.jar'
|
requiresUnpack '**/bcprov-jdk18on-*.jar'
|
||||||
archiveClassifier.set("unpack")
|
archiveClassifier.set("unpack")
|
||||||
targetJavaVersion = targetCompatibility
|
targetJavaVersion = java.targetCompatibility
|
||||||
}
|
}
|
||||||
|
|
||||||
build.dependsOn bootJarUnpack
|
build.dependsOn bootJarUnpack
|
||||||
|
|
|
@ -86,7 +86,7 @@ static boolean isWindows() {
|
||||||
task.mainClass = "com.example.ResourceHandlingApplication"
|
task.mainClass = "com.example.ResourceHandlingApplication"
|
||||||
task.classpath = configurations.getByName(webServer)
|
task.classpath = configurations.getByName(webServer)
|
||||||
task.archiveClassifier = webServer
|
task.archiveClassifier = webServer
|
||||||
task.targetJavaVersion = project.getTargetCompatibility()
|
task.targetJavaVersion = java.targetCompatibility
|
||||||
}
|
}
|
||||||
tasks.register("${webServer}BootJar", BootJar, configurer)
|
tasks.register("${webServer}BootJar", BootJar, configurer)
|
||||||
tasks.register("${webServer}BootWar", BootWar, configurer)
|
tasks.register("${webServer}BootWar", BootWar, configurer)
|
||||||
|
|
|
@ -62,7 +62,7 @@ dependencies {
|
||||||
task.mainClass = "org.springframework.boot.sni.server.SniServerApplication"
|
task.mainClass = "org.springframework.boot.sni.server.SniServerApplication"
|
||||||
task.classpath = configurations.getByName(webServer)
|
task.classpath = configurations.getByName(webServer)
|
||||||
task.archiveClassifier = webServer
|
task.archiveClassifier = webServer
|
||||||
task.targetJavaVersion = project.getTargetCompatibility()
|
task.targetJavaVersion = project.java.targetCompatibility
|
||||||
}
|
}
|
||||||
tasks.register("${webServer}ServerApp", BootJar, configurer)
|
tasks.register("${webServer}ServerApp", BootJar, configurer)
|
||||||
}
|
}
|
|
@ -62,7 +62,7 @@ dependencies {
|
||||||
task.mainClass = "org.springframework.boot.sni.server.SniServerApplication"
|
task.mainClass = "org.springframework.boot.sni.server.SniServerApplication"
|
||||||
task.classpath = configurations.getByName(webServer)
|
task.classpath = configurations.getByName(webServer)
|
||||||
task.archiveClassifier = webServer
|
task.archiveClassifier = webServer
|
||||||
task.targetJavaVersion = project.getTargetCompatibility()
|
task.targetJavaVersion = project.java.targetCompatibility
|
||||||
}
|
}
|
||||||
tasks.register("${webServer}ServerApp", BootJar, configurer)
|
tasks.register("${webServer}ServerApp", BootJar, configurer)
|
||||||
}
|
}
|
|
@ -30,8 +30,3 @@ dependencies {
|
||||||
testImplementation("org.mockito:mockito-core")
|
testImplementation("org.mockito:mockito-core")
|
||||||
testImplementation("org.mockito:mockito-junit-jupiter")
|
testImplementation("org.mockito:mockito-junit-jupiter")
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
|
||||||
reproducibleFileOrder = true
|
|
||||||
preserveFileTimestamps = false
|
|
||||||
}
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ dependencies {
|
||||||
testImplementation("org.zeroturnaround:zt-zip:1.13")
|
testImplementation("org.zeroturnaround:zt-zip:1.13")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register("reproducibleLoaderJar", Jar) {
|
tasks.register("loaderJar", Jar) {
|
||||||
dependsOn configurations.loader
|
dependsOn configurations.loader
|
||||||
from {
|
from {
|
||||||
zipTree(configurations.loader.incoming.files.singleFile).matching {
|
zipTree(configurations.loader.incoming.files.singleFile).matching {
|
||||||
|
@ -59,8 +59,6 @@ tasks.register("reproducibleLoaderJar", Jar) {
|
||||||
exclude "META-INF/spring-boot.properties"
|
exclude "META-INF/spring-boot.properties"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reproducibleFileOrder = true
|
|
||||||
preserveFileTimestamps = false
|
|
||||||
archiveFileName = "spring-boot-loader.jar"
|
archiveFileName = "spring-boot-loader.jar"
|
||||||
destinationDirectory = file(generatedResources.map {it.dir("META-INF/loader") })
|
destinationDirectory = file(generatedResources.map {it.dir("META-INF/loader") })
|
||||||
}
|
}
|
||||||
|
@ -76,7 +74,7 @@ tasks.register("toolsJar", Sync) {
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
output.dir(generatedResources, builtBy: [toolsJar, reproducibleLoaderJar])
|
output.dir(generatedResources, builtBy: [toolsJar, loaderJar])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public final class GradleVersions {
|
||||||
if (isJavaVersion(JavaVersion.VERSION_25)) {
|
if (isJavaVersion(JavaVersion.VERSION_25)) {
|
||||||
return Arrays.asList("9.0.0", "9.1.0");
|
return Arrays.asList("9.0.0", "9.1.0");
|
||||||
}
|
}
|
||||||
return Arrays.asList(GradleVersion.current().getVersion(), "9.0.0", "9.1.0");
|
return Arrays.asList("8.14.3", "9.0.0", GradleVersion.current().getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String minimumCompatible() {
|
public static String minimumCompatible() {
|
||||||
|
|
Loading…
Reference in New Issue