mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge branch '4.1.x'
Closes gh-51793
This commit is contained in:
@@ -26,6 +26,7 @@ import groovy.util.Node;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
import org.gradle.api.plugins.JavaPlatformExtension;
|
||||
import org.gradle.api.plugins.JavaPlatformPlugin;
|
||||
import org.gradle.api.plugins.PluginContainer;
|
||||
@@ -63,21 +64,24 @@ public class BomPlugin implements Plugin<Project> {
|
||||
TaskProvider<CreateResolvedBom> createResolvedBom = project.getTasks()
|
||||
.register("createResolvedBom", CreateResolvedBom.class, bom);
|
||||
TaskProvider<CheckBom> checkBom = project.getTasks().register("bomrCheck", CheckBom.class, bom);
|
||||
checkBom.configure(
|
||||
(task) -> task.getResolvedBomFile().set(createResolvedBom.flatMap(CreateResolvedBom::getOutputFile)));
|
||||
checkBom.configure((task) -> setResolvedBom(task.getResolvedBomFile(), createResolvedBom));
|
||||
TaskProvider<CheckLinks> checkLinks = project.getTasks().register("checkLinks", CheckLinks.class, bom);
|
||||
checkLinks.configure((task) -> setResolvedBom(task.getResolvedBomFile(), createResolvedBom));
|
||||
Configuration resolvedBom = project.getConfigurations().create("resolvedBom");
|
||||
project.getTasks().named("check").configure((check) -> check.dependsOn(checkBom));
|
||||
project.getTasks().register("bomrUpgrade", UpgradeBom.class, bom);
|
||||
project.getTasks().register("moveToSnapshots", MoveToSnapshots.class, bom);
|
||||
project.getTasks()
|
||||
.register("checkLinks", CheckLinks.class, bom, resolvedBom)
|
||||
.configure((task) -> task.dependsOn(resolvedBom));
|
||||
project.getArtifacts()
|
||||
.add(resolvedBom.getName(), createResolvedBom.map(CreateResolvedBom::getOutputFile),
|
||||
(artifact) -> artifact.builtBy(createResolvedBom));
|
||||
new PublishingCustomizer(project, bom).customize();
|
||||
}
|
||||
|
||||
private void setResolvedBom(RegularFileProperty resolvedBomFile,
|
||||
TaskProvider<CreateResolvedBom> createResolvedBom) {
|
||||
resolvedBomFile.set(createResolvedBom.flatMap(CreateResolvedBom::getOutputFile));
|
||||
}
|
||||
|
||||
private void createApiEnforcedConfiguration(Project project) {
|
||||
Configuration apiEnforced = project.getConfigurations()
|
||||
.create(API_ENFORCED_CONFIGURATION_NAME, (configuration) -> {
|
||||
|
||||
@@ -25,7 +25,10 @@ import org.apache.hc.client5.http.config.RequestConfig;
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
import org.gradle.api.DefaultTask;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.file.RegularFileProperty;
|
||||
import org.gradle.api.tasks.InputFile;
|
||||
import org.gradle.api.tasks.PathSensitive;
|
||||
import org.gradle.api.tasks.PathSensitivity;
|
||||
import org.gradle.api.tasks.TaskAction;
|
||||
import org.gradle.internal.impldep.org.apache.http.client.config.CookieSpecs;
|
||||
|
||||
@@ -52,14 +55,15 @@ public abstract class CheckLinks extends DefaultTask {
|
||||
|
||||
private final BomExtension bom;
|
||||
|
||||
private final Configuration resolvedBom;
|
||||
|
||||
@Inject
|
||||
public CheckLinks(BomExtension bom, Configuration resolvedBom) {
|
||||
public CheckLinks(BomExtension bom) {
|
||||
this.bom = bom;
|
||||
this.resolvedBom = resolvedBom;
|
||||
}
|
||||
|
||||
@InputFile
|
||||
@PathSensitive(PathSensitivity.RELATIVE)
|
||||
public abstract RegularFileProperty getResolvedBomFile();
|
||||
|
||||
@TaskAction
|
||||
void check() {
|
||||
RequestConfig config = RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build();
|
||||
@@ -73,7 +77,7 @@ public abstract class CheckLinks extends DefaultTask {
|
||||
}
|
||||
|
||||
private void check(RestClient restClient, Library library) {
|
||||
ResolvedBom resolvedBom = ResolvedBom.readFrom(this.resolvedBom.getSingleFile());
|
||||
ResolvedBom resolvedBom = ResolvedBom.readFrom(getResolvedBomFile().get().getAsFile());
|
||||
ResolvedLibrary resolvedLibrary = resolvedBom.library(library);
|
||||
DependencyVersion libraryVersion = library.getVersion();
|
||||
String libraryName = library.getName();
|
||||
|
||||
Reference in New Issue
Block a user