HHH-17047 - Follow up tasks for Gradle 8.2 upgrade

- toolchains
- lazy Task creation
- documentation (documentation/ and release/) tasks
This commit is contained in:
Steve Ebersole 2023-08-14 07:49:23 -05:00
parent 63ea157390
commit a6b43a6a45
7 changed files with 87 additions and 9 deletions

View File

@ -216,7 +216,7 @@ def aggregateJavadocsTask = tasks.register( "aggregateJavadocs", Javadoc ) {
maxMemory = '512m' maxMemory = '512m'
configure( options ) { configure( options ) {
overview = 'src/javadoc/overview.html' overview = 'src/javadoc/overview.html'
stylesheetFile = new File( projectDir, 'src/javadoc/stylesheet.css' ) stylesheetFile = project.file( 'src/javadoc/stylesheet.css' )
windowTitle = 'Hibernate JavaDocs' windowTitle = 'Hibernate JavaDocs'
docTitle = "Hibernate JavaDoc ($project.version)" docTitle = "Hibernate JavaDoc ($project.version)"
bottom = "Copyright &copy; 2001-$currentYear <a href=\"https://redhat.com\">Red Hat, Inc.</a> All Rights Reserved." bottom = "Copyright &copy; 2001-$currentYear <a href=\"https://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."

View File

@ -6,6 +6,7 @@
*/ */
package org.hibernate; package org.hibernate;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@ -30,5 +31,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*/ */
@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, FIELD, CONSTRUCTOR}) @Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, FIELD, CONSTRUCTOR})
@Retention(RUNTIME) @Retention(RUNTIME)
@Documented
public @interface Incubating { public @interface Incubating {
} }

View File

@ -6,6 +6,7 @@
*/ */
package org.hibernate; package org.hibernate;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@ -29,6 +30,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*/ */
@Target({PACKAGE, TYPE, METHOD, FIELD, CONSTRUCTOR}) @Target({PACKAGE, TYPE, METHOD, FIELD, CONSTRUCTOR})
@Retention(RUNTIME) @Retention(RUNTIME)
@Documented
public @interface Internal { public @interface Internal {
} }

View File

@ -6,6 +6,7 @@
*/ */
package org.hibernate; package org.hibernate;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@ -33,5 +34,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*/ */
@Target({METHOD, FIELD, TYPE, PACKAGE, CONSTRUCTOR, TYPE_PARAMETER, TYPE_USE}) @Target({METHOD, FIELD, TYPE, PACKAGE, CONSTRUCTOR, TYPE_PARAMETER, TYPE_USE})
@Retention(RUNTIME) @Retention(RUNTIME)
@Documented
public @interface Remove { public @interface Remove {
} }

View File

@ -63,15 +63,13 @@ public class AsciiDocWriter {
writer.write( '\n' ); writer.write( '\n' );
for ( SettingDescriptor settingDescriptor : sectionSettingDescriptors ) { for ( SettingDescriptor settingDescriptor : sectionSettingDescriptors ) {
writer.write( ANCHOR_START ); writeSettingAnchor( settingDescriptor, writer );
writer.write( settingDescriptor.getName() );
writer.write( "]] " );
writer.write( '`' ); writeSettingName( settingDescriptor, writer );
writer.write( settingDescriptor.getName() );
writer.write( '`' );
writer.write( "::\n" ); writer.write( "::\n" );
writeLifecycleNotes( settingDescriptor, writer );
writer.write( settingDescriptor.getJavadoc() ); writer.write( settingDescriptor.getJavadoc() );
writer.write( "\n\n'''\n" ); writer.write( "\n\n'''\n" );
@ -81,6 +79,42 @@ public class AsciiDocWriter {
} }
} }
private static void writeLifecycleNotes(SettingDescriptor settingDescriptor, FileWriter writer) throws IOException {
// NOTE : at the moment, there is at least one setting that is both which fundamentally seems wrong
if ( settingDescriptor.isIncubating() ) {
writer.write( "NOTE:: _This setting is considered incubating_\n\n" );
}
if ( settingDescriptor.isDeprecated() ) {
writer.write( "WARN:: _This setting is considered deprecated_\n\n" );
}
}
private static void writeSettingName(SettingDescriptor settingDescriptor, FileWriter writer) throws IOException {
writer.write( "`" );
if ( settingDescriptor.isDeprecated() ) {
writer.write( "[.line-through]#" );
}
else {
writer.write( '*' );
}
writer.write( settingDescriptor.getName() );
if ( settingDescriptor.isDeprecated() ) {
writer.write( '#' );
}
else {
writer.write( '*' );
}
writer.write( '`' );
}
private static void writeSettingAnchor(SettingDescriptor settingDescriptor, Writer writer) throws IOException {
writer.write( ANCHOR_START );
writer.write( settingDescriptor.getName() );
writer.write( "]] " );
}
private static void tryToWriteLine(Writer writer, String prefix, String value, String... other) { private static void tryToWriteLine(Writer writer, String prefix, String value, String... other) {
try { try {
writer.write( prefix ); writer.write( prefix );

View File

@ -20,16 +20,22 @@ public class SettingDescriptor {
private final String settingsClassName; private final String settingsClassName;
private final String settingFieldName; private final String settingFieldName;
private final String javadoc; private final String javadoc;
private final boolean deprecated;
private final boolean incubating;
public SettingDescriptor( public SettingDescriptor(
String name, String name,
String settingsClassName, String settingsClassName,
String settingFieldName, String settingFieldName,
String javadoc) { String javadoc,
boolean deprecated,
boolean incubating) {
this.name = name; this.name = name;
this.settingsClassName = settingsClassName; this.settingsClassName = settingsClassName;
this.settingFieldName = settingFieldName; this.settingFieldName = settingFieldName;
this.javadoc = javadoc; this.javadoc = javadoc;
this.deprecated = deprecated;
this.incubating = incubating;
} }
/** /**
@ -53,4 +59,12 @@ public class SettingDescriptor {
public String getSettingFieldName() { public String getSettingFieldName() {
return settingFieldName; return settingFieldName;
} }
public boolean isDeprecated() {
return deprecated;
}
public boolean isIncubating() {
return incubating;
}
} }

View File

@ -96,7 +96,9 @@ public class SettingsCollector {
className, className,
simpleFieldName, simpleFieldName,
publishedJavadocsUrl publishedJavadocsUrl
) ),
interpretDeprecation( fieldJavadocElement ),
interpretIncubation( fieldJavadocElement )
); );
docSectionSettings.add( settingDescriptor ); docSectionSettings.add( settingDescriptor );
} }
@ -179,6 +181,28 @@ public class SettingsCollector {
return value; return value;
} }
private static boolean interpretDeprecation(Element fieldJavadocElement) {
// A setting is considered deprecated with either `@Deprecated`
final Element deprecationDiv = fieldJavadocElement.selectFirst( ".deprecation-block" );
// presence of this <div/> indicates the member is deprecated
if ( deprecationDiv != null ) {
return true;
}
// or `@Remove`
final Element removeMarkerElement = fieldJavadocElement.selectFirst( "[href*=Remove.html]" );
if ( removeMarkerElement != null ) {
return true;
}
return false;
}
private static boolean interpretIncubation(Element fieldJavadocElement) {
final Element incubatingMarkerElement = fieldJavadocElement.selectFirst( "[href*=Incubating.html]" );
return incubatingMarkerElement != null;
}
/** /**
* Convert the DOM representation of the field Javadoc to Asciidoc format * Convert the DOM representation of the field Javadoc to Asciidoc format
* *