SpringBootExtension.java (spring-boot-2.7.3) | : | SpringBootExtension.java (spring-boot-2.7.4) | ||
---|---|---|---|---|
/* | /* | |||
* Copyright 2012-2021 the original author or authors. | * Copyright 2012-2022 the original author or 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. | |||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | |||
* | * | |||
* https://www.apache.org/licenses/LICENSE-2.0 | * https://www.apache.org/licenses/LICENSE-2.0 | |||
* | * | |||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
skipping to change at line 25 | skipping to change at line 25 | |||
*/ | */ | |||
package org.springframework.boot.gradle.dsl; | package org.springframework.boot.gradle.dsl; | |||
import java.io.File; | import java.io.File; | |||
import org.gradle.api.Action; | import org.gradle.api.Action; | |||
import org.gradle.api.Project; | import org.gradle.api.Project; | |||
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.provider.Property; | import org.gradle.api.provider.Property; | |||
import org.gradle.api.tasks.SourceSet; | import org.gradle.api.tasks.SourceSet; | |||
import org.gradle.api.tasks.SourceSetContainer; | ||||
import org.gradle.api.tasks.TaskContainer; | import org.gradle.api.tasks.TaskContainer; | |||
import org.gradle.api.tasks.TaskProvider; | import org.gradle.api.tasks.TaskProvider; | |||
import org.gradle.jvm.tasks.Jar; | import org.gradle.jvm.tasks.Jar; | |||
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfo; | import org.springframework.boot.gradle.tasks.buildinfo.BuildInfo; | |||
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfoProperties; | import org.springframework.boot.gradle.tasks.buildinfo.BuildInfoProperties; | |||
/** | /** | |||
* Entry point to Spring Boot's Gradle DSL. | * Entry point to Spring Boot's Gradle DSL. | |||
* | * | |||
skipping to change at line 115 | skipping to change at line 115 | |||
} | } | |||
private void configureBuildInfoTask(BuildInfo task) { | private void configureBuildInfoTask(BuildInfo task) { | |||
task.setGroup(BasePlugin.BUILD_GROUP); | task.setGroup(BasePlugin.BUILD_GROUP); | |||
task.setDescription("Generates a META-INF/build-info.properties f ile."); | task.setDescription("Generates a META-INF/build-info.properties f ile."); | |||
task.getConventionMapping().map("destinationDir", | task.getConventionMapping().map("destinationDir", | |||
() -> new File(determineMainSourceSetResourcesOut putDir(), "META-INF")); | () -> new File(determineMainSourceSetResourcesOut putDir(), "META-INF")); | |||
} | } | |||
private File determineMainSourceSetResourcesOutputDir() { | private File determineMainSourceSetResourcesOutputDir() { | |||
return this.project.getConvention().getPlugin(JavaPluginConventio | return sourceSets(this.project).getByName(SourceSet.MAIN_SOURCE_S | |||
n.class).getSourceSets() | ET_NAME).getOutput().getResourcesDir(); | |||
.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOut | } | |||
put().getResourcesDir(); | ||||
@SuppressWarnings("deprecation") | ||||
private SourceSetContainer sourceSets(Project project) { | ||||
return project.getConvention().getPlugin(org.gradle.api.plugins.J | ||||
avaPluginConvention.class).getSourceSets(); | ||||
} | } | |||
private String determineArtifactBaseName() { | private String determineArtifactBaseName() { | |||
Jar artifactTask = findArtifactTask(); | Jar artifactTask = findArtifactTask(); | |||
return (artifactTask != null) ? artifactTask.getArchiveBaseName() .get() : null; | return (artifactTask != null) ? artifactTask.getArchiveBaseName() .get() : null; | |||
} | } | |||
private Jar findArtifactTask() { | private Jar findArtifactTask() { | |||
Jar artifactTask = (Jar) this.project.getTasks().findByName("boot War"); | Jar artifactTask = (Jar) this.project.getTasks().findByName("boot War"); | |||
if (artifactTask != null) { | if (artifactTask != null) { | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 10 lines changed or added |