"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java" between
spring-boot-2.7.3.tar.gz and spring-boot-2.7.4.tar.gz

About: Spring Boot helps to create Spring-powered, production-grade applications and services.

JavaPluginAction.java  (spring-boot-2.7.3):JavaPluginAction.java  (spring-boot-2.7.4)
skipping to change at line 39 skipping to change at line 39
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.attributes.AttributeContainer; import org.gradle.api.attributes.AttributeContainer;
import org.gradle.api.attributes.Bundling; import org.gradle.api.attributes.Bundling;
import org.gradle.api.attributes.LibraryElements; import org.gradle.api.attributes.LibraryElements;
import org.gradle.api.attributes.Usage; import org.gradle.api.attributes.Usage;
import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileCollection;
import org.gradle.api.model.ObjectFactory; import org.gradle.api.model.ObjectFactory;
import org.gradle.api.plugins.ApplicationPlugin; import org.gradle.api.plugins.ApplicationPlugin;
import org.gradle.api.plugins.BasePlugin; import org.gradle.api.plugins.BasePlugin;
import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.provider.Provider; import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.TaskProvider; import org.gradle.api.tasks.TaskProvider;
import org.gradle.api.tasks.bundling.Jar; import org.gradle.api.tasks.bundling.Jar;
import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.jvm.toolchain.JavaToolchainService; import org.gradle.jvm.toolchain.JavaToolchainService;
import org.gradle.jvm.toolchain.JavaToolchainSpec; import org.gradle.jvm.toolchain.JavaToolchainSpec;
skipping to change at line 101 skipping to change at line 100
project.getTasks().named(JavaPlugin.JAR_TASK_NAME, Jar.class) project.getTasks().named(JavaPlugin.JAR_TASK_NAME, Jar.class)
.configure((task) -> task.getArchiveClassifier(). convention("plain")); .configure((task) -> task.getArchiveClassifier(). convention("plain"));
} }
private void configureBuildTask(Project project) { private void configureBuildTask(Project project) {
project.getTasks().named(BasePlugin.ASSEMBLE_TASK_NAME) project.getTasks().named(BasePlugin.ASSEMBLE_TASK_NAME)
.configure((task) -> task.dependsOn(this.singlePu blishedArtifact)); .configure((task) -> task.dependsOn(this.singlePu blishedArtifact));
} }
private TaskProvider<BootJar> configureBootJarTask(Project project) { private TaskProvider<BootJar> configureBootJarTask(Project project) {
SourceSet mainSourceSet = javaPluginConvention(project).getSource SourceSet mainSourceSet = sourceSets(project).getByName(SourceSet
Sets() .MAIN_SOURCE_SET_NAME);
.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
Configuration developmentOnly = project.getConfigurations() Configuration developmentOnly = project.getConfigurations()
.getByName(SpringBootPlugin.DEVELOPMENT_ONLY_CONF IGURATION_NAME); .getByName(SpringBootPlugin.DEVELOPMENT_ONLY_CONF IGURATION_NAME);
Configuration productionRuntimeClasspath = project.getConfigurati ons() Configuration productionRuntimeClasspath = project.getConfigurati ons()
.getByName(SpringBootPlugin.PRODUCTION_RUNTIME_CL ASSPATH_CONFIGURATION_NAME); .getByName(SpringBootPlugin.PRODUCTION_RUNTIME_CL ASSPATH_CONFIGURATION_NAME);
Callable<FileCollection> classpath = () -> mainSourceSet.getRunti meClasspath() Callable<FileCollection> classpath = () -> mainSourceSet.getRunti meClasspath()
.minus((developmentOnly.minus(productionRuntimeCl asspath))).filter(new JarTypeFileSpec()); .minus((developmentOnly.minus(productionRuntimeCl asspath))).filter(new JarTypeFileSpec());
TaskProvider<ResolveMainClassName> resolveMainClassName = Resolve MainClassName TaskProvider<ResolveMainClassName> resolveMainClassName = Resolve MainClassName
.registerForTask(SpringBootPlugin.BOOT_JAR_TASK_N AME, project, classpath); .registerForTask(SpringBootPlugin.BOOT_JAR_TASK_N AME, project, classpath);
return project.getTasks().register(SpringBootPlugin.BOOT_JAR_TASK _NAME, BootJar.class, (bootJar) -> { return project.getTasks().register(SpringBootPlugin.BOOT_JAR_TASK _NAME, BootJar.class, (bootJar) -> {
bootJar.setDescription( bootJar.setDescription(
skipping to change at line 128 skipping to change at line 126
bootJar.getMainClass().convention(resolveMainClassName.fl atMap((resolver) -> manifestStartClass.isPresent() bootJar.getMainClass().convention(resolveMainClassName.fl atMap((resolver) -> manifestStartClass.isPresent()
? manifestStartClass : resolveMainClassNa me.get().readMainClassName())); ? manifestStartClass : resolveMainClassNa me.get().readMainClassName()));
}); });
} }
private void configureBootBuildImageTask(Project project, TaskProvider<Bo otJar> bootJar) { private void configureBootBuildImageTask(Project project, TaskProvider<Bo otJar> bootJar) {
project.getTasks().register(SpringBootPlugin.BOOT_BUILD_IMAGE_TAS K_NAME, BootBuildImage.class, (buildImage) -> { project.getTasks().register(SpringBootPlugin.BOOT_BUILD_IMAGE_TAS K_NAME, BootBuildImage.class, (buildImage) -> {
buildImage.setDescription("Builds an OCI image of the app lication using the output of the bootJar task"); buildImage.setDescription("Builds an OCI image of the app lication using the output of the bootJar task");
buildImage.setGroup(BasePlugin.BUILD_GROUP); buildImage.setGroup(BasePlugin.BUILD_GROUP);
buildImage.getArchiveFile().set(bootJar.get().getArchiveF ile()); buildImage.getArchiveFile().set(bootJar.get().getArchiveF ile());
buildImage.getTargetJavaVersion() buildImage.getTargetJavaVersion().set(project.provider(
.set(project.provider(() -> javaPluginCon () -> project.getExtensions().getByType(J
vention(project).getTargetCompatibility())); avaPluginExtension.class).getTargetCompatibility()));
}); });
} }
private void configureArtifactPublication(TaskProvider<BootJar> bootJar) { private void configureArtifactPublication(TaskProvider<BootJar> bootJar) {
this.singlePublishedArtifact.addJarCandidate(bootJar); this.singlePublishedArtifact.addJarCandidate(bootJar);
} }
private void configureBootRunTask(Project project) { private void configureBootRunTask(Project project) {
Callable<FileCollection> classpath = () -> javaPluginConvention(p Callable<FileCollection> classpath = () -> sourceSets(project).fi
roject).getSourceSets() ndByName(SourceSet.MAIN_SOURCE_SET_NAME)
.findByName(SourceSet.MAIN_SOURCE_SET_NAME).getRu .getRuntimeClasspath().filter(new JarTypeFileSpec
ntimeClasspath().filter(new JarTypeFileSpec()); ());
TaskProvider<ResolveMainClassName> resolveProvider = ResolveMainC lassName.registerForTask("bootRun", project, TaskProvider<ResolveMainClassName> resolveProvider = ResolveMainC lassName.registerForTask("bootRun", project,
classpath); classpath);
project.getTasks().register("bootRun", BootRun.class, (run) -> { project.getTasks().register("bootRun", BootRun.class, (run) -> {
run.setDescription("Runs this project as a Spring Boot ap plication."); run.setDescription("Runs this project as a Spring Boot ap plication.");
run.setGroup(ApplicationPlugin.APPLICATION_GROUP); run.setGroup(ApplicationPlugin.APPLICATION_GROUP);
run.classpath(classpath); run.classpath(classpath);
run.getConventionMapping().map("jvmArgs", () -> { run.getConventionMapping().map("jvmArgs", () -> {
if (project.hasProperty("applicationDefaultJvmArg s")) { if (project.hasProperty("applicationDefaultJvmArg s")) {
return project.property("applicationDefau ltJvmArgs"); return project.property("applicationDefau ltJvmArgs");
} }
skipping to change at line 163 skipping to change at line 161
configureToolchainConvention(project, run); configureToolchainConvention(project, run);
}); });
} }
private void configureToolchainConvention(Project project, BootRun run) { private void configureToolchainConvention(Project project, BootRun run) {
JavaToolchainSpec toolchain = project.getExtensions().getByType(J avaPluginExtension.class).getToolchain(); JavaToolchainSpec toolchain = project.getExtensions().getByType(J avaPluginExtension.class).getToolchain();
JavaToolchainService toolchainService = project.getExtensions().g etByType(JavaToolchainService.class); JavaToolchainService toolchainService = project.getExtensions().g etByType(JavaToolchainService.class);
run.getJavaLauncher().convention(toolchainService.launcherFor(too lchain)); run.getJavaLauncher().convention(toolchainService.launcherFor(too lchain));
} }
private JavaPluginConvention javaPluginConvention(Project project) { @SuppressWarnings("deprecation")
return project.getConvention().getPlugin(JavaPluginConvention.cla private SourceSetContainer sourceSets(Project project) {
ss); return project.getConvention().getPlugin(org.gradle.api.plugins.J
avaPluginConvention.class).getSourceSets();
} }
private void configureUtf8Encoding(Project evaluatedProject) { private void configureUtf8Encoding(Project evaluatedProject) {
evaluatedProject.getTasks().withType(JavaCompile.class).configure Each(this::configureUtf8Encoding); evaluatedProject.getTasks().withType(JavaCompile.class).configure Each(this::configureUtf8Encoding);
} }
private void configureUtf8Encoding(JavaCompile compile) { private void configureUtf8Encoding(JavaCompile compile) {
if (compile.getOptions().getEncoding() == null) { if (compile.getOptions().getEncoding() == null) {
compile.getOptions().setEncoding("UTF-8"); compile.getOptions().setEncoding("UTF-8");
} }
skipping to change at line 192 skipping to change at line 191
} }
}); });
} }
private void configureAdditionalMetadataLocations(Project project) { private void configureAdditionalMetadataLocations(Project project) {
project.afterEvaluate((evaluated) -> evaluated.getTasks().withTyp e(JavaCompile.class) project.afterEvaluate((evaluated) -> evaluated.getTasks().withTyp e(JavaCompile.class)
.configureEach(this::configureAdditionalMetadataL ocations)); .configureEach(this::configureAdditionalMetadataL ocations));
} }
private void configureAdditionalMetadataLocations(JavaCompile compile) { private void configureAdditionalMetadataLocations(JavaCompile compile) {
SourceSetContainer sourceSets = compile.getProject().getConventio sourceSets(compile.getProject()).stream()
n().getPlugin(JavaPluginConvention.class) .filter((candidate) -> candidate.getCompileJavaTa
.getSourceSets(); skName().equals(compile.getName()))
sourceSets.stream().filter((candidate) -> candidate.getCompileJav
aTaskName().equals(compile.getName()))
.map((match) -> match.getResources().getSrcDirs() ).findFirst() .map((match) -> match.getResources().getSrcDirs() ).findFirst()
.ifPresent((locations) -> compile.doFirst(new Add itionalMetadataLocationsConfigurer(locations))); .ifPresent((locations) -> compile.doFirst(new Add itionalMetadataLocationsConfigurer(locations)));
} }
private void configureDevelopmentOnlyConfiguration(Project project) { private void configureDevelopmentOnlyConfiguration(Project project) {
Configuration developmentOnly = project.getConfigurations() Configuration developmentOnly = project.getConfigurations()
.create(SpringBootPlugin.DEVELOPMENT_ONLY_CONFIGU RATION_NAME); .create(SpringBootPlugin.DEVELOPMENT_ONLY_CONFIGU RATION_NAME);
developmentOnly developmentOnly
.setDescription("Configuration for development-on ly dependencies such as Spring Boot's DevTools."); .setDescription("Configuration for development-on ly dependencies such as Spring Boot's DevTools.");
Configuration runtimeClasspath = project.getConfigurations() Configuration runtimeClasspath = project.getConfigurations()
 End of changes. 6 change blocks. 
19 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)