"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/ApplicationPluginAction.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.

ApplicationPluginAction.java  (spring-boot-2.7.3):ApplicationPluginAction.java  (spring-boot-2.7.4)
skipping to change at line 34 skipping to change at line 34
import org.gradle.api.GradleException; import org.gradle.api.GradleException;
import org.gradle.api.Plugin; import org.gradle.api.Plugin;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Configuration;
import org.gradle.api.distribution.Distribution; import org.gradle.api.distribution.Distribution;
import org.gradle.api.distribution.DistributionContainer; import org.gradle.api.distribution.DistributionContainer;
import org.gradle.api.file.CopySpec; import org.gradle.api.file.CopySpec;
import org.gradle.api.file.FileCollection; import org.gradle.api.file.FileCollection;
import org.gradle.api.plugins.ApplicationPlugin; import org.gradle.api.plugins.ApplicationPlugin;
import org.gradle.api.plugins.ApplicationPluginConvention; import org.gradle.api.plugins.JavaApplication;
import org.gradle.api.tasks.TaskProvider; import org.gradle.api.tasks.TaskProvider;
import org.gradle.jvm.application.scripts.TemplateBasedScriptGenerator; import org.gradle.jvm.application.scripts.TemplateBasedScriptGenerator;
import org.gradle.jvm.application.tasks.CreateStartScripts; import org.gradle.jvm.application.tasks.CreateStartScripts;
/** /**
* Action that is executed in response to the {@link ApplicationPlugin} being ap plied. * Action that is executed in response to the {@link ApplicationPlugin} being ap plied.
* *
* @author Andy Wilkinson * @author Andy Wilkinson
*/ */
final class ApplicationPluginAction implements PluginApplicationAction { final class ApplicationPluginAction implements PluginApplicationAction {
@Override @Override
public void execute(Project project) { public void execute(Project project) {
ApplicationPluginConvention applicationConvention = project.getCo JavaApplication javaApplication = project.getExtensions().getByTy
nvention() pe(JavaApplication.class);
.getPlugin(ApplicationPluginConvention.class);
DistributionContainer distributions = project.getExtensions().get ByType(DistributionContainer.class); DistributionContainer distributions = project.getExtensions().get ByType(DistributionContainer.class);
Distribution distribution = distributions.create("boot"); Distribution distribution = distributions.create("boot");
distribution.getDistributionBaseName() distribution.getDistributionBaseName()
.convention((project.provider(() -> applicationCo nvention.getApplicationName() + "-boot"))); .convention((project.provider(() -> javaApplicati on.getApplicationName() + "-boot")));
TaskProvider<CreateStartScripts> bootStartScripts = project.getTa sks().register("bootStartScripts", TaskProvider<CreateStartScripts> bootStartScripts = project.getTa sks().register("bootStartScripts",
CreateStartScripts.class, CreateStartScripts.class,
(task) -> configureCreateStartScripts(project, ap plicationConvention, distribution, task)); (task) -> configureCreateStartScripts(project, ja vaApplication, distribution, task));
CopySpec binCopySpec = project.copySpec().into("bin").from(bootSt artScripts); CopySpec binCopySpec = project.copySpec().into("bin").from(bootSt artScripts);
binCopySpec.setFileMode(0755); binCopySpec.setFileMode(0755);
distribution.getContents().with(binCopySpec); distribution.getContents().with(binCopySpec);
} }
private void configureCreateStartScripts(Project project, ApplicationPlug inConvention applicationConvention, private void configureCreateStartScripts(Project project, JavaApplication javaApplication,
Distribution distribution, CreateStartScripts createStart Scripts) { Distribution distribution, CreateStartScripts createStart Scripts) {
createStartScripts createStartScripts
.setDescription("Generates OS-specific start scri pts to run the project as a Spring Boot application."); .setDescription("Generates OS-specific start scri pts to run the project as a Spring Boot application.");
((TemplateBasedScriptGenerator) createStartScripts.getUnixStartSc riptGenerator()) ((TemplateBasedScriptGenerator) createStartScripts.getUnixStartSc riptGenerator())
.setTemplate(project.getResources().getText().fro mString(loadResource("/unixStartScript.txt"))); .setTemplate(project.getResources().getText().fro mString(loadResource("/unixStartScript.txt")));
((TemplateBasedScriptGenerator) createStartScripts.getWindowsStar tScriptGenerator()) ((TemplateBasedScriptGenerator) createStartScripts.getWindowsStar tScriptGenerator())
.setTemplate(project.getResources().getText().fro mString(loadResource("/windowsStartScript.txt"))); .setTemplate(project.getResources().getText().fro mString(loadResource("/windowsStartScript.txt")));
project.getConfigurations().all((configuration) -> { project.getConfigurations().all((configuration) -> {
if ("bootArchives".equals(configuration.getName())) { if ("bootArchives".equals(configuration.getName())) {
distribution.getContents().with(artifactFilesToLi bCopySpec(project, configuration)); distribution.getContents().with(artifactFilesToLi bCopySpec(project, configuration));
createStartScripts.setClasspath(configuration.get Artifacts().getFiles()); createStartScripts.setClasspath(configuration.get Artifacts().getFiles());
} }
}); });
createStartScripts.getConventionMapping().map("outputDir", createStartScripts.getConventionMapping().map("outputDir",
() -> new File(project.getBuildDir(), "bootScript s")); () -> new File(project.getBuildDir(), "bootScript s"));
createStartScripts.getConventionMapping().map("applicationName", createStartScripts.getConventionMapping().map("applicationName",
applicationConvention::getApplicationName); javaApplication::getApplicationName);
createStartScripts.getConventionMapping().map("defaultJvmOpts", createStartScripts.getConventionMapping().map("defaultJvmOpts", j
applicationConvention::getApplicationDefaultJvmAr avaApplication::getApplicationDefaultJvmArgs);
gs);
} }
private CopySpec artifactFilesToLibCopySpec(Project project, Configuratio n configuration) { private CopySpec artifactFilesToLibCopySpec(Project project, Configuratio n configuration) {
CopySpec copySpec = project.copySpec().into("lib").from(artifactF iles(configuration)); CopySpec copySpec = project.copySpec().into("lib").from(artifactF iles(configuration));
copySpec.setFileMode(0644); copySpec.setFileMode(0644);
return copySpec; return copySpec;
} }
private Callable<FileCollection> artifactFiles(Configuration configuratio n) { private Callable<FileCollection> artifactFiles(Configuration configuratio n) {
return () -> configuration.getArtifacts().getFiles(); return () -> configuration.getArtifacts().getFiles();
 End of changes. 6 change blocks. 
12 lines changed or deleted 10 lines changed or added

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