Further refine links in spring-boot-dependencies
Fix a few links and allow the root name to be generated from the library name. See gh-39779
This commit is contained in:
parent
9cdc8833c3
commit
f396c51550
@ -93,10 +93,14 @@ public class Library {
|
||||
this.prohibitedVersions = prohibitedVersions;
|
||||
this.considerSnapshots = considerSnapshots;
|
||||
this.versionAlignment = versionAlignment;
|
||||
this.linkRootName = linkRootName;
|
||||
this.linkRootName = (linkRootName != null) ? linkRootName : generateLinkRootName(name);
|
||||
this.links = Collections.unmodifiableMap(links);
|
||||
}
|
||||
|
||||
private static String generateLinkRootName(String name) {
|
||||
return name.replace("-", "").replace(" ", "-").toLowerCase();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.build.bom;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.build.bom.Library.Group;
|
||||
import org.springframework.boot.build.bom.Library.LibraryVersion;
|
||||
import org.springframework.boot.build.bom.Library.ProhibitedVersion;
|
||||
import org.springframework.boot.build.bom.Library.VersionAlignment;
|
||||
import org.springframework.boot.build.bom.bomr.version.DependencyVersion;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Tests for {@link Library}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
*/
|
||||
class LibraryTests {
|
||||
|
||||
@Test
|
||||
void getLinkRootNameWhenNoneSpecified() {
|
||||
String name = "Spring Framework";
|
||||
String calendarName = null;
|
||||
LibraryVersion version = new LibraryVersion(DependencyVersion.parse("1.2.3"));
|
||||
List<Group> groups = Collections.emptyList();
|
||||
List<ProhibitedVersion> prohibitedVersion = Collections.emptyList();
|
||||
boolean considerSnapshots = false;
|
||||
VersionAlignment versionAlignment = null;
|
||||
String linkRootName = null;
|
||||
Map<String, Function<LibraryVersion, String>> links = Collections.emptyMap();
|
||||
Library library = new Library(name, calendarName, version, groups, prohibitedVersion, considerSnapshots,
|
||||
versionAlignment, linkRootName, links);
|
||||
assertThat(library.getLinkRootName()).isEqualTo("spring-framework");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getLinkRootNameWhenSpecified() {
|
||||
String name = "Spring Data BOM";
|
||||
String calendarName = null;
|
||||
LibraryVersion version = new LibraryVersion(DependencyVersion.parse("1.2.3"));
|
||||
List<Group> groups = Collections.emptyList();
|
||||
List<ProhibitedVersion> prohibitedVersion = Collections.emptyList();
|
||||
boolean considerSnapshots = false;
|
||||
VersionAlignment versionAlignment = null;
|
||||
String linkRootName = "spring-data";
|
||||
Map<String, Function<LibraryVersion, String>> links = Collections.emptyMap();
|
||||
Library library = new Library(name, calendarName, version, groups, prohibitedVersion, considerSnapshots,
|
||||
versionAlignment, linkRootName, links);
|
||||
assertThat(library.getLinkRootName()).isEqualTo("spring-data");
|
||||
}
|
||||
|
||||
}
|
@ -14,5 +14,6 @@ mavenVersion=3.9.4
|
||||
nativeBuildToolsVersion=0.10.1
|
||||
springFrameworkVersion=6.1.5
|
||||
tomcatVersion=10.1.19
|
||||
snakeYamlVersion=2.2
|
||||
|
||||
kotlin.stdlib.default.dependency=false
|
||||
|
@ -898,7 +898,7 @@ bom {
|
||||
}
|
||||
links {
|
||||
site("https://www.jooq.org")
|
||||
docs("https://www.jooq.org/doc/{jooq-version}/manual-single-page")
|
||||
docs("https://www.jooq.org/doc/{version}/manual-single-page")
|
||||
releaseNotes("https://github.com/jOOQ/jOOQ/releases/tag/version-{version}")
|
||||
}
|
||||
}
|
||||
@ -1778,7 +1778,7 @@ bom {
|
||||
]
|
||||
}
|
||||
}
|
||||
library("SnakeYAML", "2.2") {
|
||||
library("SnakeYAML", "${snakeYamlVersion}") {
|
||||
group("org.yaml") {
|
||||
modules = [
|
||||
"snakeyaml"
|
||||
@ -2029,7 +2029,7 @@ bom {
|
||||
"spring-ws-bom"
|
||||
]
|
||||
}
|
||||
links {
|
||||
links("spring-webservices") {
|
||||
site("https://spring.io/projects/spring-ws")
|
||||
github("https://github.com/spring-projects/spring-ws")
|
||||
javadoc("https://docs.spring.io/spring-ws/docs/{version}/api")
|
||||
@ -2110,6 +2110,7 @@ bom {
|
||||
}
|
||||
links {
|
||||
site("https://tomcat.apache.org")
|
||||
docs { version -> "https://tomcat.apache.org/tomcat-%s.%s-doc".formatted(version.major(), version.minor()) }
|
||||
}
|
||||
}
|
||||
library("UnboundID LDAPSDK", "6.0.11") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user