HHH-17047 - Follow up tasks for Gradle 8.2 upgrade

- tweak how see additional links section is rendered
- update external javadoc links
This commit is contained in:
marko-bekhta 2023-08-11 10:28:56 +02:00 committed by Steve Ebersole
parent 9e2108e7d7
commit ffa2ee1443
4 changed files with 16 additions and 51 deletions

View File

@ -225,9 +225,10 @@ def aggregateJavadocsTask = tasks.register( "aggregateJavadocs", Javadoc ) {
links = [
'https://docs.oracle.com/en/java/javase/11/docs/api/',
'https://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/',
'https://docs.jboss.org/cdi/api/2.0/',
'https://jakarta.ee/specifications/platform/8/apidocs/'
'https://jakarta.ee/specifications/bean-validation/3.0/apidocs/',
'https://jakarta.ee/specifications/cdi/4.0/apidocs/',
'https://jakarta.ee/specifications/platform/9/apidocs/',
'https://www.javadoc.io/doc/javax.cache/cache-api/1.0.0/'
]
options.addStringOption( 'Xdoclint:none', '-quiet' )

View File

@ -74,18 +74,7 @@ public class AsciiDocWriter {
writer.write( settingDescriptor.getJavadoc() );
writer.write( '\n' );
writer.write(
String.format(
"**See:** %s[%s.%s]\n\n",
settingDescriptor.getJavadocLink(),
Utils.withoutPackagePrefix( settingDescriptor.getSettingsClassName() ),
settingDescriptor.getSettingFieldName()
)
);
writer.write( "'''\n" );
writer.write( "\n\n'''\n" );
}
writer.write( '\n' );

View File

@ -20,19 +20,16 @@ public class SettingDescriptor {
private final String settingsClassName;
private final String settingFieldName;
private final String javadoc;
private final String javadocLink;
public SettingDescriptor(
String name,
String settingsClassName,
String settingFieldName,
String javadoc,
String javadocLink) {
String javadoc) {
this.name = name;
this.settingsClassName = settingsClassName;
this.settingFieldName = settingFieldName;
this.javadoc = javadoc;
this.javadocLink = javadocLink;
}
/**
@ -56,8 +53,4 @@ public class SettingDescriptor {
public String getSettingFieldName() {
return settingFieldName;
}
public String getJavadocLink() {
return javadocLink;
}
}

View File

@ -10,7 +10,6 @@ import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
@ -97,8 +96,7 @@ public class SettingsCollector {
className,
simpleFieldName,
publishedJavadocsUrl
),
Utils.fieldJavadocLink( publishedJavadocsUrl, className, simpleFieldName )
)
);
docSectionSettings.add( settingDescriptor );
}
@ -194,13 +192,14 @@ public class SettingsCollector {
String className,
String simpleFieldName,
String publishedJavadocsUrl) {
Elements javadocsToConvert = cleanupFieldJavadocElement( fieldJavadocElement, className, publishedJavadocsUrl );
Elements javadocsToConvert = cleanupFieldJavadocElement( fieldJavadocElement, className, simpleFieldName, publishedJavadocsUrl );
return new DomToAsciidocConverter( javadocsToConvert ).convert();
}
private static Elements cleanupFieldJavadocElement(Element fieldJavadocElement,
String className,
String simpleFieldName,
String publishedJavadocsUrl) {
// Before proceeding let's make sure that the javadoc structure is the one that we expect:
if ( !isValidFieldJavadocStructure( fieldJavadocElement ) ) {
@ -216,13 +215,13 @@ public class SettingsCollector {
if ( actualJavadocs != null ) {
usefulDocsPart.add( actualJavadocs );
}
cleanupSeeLinks( fieldJavadocElement.selectFirst( "ul.see-list" ) )
.ifPresent( ul -> {
// add a see also
usefulDocsPart.add( new Element( "div" ).appendChild( new Element( "b" ).text( "See also:" ) ) );
// add the list of links:
usefulDocsPart.add( ul );
} );
usefulDocsPart.add( new Element( "div" )
.appendChild( new Element( "b" ).text( "See: " ) )
.appendChild( new Element( "a" )
.attr(
"href",
Utils.fieldJavadocLink( publishedJavadocsUrl, className, simpleFieldName )
).text( Utils.withoutPackagePrefix( className ) + "." + simpleFieldName ) ) );
return usefulDocsPart;
}
@ -258,23 +257,6 @@ public class SettingsCollector {
|| href != null && href.startsWith( "http" );
}
private static Optional<Element> cleanupSeeLinks(Element seeList) {
if ( seeList == null ) {
return Optional.empty();
}
Element ul = new Element( "ul" );
for ( Element li : seeList.select( "li" ) ) {
Element link = li.selectFirst( "a" );
if ( link != null && "Constant Field Values".equals( link.text() ) ) {
// means it's a link to "self", pointing to the same constant and its javadocs
// so we just ignore it:
continue;
}
ul.appendChild( li );
}
return ul.children().isEmpty() ? Optional.empty() : Optional.of( ul );
}
private static boolean isValidFieldJavadocStructure(Element fieldJavadocElement) {
// Field's DOM sub-structure that we are expecting should be:
// <section class="detail" id="FIELD_NAME">