WarPluginAction.java (spring-boot-2.7.3) | : | WarPluginAction.java (spring-boot-2.7.4) | ||
---|---|---|---|---|
skipping to change at line 75 | skipping to change at line 75 | |||
private void classifyWarTask(Project project) { | private void classifyWarTask(Project project) { | |||
project.getTasks().named(WarPlugin.WAR_TASK_NAME, War.class) | project.getTasks().named(WarPlugin.WAR_TASK_NAME, War.class) | |||
.configure((war) -> war.getArchiveClassifier().co nvention("plain")); | .configure((war) -> war.getArchiveClassifier().co nvention("plain")); | |||
} | } | |||
private TaskProvider<BootWar> configureBootWarTask(Project project) { | private TaskProvider<BootWar> configureBootWarTask(Project project) { | |||
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 = () -> project.getConvention( | Callable<FileCollection> classpath = () -> sourceSets(project).ge | |||
).getByType(SourceSetContainer.class) | tByName(SourceSet.MAIN_SOURCE_SET_NAME) | |||
.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getRun | .getRuntimeClasspath().minus(providedRuntimeConfi | |||
timeClasspath() | guration(project)) | |||
.minus(providedRuntimeConfiguration(project)).min | .minus((developmentOnly.minus(productionRuntimeCl | |||
us((developmentOnly.minus(productionRuntimeClasspath))) | asspath))).filter(new JarTypeFileSpec()); | |||
.filter(new JarTypeFileSpec()); | ||||
TaskProvider<ResolveMainClassName> resolveMainClassName = Resolve MainClassName | TaskProvider<ResolveMainClassName> resolveMainClassName = Resolve MainClassName | |||
.registerForTask(SpringBootPlugin.BOOT_WAR_TASK_N AME, project, classpath); | .registerForTask(SpringBootPlugin.BOOT_WAR_TASK_N AME, project, classpath); | |||
TaskProvider<BootWar> bootWarProvider = project.getTasks().regist er(SpringBootPlugin.BOOT_WAR_TASK_NAME, | TaskProvider<BootWar> bootWarProvider = project.getTasks().regist er(SpringBootPlugin.BOOT_WAR_TASK_NAME, | |||
BootWar.class, (bootWar) -> { | BootWar.class, (bootWar) -> { | |||
bootWar.setGroup(BasePlugin.BUILD_GROUP); | bootWar.setGroup(BasePlugin.BUILD_GROUP); | |||
bootWar.setDescription("Assembles an exec utable war archive containing webapp" | bootWar.setDescription("Assembles an exec utable war archive containing webapp" | |||
+ " content, and the main classes and their dependencies."); | + " content, and the main classes and their dependencies."); | |||
bootWar.providedClasspath(providedRuntime Configuration(project)); | bootWar.providedClasspath(providedRuntime Configuration(project)); | |||
bootWar.setClasspath(classpath); | bootWar.setClasspath(classpath); | |||
Provider<String> manifestStartClass = pro ject | Provider<String> manifestStartClass = pro ject | |||
.provider(() -> (String) bootWar.getManifest().getAttributes().get("Start-Class")); | .provider(() -> (String) bootWar.getManifest().getAttributes().get("Start-Class")); | |||
bootWar.getMainClass() | bootWar.getMainClass() | |||
.convention(resolveMainCl assName.flatMap((resolver) -> manifestStartClass.isPresent() | .convention(resolveMainCl assName.flatMap((resolver) -> manifestStartClass.isPresent() | |||
? manifes tStartClass : resolveMainClassName.get().readMainClassName())); | ? manifes tStartClass : resolveMainClassName.get().readMainClassName())); | |||
}); | }); | |||
bootWarProvider.map(War::getClasspath); | bootWarProvider.map(War::getClasspath); | |||
return bootWarProvider; | return bootWarProvider; | |||
} | } | |||
@SuppressWarnings("deprecation") | ||||
private SourceSetContainer sourceSets(Project project) { | ||||
return project.getConvention().getPlugin(org.gradle.api.plugins.J | ||||
avaPluginConvention.class).getSourceSets(); | ||||
} | ||||
private FileCollection providedRuntimeConfiguration(Project project) { | private FileCollection providedRuntimeConfiguration(Project project) { | |||
ConfigurationContainer configurations = project.getConfigurations (); | ConfigurationContainer configurations = project.getConfigurations (); | |||
return configurations.getByName(WarPlugin.PROVIDED_RUNTIME_CONFIG URATION_NAME); | return configurations.getByName(WarPlugin.PROVIDED_RUNTIME_CONFIG URATION_NAME); | |||
} | } | |||
private void configureBootBuildImageTask(Project project, TaskProvider<Bo otWar> bootWar) { | private void configureBootBuildImageTask(Project project, TaskProvider<Bo otWar> bootWar) { | |||
project.getTasks().named(SpringBootPlugin.BOOT_BUILD_IMAGE_TASK_N AME, BootBuildImage.class) | project.getTasks().named(SpringBootPlugin.BOOT_BUILD_IMAGE_TASK_N AME, BootBuildImage.class) | |||
.configure((buildImage) -> buildImage.getArchiveF ile().set(bootWar.get().getArchiveFile())); | .configure((buildImage) -> buildImage.getArchiveF ile().set(bootWar.get().getArchiveFile())); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 12 lines changed or added |