From d8d1113293b9c32b9b1032b1731fa20759dc4915 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Tue, 8 Aug 2023 18:11:13 -0500 Subject: [PATCH] HHH-17047 - Follow up tasks for Gradle 8.2 upgrade - toolchains - lazy Task creation - documentation (documentation/ and release/) tasks --- documentation/documentation.gradle | 405 +++++++++--------- .../org/hibernate/orm/antlr/AntlrPlugin.java | 14 +- .../org/hibernate/orm/antlr/AntlrSpec.java | 3 +- .../orm/antlr/GrammarDescriptorFactory.java | 7 +- .../orm/antlr/SplitGrammarGenerationTask.java | 2 +- .../hibernate/orm/docs/DescriptorAccess.java | 12 +- .../orm/docs/DocumentationPublishing.java | 4 +- .../docs/DocumentationPublishingPlugin.java | 76 ++-- .../orm/docs/GenerateDescriptorTask.java | 42 +- ...va => ProjectDocumentationDescriptor.java} | 9 +- .../orm/docs/PublishDescriptorTask.java | 32 +- .../orm/docs/PublishMigrationGuide.java | 31 +- .../org/hibernate/orm/docs/PublishTask.java | 33 +- .../orm/docs/ReleaseFamilyDocumentation.java | 7 +- .../orm/post/AbstractJandexAwareTask.java | 27 +- .../orm/post/DeprecationReportTask.java | 25 +- .../hibernate/orm/post/DialectReportTask.java | 22 +- .../orm/post/IncubationReportTask.java | 21 +- .../org/hibernate/orm/post/IndexerTask.java | 18 +- .../orm/post/InternalsReportTask.java | 22 +- .../hibernate/orm/post/LoggingReportTask.java | 21 +- .../orm/post/ReportGenerationPlugin.java | 53 ++- release/release.gradle | 249 ++++++----- settings.gradle | 298 +++++++------ 24 files changed, 769 insertions(+), 664 deletions(-) rename local-build-plugins/src/main/java/org/hibernate/orm/docs/{ProjectDocumentation.java => ProjectDocumentationDescriptor.java} (91%) diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index bb1040e48a..4bc96a4ed9 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -25,9 +25,10 @@ apply from: rootProject.file( 'gradle/releasable.gradle' ) apply plugin: 'org.hibernate.orm.build.reports' -tasks.build.dependsOn 'buildDocs' + defaultTasks 'buildDocs' + dependencies { ext.pressgangVersion = '3.0.0' @@ -59,21 +60,6 @@ else { tasks.release.dependsOn clean } -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// grouping tasks - declaration, see below for task dependency definitions -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -tasks.register('buildDocs') { - group 'Documentation' - description 'Grouping task for performing all documentation building tasks' -} - -tasks.register('buildDocsForPublishing') { - group 'Documentation' - description 'Grouping task for building all documentation for publishing (release)' -} - - asciidoctorj { requires 'rouge' modules { @@ -90,79 +76,81 @@ asciidoctorj { options logDocuments: true } + // Topical Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.register('renderTopicalGuides', AsciidoctorTask) { task -> +def renderTopicalGuideHtmlTask = tasks.register( 'renderTopicalGuideHtml', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Topical Guides in HTML format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task inputs.property "hibernate-version", project.ormVersion - sourceDir = file('src/main/asciidoc/topical') - outputDir = new File("$buildDir/asciidoc/topical/html_single") + sourceDir = file( 'src/main/asciidoc/topical' ) + outputDir = new File( "$buildDir/asciidoc/topical/html_single" ) resources { - from('src/main/asciidoc/topical/') { + from( 'src/main/asciidoc/topical/' ) { include '**/images/**' } } } +def renderTopicalGuidesTask = tasks.register( 'renderTopicalGuides', AsciidoctorTask ) { task -> + task.group = "Documentation" + task.description = 'Renders the Topical Guides in all formats.' + task.dependsOn renderTopicalGuideHtmlTask +} + // Getting Started Guides (quick starts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.register('renderGettingStartedGuides', AsciidoctorTask) { task -> +def gettingStartedGuideHtmlDir = layout.buildDirectory.dir( "asciidoc/quickstart/html_single" ) + +def renderGettingStartedGuideHtmlTask = tasks.register( 'renderGettingStartedGuideHtmlTask', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Getting Started Guides (quickstarts) in HTML format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task inputs.property "hibernate-version", project.ormVersion - sourceDir = file('src/main/asciidoc/quickstart/guides') - sources { - include 'index.adoc' - } - outputDir = new File("$buildDir/asciidoc/quickstart/html_single") + sourceDir = file( 'src/main/asciidoc/quickstart/guides' ) + sources 'index.adoc' + + outputDir = gettingStartedGuideHtmlDir attributes linkcss: true, - stylesheet: "css/hibernate.css", - docinfo: 'private', - jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" + stylesheet: "css/hibernate.css", + docinfo: 'private', + jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" resources { - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'js/**' } } } -tasks.register('renderGettingStartedGuidesPdf', AsciidoctorPdfTask) {task-> +def renderGettingStartedGuidePdfTask = tasks.register( 'renderGettingStartedGuidePdf', AsciidoctorPdfTask ) { task -> group = "Documentation" description = 'Renders the Getting Started Guides in PDF format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task inputs.property "hibernate-version", project.ormVersion - sourceDir = file( 'src/main/asciidoc/quickstart/guides' ) baseDir = file( 'src/main/asciidoc/quickstart/guides' ) - sources { - include 'index.adoc' - } - outputDir = "$buildDir/asciidoc/quickstart/pdf" + + sourceDir = file( 'src/main/asciidoc/quickstart/guides' ) + sources 'index.adoc' + + outputDir = layout.buildDirectory.dir( "asciidoc/quickstart/pdf" ) attributes jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" } -tasks.register('buildTutorialZip', Zip) { task -> +def buildTutorialZipTask = tasks.register( 'buildTutorialZip', Zip ) { task -> from 'src/main/asciidoc/quickstart/tutorials' - destinationDirectory = tasks.renderGettingStartedGuides.outputDir + destinationDirectory.set( gettingStartedGuideHtmlDir ) archiveFileName = 'hibernate-tutorials.zip' expand( version: project.version, @@ -170,70 +158,111 @@ tasks.register('buildTutorialZip', Zip) { task -> junit: testLibs.versions.junit4.get(), h2: dbLibs.versions.h2.get() ) - tasks.renderGettingStartedGuides.dependsOn task +} + +def renderGettingStartedGuidesTask = tasks.register( 'renderGettingStartedGuides' ) { task -> + task.group = "Documentation" + task.description = 'Renders the Getting Started Guide in all formats, as well as the acccompanying tutorial zip.' + task.dependsOn renderGettingStartedGuideHtmlTask, renderGettingStartedGuidePdfTask, buildTutorialZipTask } // Introduction ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.register('renderIntroductionPdf', AsciidoctorPdfTask) {task-> - group = "Documentation" - description = 'Renders the Introduction in PDF format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task - inputs.property "hibernate-version", project.ormVersion - - sourceDir = file( 'src/main/asciidoc/introduction' ) - baseDir = file( 'src/main/asciidoc/introduction' ) - sources { - include 'Hibernate_Introduction.adoc' - } - outputDir = "$buildDir/asciidoc/introduction/pdf" - - attributes jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" -} - -tasks.register('renderIntroduction', AsciidoctorTask) {task-> +def renderIntroductionHtmlTask = tasks.register( 'renderIntroductionHtml', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Introduction in HTML format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task inputs.property "hibernate-version", project.ormVersion sourceDir = file( 'src/main/asciidoc/introduction' ) - sources { - include 'Hibernate_Introduction.adoc' - } + sources 'Hibernate_Introduction.adoc' + outputDir = "$buildDir/asciidoc/introduction/html_single" attributes linkcss: true, - stylesheet: "css/hibernate.css", - docinfo: 'private', - jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" + stylesheet: "css/hibernate.css", + docinfo: 'private', + jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" resources { - from('src/main/asciidoc/introduction/') { + from( 'src/main/asciidoc/introduction/' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'js/**' } } } +def renderIntroductionPdfTask = tasks.register( 'renderIntroductionPdf', AsciidoctorPdfTask ) { task -> + group = "Documentation" + description = 'Renders the Introduction in PDF format using Asciidoctor.' + inputs.property "hibernate-version", project.ormVersion + + baseDir = file( 'src/main/asciidoc/introduction' ) + + sourceDir = file( 'src/main/asciidoc/introduction' ) + sources 'Hibernate_Introduction.adoc' + + outputDir = "$buildDir/asciidoc/introduction/pdf" + + attributes jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" +} + +//noinspection GroovyUnusedAssignment +def renderIntroductionGuidesTask = tasks.register( "renderIntroductionGuides" ) { task -> + group = "Documentation" + description = 'Renders the Introduction Guide in all formats.' + task.dependsOn renderIntroductionHtmlTask, renderIntroductionPdfTask + + tasks.buildDocs.dependsOn task +} + + // HQL Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.register('renderQLPdf', AsciidoctorPdfTask) {task-> +def renderQueryLanguageGuideHtmlTask = tasks.register( 'renderQueryLanguageGuideHtml', AsciidoctorTask ) { task -> + task.group = "Documentation" + task.description = 'Renders the Query Language document in HTML format using Asciidoctor.' + + task.inputs.property "hibernate-version", project.ormVersion + + task.sourceDir = file( 'src/main/asciidoc/querylanguage' ) + task.sources 'Hibernate_Query_Language.adoc' + + task.outputDir = layout.buildDirectory.dir( "asciidoc/querylanguage/html_single" ) + + task.attributes linkcss: true, + stylesheet: "css/hibernate.css", + docinfo: 'private', + jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" + + task.resources { + from( 'src/main/asciidoc/querylanguage/' ) { + include 'images/**' + } + from( 'src/main/style/asciidoctor' ) { + include 'images/**' + } + from( 'src/main/style/asciidoctor' ) { + include 'css/**' + } + from( 'src/main/style/asciidoctor' ) { + include 'js/**' + } + } +} + +def renderQueryLanguageGuidePdfTask = tasks.register( 'renderQueryLanguageGuidePdf', AsciidoctorPdfTask ) { task -> group = "Documentation" description = 'Renders the Query Language document in PDF format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task + inputs.property "hibernate-version", project.ormVersion sourceDir = file( 'src/main/asciidoc/querylanguage' ) @@ -241,92 +270,72 @@ tasks.register('renderQLPdf', AsciidoctorPdfTask) {task-> sources { include 'Hibernate_Query_Language.adoc' } - outputDir = "$buildDir/asciidoc/querylanguage/pdf" + outputDir = layout.buildDirectory.dir( "asciidoc/querylanguage/pdf" ) attributes jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" } -tasks.register('renderQL', AsciidoctorTask) {task-> +//noinspection GroovyUnusedAssignment +def renderQueryLanguageGuidesTask = tasks.register( 'renderQueryLanguageGuides' ) { task -> group = "Documentation" - description = 'Renders the Query Language document in HTML format using Asciidoctor.' + description = 'Renders Query Language Guide in all formats.' + task.dependsOn renderQueryLanguageGuideHtmlTask + task.dependsOn renderQueryLanguageGuidePdfTask + tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task - inputs.property "hibernate-version", project.ormVersion - - sourceDir = file( 'src/main/asciidoc/querylanguage' ) - sources { - include 'Hibernate_Query_Language.adoc' - } - outputDir = "$buildDir/asciidoc/querylanguage/html_single" - - attributes linkcss: true, - stylesheet: "css/hibernate.css", - docinfo: 'private', - jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" - - resources { - from('src/main/asciidoc/querylanguage/') { - include 'images/**' - } - from('src/main/style/asciidoctor') { - include 'images/**' - } - from('src/main/style/asciidoctor') { - include 'css/**' - } - from('src/main/style/asciidoctor') { - include 'js/**' - } - } } + // User Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.register('renderUserGuide', AsciidoctorTask) { task -> +def renderUserGuideHtmlTask = tasks.register( 'renderUserGuideHtml', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the User Guides in HTML format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task inputs.property "hibernate-version", project.ormVersion dependsOn ':hibernate-core:collectConfigProperties' dependsOn ':hibernate-envers:collectConfigProperties' dependsOn ':hibernate-jcache:collectConfigProperties' - sourceDir = file( 'src/main/asciidoc/userguide' ) - sources { - include 'Hibernate_User_Guide.adoc' - } - outputDir = "$buildDir/asciidoc/userguide/html_single" + sourceDir = file( 'src/main/asciidoc/userguide' ) + sources { + include 'Hibernate_User_Guide.adoc' + } + outputDir = "$buildDir/asciidoc/userguide/html_single" attributes linkcss: true, - stylesheet: "css/hibernate.css", - docinfo: 'private', - jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" + stylesheet: "css/hibernate.css", + docinfo: 'private', + jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/" resources { - from('src/main/asciidoc/userguide/') { + from( 'src/main/asciidoc/userguide/' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'js/**' } } } +def renderUserGuidesTask = tasks.register( 'renderUserGuides' ) { task -> + task.group = "Documentation" + task.description = 'Renders the User Guides in all formats.' + task.dependsOn( renderUserGuideHtmlTask ) +} + + // Integration Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.register( "renderIntegrationGuide", AsciidoctorTask.class, task-> { +def renderIntegrationGuideHtmlTask = tasks.register( "renderIntegrationGuideHtml", AsciidoctorTask ) { task-> group = "Documentation" description = 'Renders the User Guides in HTML format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task inputs.property "hibernate-version", project.ormVersion sourceDir = file( 'src/main/asciidoc/integrationguide' ) @@ -337,128 +346,142 @@ tasks.register( "renderIntegrationGuide", AsciidoctorTask.class, task-> { outputDir = project.layout.buildDirectory.dir( 'asciidoc/integrationguide/html_single' ) attributes linkcss: true, - stylesheet: "css/hibernate.css" + stylesheet: "css/hibernate.css" resources { - from('src/main/asciidoc/integrationguide/') { + from( 'src/main/asciidoc/integrationguide/' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } } -} ) +} + +def renderIntegrationGuidesTask = tasks.register( "renderIntegrationGuides" ) { task -> + group = "Documentation" + description = 'Renders all formats of the User Guide.' + task.dependsOn renderIntegrationGuideHtmlTask + + tasks.buildDocs.dependsOn task +} // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Migration Guide -tasks.register( "renderMigrationGuide", AsciidoctorTask.class, task-> { +def renderMigrationGuideTask = tasks.register( "renderMigrationGuide", AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Migration Guide in HTML format using Asciidoctor.' - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task - dependsOn tasks.renderIntegrationGuide - dependsOn tasks.renderIntroduction - dependsOn tasks.renderGettingStartedGuides + inputs.property "hibernate-version", project.ormVersion sources { - include rootProject.layout.projectDirectory.file( 'migration-guide.adoc').asFile.canonicalPath + include rootProject.layout.projectDirectory.file( 'migration-guide.adoc' ).asFile.canonicalPath } attributes linkcss: true, - stylesheet: "css/hibernate.css" + stylesheet: "css/hibernate.css" resources { - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } } -} ) +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ORM Reports -tasks.register('renderOrmReports') { task -> - group 'Documentation' - description 'Grouping task for rendering all ORM reports' +def renderLoggingReportTask = tasks.register( 'renderLoggingReport', AsciidoctorTask ) { task -> + task.group = "hibernate-reports" + task.description = 'Renders the logging report (generated LoggingReportTask) by in HTML format using Asciidoctor.' + task.dependsOn "generateLoggingReport" - dependsOn tasks.generateIncubationReport - dependsOn tasks.generateInternalsReport - dependsOn tasks.generateDeprecationReport + task.inputs.property "version", project.ormVersion - tasks.buildDocs.dependsOn task - tasks.buildDocsForPublishing.dependsOn task -} + task.sourceDir = layout.buildDirectory.dir( 'orm/generated/logging' ) + task.sources 'logging.adoc' -tasks.register('renderLoggingReport', AsciidoctorTask) { task -> - group 'Documentation' - description = 'Renders the ORM logging report in HTML format using Asciidoctor.' - dependsOn tasks.generateLoggingReport - dependsOn tasks.generateDialectReport - tasks.renderOrmReports.dependsOn task - inputs.property "version", project.ormVersion + task.outputDir = project.layout.buildDirectory.dir( 'asciidoc/logging' ) - sourceDir = layout.buildDirectory.dir('orm/reports') - sources { - include 'logging.adoc' - } + task.attributes linkcss: true, + stylesheet: "css/hibernate.css" - outputDir = project.layout.buildDirectory.dir('asciidoc/logging') - - attributes linkcss: true, - stylesheet: "css/hibernate.css" - - resources { - from('src/main/style/asciidoctor') { + task.resources { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } } } -tasks.register('renderDialectReport', AsciidoctorTask) { task -> - group 'Documentation' - description = 'Renders the ORM Dialect report in HTML format using Asciidoctor.' - dependsOn tasks.generateDialectReport - dependsOn tasks.generateLoggingReport +def renderDialectReportTask = tasks.register( 'renderDialectReport', AsciidoctorTask ) { task -> + task.group = "hibernate-reports" + task.description = 'Renders the supported Dialect report in HTML format using Asciidoctor.' + task.dependsOn "generateDialectReport" - tasks.renderOrmReports.dependsOn task - inputs.property "version", project.ormVersion + task.inputs.property "version", project.ormVersion - sourceDir = layout.buildDirectory.dir('orm/reports') - sources { - include 'dialect.adoc' - } + task.sourceDir = layout.buildDirectory.dir( 'orm/generated/dialect' ) + task.sources 'dialect.adoc' - outputDir = project.layout.buildDirectory.dir('asciidoc/dialect') + task.outputDir = project.layout.buildDirectory.dir( 'asciidoc/dialect' ) - attributes linkcss: true, - stylesheet: "css/hibernate.css" + task.attributes linkcss: true, + stylesheet: "css/hibernate.css" - resources { - from('src/main/style/asciidoctor') { + task.resources { + from( 'src/main/style/asciidoctor' ) { include 'images/**' } - from('src/main/style/asciidoctor') { + from( 'src/main/style/asciidoctor' ) { include 'css/**' } } } +def generateReportsTask = tasks.named( "generateReports" ) { + dependsOn renderLoggingReportTask, renderDialectReportTask +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Overall grouping tasks +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +def buildDocsTask = tasks.register( 'buildDocs' ) { task -> + task.group = 'Documentation' + task.description = 'Grouping task for performing all documentation building tasks' + task.dependsOn renderGettingStartedGuidesTask + task.dependsOn renderIntroductionGuidesTask + task.dependsOn renderUserGuidesTask + task.dependsOn renderQueryLanguageGuidesTask + task.dependsOn renderIntegrationGuidesTask + task.dependsOn renderTopicalGuidesTask + task.dependsOn generateReportsTask + task.dependsOn renderMigrationGuideTask +} + +//noinspection GroovyUnusedAssignment +def buildDocsForPublishingTask = tasks.register( 'buildDocsForPublishing' ) { task -> + task.group = 'Documentation' + task.description = 'Grouping task for building all documentation for publishing (release)' + task.dependsOn buildDocsTask +} // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -tasks.withType(AsciidoctorTask).all { +tasks.withType(AsciidoctorTask).configureEach { baseDirFollowsSourceDir() outputOptions { separateOutputDirs = false diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrPlugin.java b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrPlugin.java index 62026d5364..4776e017a0 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrPlugin.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrPlugin.java @@ -12,6 +12,7 @@ import org.gradle.api.Task; import org.gradle.api.artifacts.Configuration; import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.tasks.SourceSet; +import org.gradle.api.tasks.TaskProvider; /** * Custom Antlr v4 Plugin @@ -33,9 +34,10 @@ public class AntlrPlugin implements Plugin { @Override public void apply(Project project) { - final Task groupingTask = project.getTasks().create( "generateParsers" ); - groupingTask.setDescription( "Performs all defined Antlr grammar generations" ); - groupingTask.setGroup( ANTLR ); + final TaskProvider groupingTask = project.getTasks().register( "generateParsers", (task) -> { + task.setDescription( "Performs all defined Antlr grammar generations" ); + task.setGroup( ANTLR ); + } ); final AntlrSpec antlrSpec = project.getExtensions().create( AntlrSpec.REGISTRATION_NAME, @@ -53,8 +55,10 @@ public class AntlrPlugin implements Plugin { mainSourceSet.setCompileClasspath( mainSourceSet.getCompileClasspath().plus( antlrDependencies ) ); mainSourceSet.getJava().srcDir( antlrSpec.getOutputBaseDirectory() ); - final Task compileTask = project.getTasks().getByName( mainSourceSet.getCompileJavaTaskName() ); - compileTask.dependsOn( groupingTask ); + + project.getTasks().named( mainSourceSet.getCompileJavaTaskName(), (compileTask) -> { + compileTask.dependsOn( groupingTask ); + } ); populateGrammars( antlrSpec ); } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrSpec.java b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrSpec.java index 1e34091af8..997d197a4f 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrSpec.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/AntlrSpec.java @@ -14,6 +14,7 @@ import org.gradle.api.Task; import org.gradle.api.file.DirectoryProperty; import org.gradle.api.file.ProjectLayout; import org.gradle.api.model.ObjectFactory; +import org.gradle.api.tasks.TaskProvider; /** * @author Steve Ebersole @@ -28,7 +29,7 @@ public class AntlrSpec { @Inject @SuppressWarnings("UnstableApiUsage") - public AntlrSpec(Project project, Task groupingTask) { + public AntlrSpec(Project project, TaskProvider groupingTask) { final ObjectFactory objectFactory = project.getObjects(); final ProjectLayout layout = project.getLayout(); diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/GrammarDescriptorFactory.java b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/GrammarDescriptorFactory.java index 2598d6a9df..470cf238fd 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/GrammarDescriptorFactory.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/GrammarDescriptorFactory.java @@ -9,16 +9,17 @@ package org.hibernate.orm.antlr; import org.gradle.api.NamedDomainObjectFactory; import org.gradle.api.Project; import org.gradle.api.Task; +import org.gradle.api.tasks.TaskProvider; /** * @author Steve Ebersole */ public class GrammarDescriptorFactory implements NamedDomainObjectFactory { private final AntlrSpec antlrSpec; - private final Task groupingTask; + private final TaskProvider groupingTask; private final Project project; - public GrammarDescriptorFactory(AntlrSpec antlrSpec, Task groupingTask, Project project) { + public GrammarDescriptorFactory(AntlrSpec antlrSpec, TaskProvider groupingTask, Project project) { this.antlrSpec = antlrSpec; this.groupingTask = groupingTask; this.project = project; @@ -36,7 +37,7 @@ public class GrammarDescriptorFactory implements NamedDomainObjectFactory task.dependsOn( generatorTask ) ); return descriptor; } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/SplitGrammarGenerationTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/SplitGrammarGenerationTask.java index 5eaace347a..611e507a28 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/antlr/SplitGrammarGenerationTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/antlr/SplitGrammarGenerationTask.java @@ -123,7 +123,7 @@ public abstract class SplitGrammarGenerationTask extends DefaultTask { getProject().javaexec( (javaExecSpec) -> { javaExecSpec.setMain( "org.antlr.v4.Tool" ); - javaExecSpec.classpath( getProject().getConfigurations().getByName( "antlr" ) ); + javaExecSpec.classpath( getProject().getConfigurations().named( "antlr" ) ); javaExecSpec.args( "-o", getProject().relativePath( outputDir.getAbsolutePath() ), "-long-messages", diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/DescriptorAccess.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/DescriptorAccess.java index f60fbe0409..596800e765 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/DescriptorAccess.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/DescriptorAccess.java @@ -20,7 +20,7 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; /** - * Basically a DAO for the doc pub descriptor + * Models the published doc descriptor file * * @author Steve Ebersole */ @@ -29,17 +29,16 @@ public class DescriptorAccess { /** * Load the descriptor - * @return */ - public static ProjectDocumentation loadProject() { + public static ProjectDocumentationDescriptor loadProject() { try ( final CloseableHttpClient httpClient = HttpClientBuilder.create().build() ) { final HttpGet request = new HttpGet( DETAILS_URL ); try ( final CloseableHttpResponse response = httpClient.execute( request ) ) { final HttpEntity responseEntity = response.getEntity(); + //noinspection resource final Jsonb jsonb = JsonbBuilder.create( new JsonbConfig().withFormatting( true ) ); - return jsonb.fromJson( responseEntity.getContent(), ProjectDocumentation.class ); - + return jsonb.fromJson( responseEntity.getContent(), ProjectDocumentationDescriptor.class ); } } catch (IOException e) { @@ -47,9 +46,10 @@ public class DescriptorAccess { } } - public static void storeProject(ProjectDocumentation project, File jsonFile) { + public static void storeProject(ProjectDocumentationDescriptor project, File jsonFile) { prepareJsonFile( jsonFile ); + //noinspection resource final Jsonb jsonb = JsonbBuilder.create( new JsonbConfig().withFormatting( true ) ); try ( final FileWriter writer = new FileWriter( jsonFile ) ) { diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishing.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishing.java index 018b2640f3..d9edd77224 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishing.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishing.java @@ -23,6 +23,8 @@ import org.hibernate.orm.ReleaseFamilyIdentifier; * @author Steve Ebersole */ public class DocumentationPublishing { + public static final String DSL_NAME = "documentationPublishing"; + private final Project project; private final DirectoryProperty stagingDirectory; @@ -53,8 +55,6 @@ public class DocumentationPublishing { .fileProperty() .convention( project.getLayout().getBuildDirectory().file( "doc-pub/orm.json" ) ); - // todo : pull HibernateOrmVersion out of `gradle/basic-information.gradle` and use here - // for now, just parse the project version releaseFamilyIdentifier = ReleaseFamilyIdentifier.parse( project.getVersion().toString() ); } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishingPlugin.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishingPlugin.java index 865e3f33d1..662323816f 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishingPlugin.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/DocumentationPublishingPlugin.java @@ -8,58 +8,74 @@ package org.hibernate.orm.docs; import org.gradle.api.Plugin; import org.gradle.api.Project; +import org.gradle.api.tasks.TaskProvider; + +import static org.hibernate.orm.docs.DocumentationPublishing.DSL_NAME; +import static org.hibernate.orm.docs.GenerateDescriptorTask.GEN_DESC_TASK_NAME; +import static org.hibernate.orm.docs.PublishDescriptorTask.UPLOAD_DESC_TASK_NAME; +import static org.hibernate.orm.docs.PublishTask.UPLOAD_TASK_NAME; /** * Plugin for helping with publishing documentation to the doc server -
    - *
  • Publishes a config extension ({@link DocumentationPublishing}) under {@value #EXT}
  • - *
  • Creates a task ({@value #UPLOAD_TASK}) to upload the documentation to the doc server
  • - *
  • Creates a task ({@value #GEN_DESC_TASK}) to create the "published doc descriptor" (JSON) file
  • - *
  • Creates a task ({@value #UPLOAD_DESC_TASK}) to upload the "published doc descriptor" (JSON) file to the doc server
  • + *
  • Publishes a config extension ({@link DocumentationPublishing}) under {@value DocumentationPublishing#DSL_NAME}
  • + *
  • Creates a task ({@value PublishTask#UPLOAD_TASK_NAME}) to upload the documentation to the doc server
  • + *
  • Creates a task ({@value GenerateDescriptorTask#GEN_DESC_TASK_NAME}) to create the "published doc descriptor" (JSON) file
  • + *
  • Creates a task ({@value PublishDescriptorTask#UPLOAD_DESC_TASK_NAME}) to upload the "published doc descriptor" (JSON) file to the doc server
  • *
* * @author Steve Ebersole */ public class DocumentationPublishingPlugin implements Plugin { - public static final String EXT = "documentationPublishing"; - public static final String UPLOAD_TASK = "uploadDocumentation"; - public static final String GEN_DESC_TASK = "generatorDocumentationDescriptor"; - public static final String UPLOAD_DESC_TASK = "uploadDocumentationDescriptor"; - @Override public void apply(Project project) { - final DocumentationPublishing docPubDsl = project.getExtensions().create( EXT, DocumentationPublishing.class ); + final DocumentationPublishing docPubDsl = project.getExtensions().create( DSL_NAME, DocumentationPublishing.class ); - final PublishTask uploadTask = project.getTasks().create( - UPLOAD_TASK, - PublishTask.class, - docPubDsl - ); + final boolean isSnapshot = project.getVersion().toString().endsWith( "-SNAPSHOT" ); - final GenerateDescriptorTask generateDescriptorTask = project.getTasks().create( - GEN_DESC_TASK, + final TaskProvider generateDescriptorTask = project.getTasks().register( + GEN_DESC_TASK_NAME, GenerateDescriptorTask.class, - docPubDsl + (task) -> { + task.getCurrentlyBuildingFamily().convention( docPubDsl.getReleaseFamilyIdentifier() ); + task.getJsonFile().convention( docPubDsl.getUpdatedJsonFile() ); + } ); - final PublishDescriptorTask uploadDescriptorTask = project.getTasks().create( - UPLOAD_DESC_TASK, + final TaskProvider uploadDescriptorTask = project.getTasks().register( + UPLOAD_DESC_TASK_NAME, PublishDescriptorTask.class, - docPubDsl + (task) -> { + task.getDocServerUrl().convention( docPubDsl.getDocServerUrl() ); + task.getJsonFile().convention( docPubDsl.getUpdatedJsonFile() ); + + task.dependsOn( generateDescriptorTask ); + task.onlyIf( (t) -> !isSnapshot && generateDescriptorTask.get().getDidWork() ); + } ); - final PublishMigrationGuide publishMigrationGuideTask = project.getTasks().create( + //noinspection unused + final TaskProvider publishMigrationGuideTask = project.getTasks().register( PublishMigrationGuide.NAME, PublishMigrationGuide.class, - docPubDsl + (task) -> { + task.getCurrentlyBuildingFamily().convention( docPubDsl.getReleaseFamilyIdentifier() ); + task.getDocServerUrl().convention( docPubDsl.getDocServerUrl() ); + task.getMigrationGuideDirectory().convention( project.getLayout().getBuildDirectory().dir( "asciidoc/migration-guide" ) ); + } ); - publishMigrationGuideTask.getMigrationGuideDirectory().convention( project.getLayout().getBuildDirectory().dir( "asciidoc/migration-guide" ) ); - // todo - incorporate HibernateVersion from `gradle/base-information.gradle` - final boolean isSnapshot = project.getVersion().toString().endsWith( "-SNAPSHOT" ); - uploadTask.onlyIf( (task) -> !isSnapshot ); - uploadDescriptorTask.onlyIf( (task) -> !isSnapshot && generateDescriptorTask.getDidWork() ); + //noinspection unused + final TaskProvider uploadTask = project.getTasks().register( + UPLOAD_TASK_NAME, + PublishTask.class, + (task) -> { + task.getBuildingFamily().convention( docPubDsl.getReleaseFamilyIdentifier() ); + task.getDocServerUrl().convention( docPubDsl.getDocServerUrl() ); + task.getStagingDirectory().convention( docPubDsl.getStagingDirectory() ); - uploadTask.dependsOn( uploadDescriptorTask ); - uploadDescriptorTask.dependsOn( generateDescriptorTask ); + task.dependsOn( uploadDescriptorTask ); + task.onlyIf( (t) -> !isSnapshot ); + } + ); } } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/GenerateDescriptorTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/GenerateDescriptorTask.java index 2df19af8ba..0abd90caae 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/GenerateDescriptorTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/GenerateDescriptorTask.java @@ -7,11 +7,11 @@ package org.hibernate.orm.docs; import java.io.File; -import javax.inject.Inject; import org.gradle.api.DefaultTask; -import org.gradle.api.file.RegularFile; -import org.gradle.api.provider.Provider; +import org.gradle.api.file.RegularFileProperty; +import org.gradle.api.provider.Property; +import org.gradle.api.tasks.Input; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; @@ -21,46 +21,50 @@ import org.hibernate.orm.ReleaseFamilyIdentifier; * @author Steve Ebersole */ public abstract class GenerateDescriptorTask extends DefaultTask { - private final Provider jsonFile; - private final ReleaseFamilyIdentifier currentlyBuildingFamily; + public static final String GEN_DESC_TASK_NAME = "generateDocumentationDescriptor"; + private final RegularFileProperty jsonFile; + private final Property currentlyBuildingFamily; - @Inject - public GenerateDescriptorTask(DocumentationPublishing config) { + public GenerateDescriptorTask() { setGroup( "Release" ); setDescription( "Generates the documentation publication descriptor (JSON)" ); - jsonFile = config.getUpdatedJsonFile(); - currentlyBuildingFamily = config.getReleaseFamilyIdentifier(); + jsonFile = getProject().getObjects().fileProperty(); + currentlyBuildingFamily = getProject().getObjects().property( ReleaseFamilyIdentifier.class ); + } - getInputs().property( "hibernate-version", currentlyBuildingFamily ); + @Input + public Property getCurrentlyBuildingFamily() { + return currentlyBuildingFamily; } @OutputFile - public Provider getJsonFile() { + public RegularFileProperty getJsonFile() { return jsonFile; } @TaskAction public void generateDescriptor() { - final ProjectDocumentation projectDoc = DescriptorAccess.loadProject(); + final ProjectDocumentationDescriptor descriptor = DescriptorAccess.loadProject(); ReleaseFamilyIdentifier newest = null; boolean foundCurrentRelease = false; - for ( ReleaseFamilyDocumentation releaseFamily : projectDoc.getReleaseFamilies() ) { + for ( ReleaseFamilyDocumentation releaseFamily : descriptor.getReleaseFamilies() ) { if ( newest == null || releaseFamily.getName().newerThan( newest ) ) { newest = releaseFamily.getName(); } - if ( releaseFamily.getName().equals( currentlyBuildingFamily ) ) { + if ( releaseFamily.getName().equals( currentlyBuildingFamily.get() ) ) { foundCurrentRelease = true; } } if ( ! foundCurrentRelease ) { final ReleaseFamilyDocumentation newEntry = new ReleaseFamilyDocumentation(); - newEntry.setName( currentlyBuildingFamily ); + newEntry.setName( currentlyBuildingFamily.get() ); + descriptor.addReleaseFamily( newEntry ); setDidWork( true ); } @@ -68,17 +72,17 @@ public abstract class GenerateDescriptorTask extends DefaultTask { // 1. we are currently building a Final // 2. currentlyBuildingFamily is the newest - if ( currentlyBuildingFamily.newerThan( newest ) ) { - projectDoc.setStableFamily( currentlyBuildingFamily ); + if ( currentlyBuildingFamily.get().newerThan( newest ) ) { + descriptor.setStableFamily( currentlyBuildingFamily.get() ); setDidWork( true ); } - DescriptorAccess.storeProject( projectDoc, jsonFile.get().getAsFile() ); + DescriptorAccess.storeProject( descriptor, jsonFile.get().getAsFile() ); } public static void main(String... args) { final File jsonFile = new File( "/home/sebersole/projects/hibernate-orm/6.0/hibernate-orm-build/target/doc-pub/orm.json" ); - final ProjectDocumentation projectDoc = DescriptorAccess.loadProject(); + final ProjectDocumentationDescriptor projectDoc = DescriptorAccess.loadProject(); DescriptorAccess.storeProject( projectDoc, jsonFile ); } } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/ProjectDocumentation.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/ProjectDocumentationDescriptor.java similarity index 91% rename from local-build-plugins/src/main/java/org/hibernate/orm/docs/ProjectDocumentation.java rename to local-build-plugins/src/main/java/org/hibernate/orm/docs/ProjectDocumentationDescriptor.java index 2122259aae..5213f22e81 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/ProjectDocumentation.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/ProjectDocumentationDescriptor.java @@ -6,10 +6,8 @@ */ package org.hibernate.orm.docs; -import java.util.Comparator; import java.util.List; import java.util.Map; -import java.util.TreeSet; import org.hibernate.orm.ReleaseFamilyIdentifier; @@ -23,7 +21,7 @@ import jakarta.json.bind.annotation.JsonbTypeAdapter; * @author Steve Ebersole */ @JsonbPropertyOrder( {"name", "stableFamily", "singlePageDetails", "multiPageDetails", "releaseFamilies" } ) -public class ProjectDocumentation { +public class ProjectDocumentationDescriptor { @JsonbProperty( "project" ) private String name; @@ -63,6 +61,11 @@ public class ProjectDocumentation { this.releaseFamilies = releaseFamilies; } + public void addReleaseFamily(ReleaseFamilyDocumentation familyDetails) { + // Add new entries at the top + releaseFamilies.add( 0, familyDetails ); + } + public Map getMultiPageDetails() { return multiPageDetails; } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishDescriptorTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishDescriptorTask.java index f54a9dd9e5..bfa9597f59 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishDescriptorTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishDescriptorTask.java @@ -6,10 +6,9 @@ */ package org.hibernate.orm.docs; -import javax.inject.Inject; - import org.gradle.api.DefaultTask; -import org.gradle.api.file.RegularFile; +import org.gradle.api.file.RegularFileProperty; +import org.gradle.api.provider.Property; import org.gradle.api.provider.Provider; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; @@ -20,31 +19,38 @@ import org.gradle.api.tasks.TaskAction; * @author Steve Ebersole */ public abstract class PublishDescriptorTask extends DefaultTask { - private final Provider docServerUrl; - private final Provider jsonFile; + public static final String UPLOAD_DESC_TASK_NAME = "uploadDocumentationDescriptor"; - @Inject - public PublishDescriptorTask(DocumentationPublishing config) { + private final Provider projectVersion; + private final Property docServerUrl; + private final RegularFileProperty jsonFile; + + public PublishDescriptorTask() { setGroup( "Release" ); setDescription( "Publishes the documentation publication descriptor (JSON)" ); - getInputs().property( "hibernate-version", getProject().getVersion() ); - - docServerUrl = config.getDocDescriptorServerUrl(); - jsonFile = config.getUpdatedJsonFile(); + projectVersion = getProject().provider( () -> getProject().getVersion() ); + docServerUrl = getProject().getObjects().property( String.class ); + jsonFile = getProject().getObjects().fileProperty(); } @InputFile @SkipWhenEmpty - public Provider getJsonFile() { + public RegularFileProperty getJsonFile() { return jsonFile; } @Input - public Provider getDocServerUrl() { + public Property getDocServerUrl() { return docServerUrl; } + @Input + public Provider getProjectVersion() { + return projectVersion; + } + + @TaskAction public void uploadDescriptor() { final String base = docServerUrl.get(); diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishMigrationGuide.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishMigrationGuide.java index e11ca970db..acf100227a 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishMigrationGuide.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishMigrationGuide.java @@ -1,9 +1,8 @@ package org.hibernate.orm.docs; -import javax.inject.Inject; - import org.gradle.api.DefaultTask; import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.provider.Property; import org.gradle.api.provider.Provider; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputDirectory; @@ -19,13 +18,12 @@ import org.hibernate.orm.ReleaseFamilyIdentifier; public abstract class PublishMigrationGuide extends DefaultTask { public static final String NAME = "publishMigrationGuide"; - private final Provider docServerUrl; - - private final ReleaseFamilyIdentifier currentlyBuildingFamily; + private final Provider projectVersion; + private final Property currentlyBuildingFamily; + private final Property docServerUrl; private final DirectoryProperty migrationGuideDirectory; - @Inject - public PublishMigrationGuide(DocumentationPublishing config) { + public PublishMigrationGuide() { setGroup( "Release" ); setDescription( "Publishes the migration-guide associated with the current branch. " + "Intended for incremental publishing of the guide for corrections, etc. without doing a full release. " + @@ -33,11 +31,18 @@ public abstract class PublishMigrationGuide extends DefaultTask { getInputs().property( "hibernate-version", getProject().getVersion() ); - docServerUrl = config.getDocServerUrl(); - currentlyBuildingFamily = config.getReleaseFamilyIdentifier(); + projectVersion = getProject().provider( () -> getProject().getVersion() ); + currentlyBuildingFamily = getProject().getObjects().property( ReleaseFamilyIdentifier.class ); + + docServerUrl = getProject().getObjects().property( String.class ); migrationGuideDirectory = getProject().getObjects().directoryProperty(); } + @Input + public Provider getProjectVersion() { + return projectVersion; + } + @InputDirectory @PathSensitive(PathSensitivity.RELATIVE) public DirectoryProperty getMigrationGuideDirectory() { @@ -45,15 +50,19 @@ public abstract class PublishMigrationGuide extends DefaultTask { } @Input - public Provider getDocServerUrl() { + public Property getDocServerUrl() { return docServerUrl; } + public Property getCurrentlyBuildingFamily() { + return currentlyBuildingFamily; + } + @TaskAction public void uploadMigrationGuide() { final String base = docServerUrl.get(); final String normalizedBase = base.endsWith( "/" ) ? base : base + "/"; - final String url = normalizedBase + currentlyBuildingFamily.toExternalForm() + "/migration-guide/"; + final String url = normalizedBase + currentlyBuildingFamily.get().toExternalForm() + "/migration-guide/"; RsyncHelper.rsync( migrationGuideDirectory.get(), url, getProject() ); } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishTask.java index 35d9c29f04..b8b0f14599 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/PublishTask.java @@ -6,11 +6,10 @@ */ package org.hibernate.orm.docs; -import javax.inject.Inject; - import org.gradle.api.DefaultTask; import org.gradle.api.file.Directory; -import org.gradle.api.provider.Provider; +import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.provider.Property; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputDirectory; import org.gradle.api.tasks.TaskAction; @@ -22,33 +21,39 @@ import org.hibernate.orm.ReleaseFamilyIdentifier; * @author Steve Ebersole */ public abstract class PublishTask extends DefaultTask { - private final ReleaseFamilyIdentifier buildingFamily; - private final Provider docServerUrl; - private final Provider stagingDirectory; + public static final String UPLOAD_TASK_NAME = "uploadDocumentation"; - @Inject - public PublishTask(DocumentationPublishing config) { + private final Property buildingFamily; + private final Property docServerUrl; + private final DirectoryProperty stagingDirectory; + + public PublishTask() { setGroup( "Release" ); setDescription( "Publish documentation to the doc server" ); - buildingFamily = config.getReleaseFamilyIdentifier(); - stagingDirectory = config.getStagingDirectory(); - docServerUrl = config.getDocServerUrl(); + buildingFamily = getProject().getObjects().property( ReleaseFamilyIdentifier.class ); + docServerUrl = getProject().getObjects().property( String.class ); + stagingDirectory = getProject().getObjects().directoryProperty(); } @Input - public Provider getDocServerUrl() { + public Property getDocServerUrl() { return docServerUrl; } + @Input + public Property getBuildingFamily() { + return buildingFamily; + } + @InputDirectory - public Provider getStagingDirectory() { + public Property getStagingDirectory() { return stagingDirectory; } @TaskAction public void uploadDocumentation() { - final String releaseFamily = buildingFamily.toExternalForm(); + final String releaseFamily = buildingFamily.get().toExternalForm(); final String base = docServerUrl.get(); final String normalizedBase = base.endsWith( "/" ) ? base : base + "/"; final String url = normalizedBase + releaseFamily; diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/docs/ReleaseFamilyDocumentation.java b/local-build-plugins/src/main/java/org/hibernate/orm/docs/ReleaseFamilyDocumentation.java index 01443e931e..96e71c5ad5 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/docs/ReleaseFamilyDocumentation.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/docs/ReleaseFamilyDocumentation.java @@ -18,7 +18,7 @@ import jakarta.json.bind.annotation.JsonbTypeAdapter; /** * Binding for the doc-pub descriptor (JSON) related to a specific release family. * - * @see ProjectDocumentation + * @see ProjectDocumentationDescriptor * * @author Steve Ebersole */ @@ -57,4 +57,9 @@ public class ReleaseFamilyDocumentation { } redirects.put( from, to ); } + + @Override + public String toString() { + return "ReleaseFamilyDocumentation( " + name + ")"; + } } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java index 0c4c64eb8e..47e2a78779 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java @@ -14,7 +14,6 @@ import java.io.OutputStreamWriter; import java.util.List; import java.util.TreeSet; import java.util.function.Consumer; -import javax.inject.Inject; import org.gradle.api.DefaultTask; import org.gradle.api.file.RegularFile; @@ -35,34 +34,36 @@ import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; /** * @author Steve Ebersole */ -public class AbstractJandexAwareTask extends DefaultTask { - private final IndexManager indexManager; - private final Provider reportFileReferenceAccess; +public abstract class AbstractJandexAwareTask extends DefaultTask { + private final Provider indexManager; - @Inject - public AbstractJandexAwareTask(IndexManager indexManager, Provider reportFileReferenceAccess) { - this.indexManager = indexManager; - this.reportFileReferenceAccess = reportFileReferenceAccess; + public AbstractJandexAwareTask() { setGroup( TASK_GROUP_NAME ); + + this.indexManager = getProject().provider( () -> getProject().getExtensions().getByType( IndexManager.class ) ); + getInputs().property( "version", getProject().getExtensions().getByName( "ormVersion" ) ); } + @Internal + protected abstract Provider getTaskReportFileReference(); + @Internal protected IndexManager getIndexManager() { - return indexManager; + return indexManager.get(); } @InputFile public Provider getIndexFileReference() { - return indexManager.getIndexFileReferenceAccess(); + return indexManager.get().getIndexFileReferenceAccess(); } @OutputFile - public Provider getReportFileReferenceAccess() { - return reportFileReferenceAccess; + public Provider getReportFileReference() { + return getTaskReportFileReference(); } protected File prepareReportFile() { - final File reportFile = getReportFileReferenceAccess().get().getAsFile(); + final File reportFile = getReportFileReference().get().getAsFile(); if ( reportFile.getParentFile().exists() ) { if ( reportFile.exists() ) { diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/DeprecationReportTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/DeprecationReportTask.java index 6fa62fcafb..4bb3811165 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/DeprecationReportTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/DeprecationReportTask.java @@ -10,13 +10,16 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Comparator; import java.util.TreeSet; -import javax.inject.Inject; -import org.gradle.api.Project; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.TaskAction; import org.jboss.jandex.DotName; +import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; + /** * @author Steve Ebersole */ @@ -24,13 +27,17 @@ public class DeprecationReportTask extends AbstractJandexAwareTask { public static final String REMOVE_ANN_NAME = "org.hibernate.Remove"; public static final String DEPRECATED_ANN_NAME = Deprecated.class.getName(); - @Inject - public DeprecationReportTask(IndexManager indexManager, Project project) { - super( - indexManager, - project.getLayout().getBuildDirectory().file( "orm/reports/deprecating.txt" ) - ); - setDescription( "Generates a report for things considered deprecating" ); + private final Property reportFile; + + public DeprecationReportTask() { + setDescription( "Generates a report for things considered deprecated" ); + reportFile = getProject().getObjects().fileProperty(); + reportFile.convention( getProject().getLayout().getBuildDirectory().file( "orm/reports/deprecating.txt" ) ); + } + + @Override + protected Provider getTaskReportFileReference() { + return reportFile; } @TaskAction diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java index 225059bcb5..16de169f60 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java @@ -17,9 +17,11 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.List; -import javax.inject.Inject; import org.gradle.api.Project; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskAction; @@ -29,19 +31,25 @@ import org.hibernate.orm.env.HibernateVersion; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.Index; +import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; + /** * Generates a report on Dialect information * * @author Steve Ebersole */ public abstract class DialectReportTask extends AbstractJandexAwareTask { + private final Property reportFile; - @Inject - public DialectReportTask(IndexManager indexManager, Project project) { - super( - indexManager, - project.getLayout().getBuildDirectory().file( "orm/reports/dialect.adoc" ) - ); + public DialectReportTask() { + setDescription( "Generates a report of the supported Dialects" ); + reportFile = getProject().getObjects().fileProperty(); + reportFile.convention( getProject().getLayout().getBuildDirectory().file( "orm/generated/dialect/dialect.adoc" ) ); + } + + @Override + protected Provider getTaskReportFileReference() { + return reportFile; } @TaskAction diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/IncubationReportTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/IncubationReportTask.java index 381895360c..7f0829facb 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/IncubationReportTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/IncubationReportTask.java @@ -12,24 +12,33 @@ import java.util.Comparator; import java.util.TreeSet; import javax.inject.Inject; -import org.gradle.api.Project; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.TaskAction; import org.jboss.jandex.DotName; +import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; + /** * @author Steve Ebersole */ public abstract class IncubationReportTask extends AbstractJandexAwareTask { public static final String INCUBATING_ANN_NAME = "org.hibernate.Incubating"; + private final Property reportFile; + @Inject - public IncubationReportTask(IndexManager indexManager, Project project) { - super( - indexManager, - project.getLayout().getBuildDirectory().file( "orm/reports/incubating.txt" ) - ); + public IncubationReportTask() { setDescription( "Generates a report for things considered incubating" ); + reportFile = getProject().getObjects().fileProperty(); + reportFile.convention( getProject().getLayout().getBuildDirectory().file( "orm/reports/incubating.txt" ) ); + } + + @Override + protected Provider getTaskReportFileReference() { + return reportFile; } @TaskAction diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/IndexerTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/IndexerTask.java index 3ddbb6a060..704538b3df 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/IndexerTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/IndexerTask.java @@ -6,8 +6,6 @@ */ package org.hibernate.orm.post; -import javax.inject.Inject; - import org.gradle.api.DefaultTask; import org.gradle.api.artifacts.Configuration; import org.gradle.api.file.RegularFile; @@ -26,33 +24,33 @@ import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; * @author Steve Ebersole */ public abstract class IndexerTask extends DefaultTask { - private final IndexManager indexManager; + private final Provider indexManager; - @Inject - public IndexerTask(IndexManager indexManager) { - this.indexManager = indexManager; + public IndexerTask() { setGroup( TASK_GROUP_NAME ); setDescription( "Builds a Jandex Index from the artifacts attached to the `" + CONFIG_NAME + "` Configuration" ); + + indexManager = getProject().provider( () -> getProject().getExtensions().getByType( IndexManager.class ) ); } @InputFiles @SkipWhenEmpty public Configuration getArtifactsToProcess() { - return indexManager.getArtifactsToProcess(); + return indexManager.get().getArtifactsToProcess(); } @OutputFile public Provider getIndexFileReference() { - return indexManager.getIndexFileReferenceAccess(); + return indexManager.get().getIndexFileReferenceAccess(); } @OutputFile public Provider getPackageFileReferenceAccess() { - return indexManager.getPackageFileReferenceAccess(); + return indexManager.get().getPackageFileReferenceAccess(); } @TaskAction public void createIndex() { - indexManager.index(); + indexManager.get().index(); } } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/InternalsReportTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/InternalsReportTask.java index 129cf02e03..c6f6b75987 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/InternalsReportTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/InternalsReportTask.java @@ -13,22 +13,32 @@ import java.util.TreeSet; import javax.inject.Inject; import org.gradle.api.Project; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.TaskAction; import org.jboss.jandex.DotName; +import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; + /** * @author Steve Ebersole */ public abstract class InternalsReportTask extends AbstractJandexAwareTask { public static final String INTERNAL_ANN_NAME = "org.hibernate.Internal"; - @Inject - public InternalsReportTask(IndexManager indexManager, Project project) { - super( - indexManager, - project.getLayout().getBuildDirectory().file( "orm/reports/internal.txt" ) - ); + private final Property reportFile; + + public InternalsReportTask() { + setDescription( "Generates a report of things consider internal" ); + reportFile = getProject().getObjects().fileProperty(); + reportFile.convention( getProject().getLayout().getBuildDirectory().file( "orm/reports/internal.txt" ) ); + } + + @Override + protected Provider getTaskReportFileReference() { + return reportFile; } @TaskAction diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/LoggingReportTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/LoggingReportTask.java index 8611510672..1cd0324943 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/LoggingReportTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/LoggingReportTask.java @@ -19,6 +19,9 @@ import java.util.TreeSet; import javax.inject.Inject; import org.gradle.api.Project; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.TaskAction; import org.jboss.jandex.AnnotationInstance; @@ -26,6 +29,7 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.Index; +import static org.hibernate.orm.post.ReportGenerationPlugin.TASK_GROUP_NAME; import static org.jboss.jandex.DotName.createSimple; /** @@ -44,12 +48,17 @@ public abstract class LoggingReportTask extends AbstractJandexAwareTask { public static final DotName ID_RANGE_ANN_NAME = createSimple( "org.jboss.logging.annotations.ValidIdRange" ); public static final DotName MSG_ANN_NAME = createSimple( "org.jboss.logging.annotations.Message" ); - @Inject - public LoggingReportTask(IndexManager indexManager, Project project) { - super( - indexManager, - project.getLayout().getBuildDirectory().file( "orm/reports/logging.adoc" ) - ); + private final Property reportFile; + + public LoggingReportTask() { + setDescription( "Generates a report of \"system\" logging" ); + reportFile = getProject().getObjects().fileProperty(); + reportFile.convention( getProject().getLayout().getBuildDirectory().file( "orm/generated/logging/logging.adoc" ) ); + } + + @Override + protected Provider getTaskReportFileReference() { + return reportFile; } @TaskAction diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java index fb4af1769e..aa987dd82c 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/ReportGenerationPlugin.java @@ -10,6 +10,7 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.Task; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.tasks.TaskProvider; /** * @author Steve Ebersole @@ -24,55 +25,51 @@ public class ReportGenerationPlugin implements Plugin { .maybeCreate( CONFIG_NAME ) .setDescription( "Used to collect the jars with classes files to be used in the aggregation reports for `@Internal`, `@Incubating`, etc" ); - final Task groupingTask = project.getTasks().maybeCreate( "generateHibernateReports" ); - groupingTask.setGroup( TASK_GROUP_NAME ); - final IndexManager indexManager = new IndexManager( artifactsToProcess, project ); - final IndexerTask indexerTask = project.getTasks().create( - "buildAggregatedIndex", - IndexerTask.class, - indexManager - ); - groupingTask.dependsOn( indexerTask ); + project.getExtensions().add( "indexManager", indexManager ); - final IncubationReportTask incubatingTask = project.getTasks().create( + final TaskProvider indexerTask = project.getTasks().register( + "buildAggregatedIndex", + IndexerTask.class + ); + + final TaskProvider incubatingTask = project.getTasks().register( "generateIncubationReport", IncubationReportTask.class, - indexManager + (task) -> task.dependsOn( indexerTask ) ); - incubatingTask.dependsOn( indexerTask ); - groupingTask.dependsOn( incubatingTask ); - final DeprecationReportTask deprecationTask = project.getTasks().create( + final TaskProvider deprecationTask = project.getTasks().register( "generateDeprecationReport", DeprecationReportTask.class, - indexManager + (task) -> task.dependsOn( indexerTask ) ); - deprecationTask.dependsOn( indexerTask ); - groupingTask.dependsOn( deprecationTask ); - final InternalsReportTask internalsTask = project.getTasks().create( + final TaskProvider internalsTask = project.getTasks().register( "generateInternalsReport", InternalsReportTask.class, - indexManager + (task) -> task.dependsOn( indexerTask ) ); - internalsTask.dependsOn( indexerTask ); - groupingTask.dependsOn( internalsTask ); - final LoggingReportTask loggingTask = project.getTasks().create( + final TaskProvider loggingTask = project.getTasks().register( "generateLoggingReport", LoggingReportTask.class, - indexManager + (task) -> task.dependsOn( indexerTask ) ); - loggingTask.dependsOn( indexerTask ); - groupingTask.dependsOn( loggingTask ); - final DialectReportTask dialectTask = project.getTasks().create( + final TaskProvider dialectTask = project.getTasks().register( "generateDialectReport", DialectReportTask.class, - indexManager + (task) -> task.dependsOn( indexerTask ) ); - dialectTask.dependsOn( indexerTask ); + + final Task groupingTask = project.getTasks().maybeCreate( "generateReports" ); + groupingTask.setGroup( TASK_GROUP_NAME ); + groupingTask.dependsOn( indexerTask ); + groupingTask.dependsOn( incubatingTask ); + groupingTask.dependsOn( deprecationTask ); + groupingTask.dependsOn( internalsTask ); + groupingTask.dependsOn( loggingTask ); groupingTask.dependsOn( dialectTask ); } } diff --git a/release/release.gradle b/release/release.gradle index 7c69e37f24..7bd0039028 100644 --- a/release/release.gradle +++ b/release/release.gradle @@ -154,17 +154,13 @@ dependencies { // aggregated JavaDoc // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -final File javadocDir = mkdir( new File( (File) project.buildDir, 'documentation/javadocs' ) ); - -/** - * Builds the JavaDocs aggregated (unified) across all the sub-projects - */ -task aggregateJavadocs(type: Javadoc) { +def aggregateJavadocsTask = tasks.register( "aggregateJavadocs", Javadoc ) { description = 'Builds an aggregated JavaDoc across all ORM sub-projects' final int currentYear = new GregorianCalendar().get( Calendar.YEAR ) + destinationDir = mkdir( new File( (File) project.buildDir, 'documentation/javadocs' ) ) + source configurations.javadocSources classpath += configurations.javadocClasspath @@ -175,10 +171,9 @@ task aggregateJavadocs(type: Javadoc) { // apply standard config maxMemory = '512m' - destinationDir = javadocDir configure( options ) { overview = 'src/release/javadoc/overview.html' - stylesheetFile = new File(projectDir, 'src/release/javadoc/stylesheet.css') + stylesheetFile = new File( projectDir, 'src/release/javadoc/stylesheet.css' ) windowTitle = 'Hibernate JavaDocs' docTitle = "Hibernate JavaDoc ($project.version)" bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." @@ -195,8 +190,10 @@ task aggregateJavadocs(type: Javadoc) { options.addStringOption( 'Xdoclint:none', '-quiet' ) if ( jdkVersions.explicit ) { - options.setJFlags( getProperty( 'toolchain.javadoc.jvmargs' ).toString(). - split( ' ' ).toList().findAll( { !it.isEmpty() } ) ) + options.setJFlags( + getProperty( 'toolchain.javadoc.jvmargs' ).toString(). + split( ' ' ).toList().findAll( { !it.isEmpty() } ) + ) } } @@ -210,164 +207,161 @@ task aggregateJavadocs(type: Javadoc) { } } -task stageIntegrationGuide(type: Copy) { - group 'Release' - dependsOn ':documentation:renderIntegrationGuide' +def stageIntegrationGuideTask = tasks.register( "stageIntegrationGuide", Copy ) { + group "Release" + description "Stages the Integration Guide as part of preparing for release" + dependsOn ":documentation:renderIntegrationGuides" - from "${project( ':documentation' ).buildDir}/asciidoc/integrationguide" - into "${buildDir}/documentation/integrationguide" + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/integrationguide" ) } + into layout.buildDirectory.dir( "documentation/integrationguide" ) } - -task stageQuickstart(type: Copy) { +def stageQuickstartTask = tasks.register( "stageQuickstart", Copy ) { group 'Release' - + description "Stages the Getting Started Guide as part of preparing for release" dependsOn ':documentation:renderGettingStartedGuides' - from "${project( ':documentation' ).buildDir}/asciidoc/quickstart" - into "${buildDir}/documentation/quickstart" + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/quickstart" ) } + into layout.buildDirectory.dir( "documentation/quickstart" ) } - -task stageTopicalGuide(type: Copy) { +def stageTopicalGuideTask = tasks.register( "stageTopicalGuide", Copy ) { group 'Release' - + description "Stages the Topical Guide as part of preparing for release" dependsOn ':documentation:renderTopicalGuides' - from "${project( ':documentation' ).buildDir}/asciidoc/topical" - into "${buildDir}/documentation/topical" + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/topical" ) } + into layout.buildDirectory.dir( "documentation/topical" ) + } -task stageIntroduction(type: Copy) { +def stageIntroductionGuideTask = tasks.register( "stageIntroductionGuide", Copy ) { group 'Release' + description "Stages the Introduction Guide as part of preparing for release" + dependsOn ':documentation:renderIntroductionGuides' - dependsOn ':documentation:renderIntroduction', ':documentation:renderIntroductionPdf' - - from "${project( ':documentation' ).buildDir}/asciidoc/introduction" - into "${buildDir}/documentation/introduction" + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/introduction" ) } + into layout.buildDirectory.dir( "documentation/introduction" ) } -task stageQL(type: Copy) { +def stageQueryGuideTasks = tasks.register( "stageQueryGuide", Copy ) { group 'Release' + description "Stages the Query Language Guide as part of preparing for release" + dependsOn ':documentation:renderQueryLanguageGuides' - dependsOn ':documentation:renderQL', ':documentation:renderQLPdf' - - from "${project( ':documentation' ).buildDir}/asciidoc/querylanguage" - into "${buildDir}/documentation/querylanguage" + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/querylanguage" ) } + into layout.buildDirectory.dir( "documentation/querylanguage" ) } -task stageUserGuide(type: Copy) { +def stageUserGuideTask = tasks.register( "stageUserGuide", Copy ) { group 'Release' + description "Stages the User Guide as part of preparing for release" + dependsOn ':documentation:renderUserGuides' - dependsOn ':documentation:renderUserGuide' - - from "${project( ':documentation' ).buildDir}/asciidoc/userguide" - into "${buildDir}/documentation/userguide" + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/userguide" ) } + into layout.buildDirectory.dir( "documentation/userguide" ) } -task stageMigrationGuide(type: Copy) { +def stageMigrationGuideTask = tasks.register( "stageMigrationGuide", Copy ) { group 'Release' - + description "Stages the Migration Guide as part of preparing for release" dependsOn ':documentation:renderMigrationGuide' - from project(":documentation").layout.buildDirectory.dir("asciidoc/migration-guide") - into layout.buildDirectory.dir("documentation/migration-guide") + from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/migration-guide" ) } + into layout.buildDirectory.dir( "documentation/migration-guide" ) } tasks.named( "publishMigrationGuide" ).configure { dependsOn stageMigrationGuide - migrationGuideDirectory = project.layout.buildDirectory.dir("documentation/migration-guide") } -task stageOrmReports { +def stageIncubationReportTask = tasks.register( "stageIncubationReport", Copy ) { task -> group 'Release' - - dependsOn ':documentation:generateHibernateReports' -} - -task stageOrmIncubationReport(type: Copy) { task -> - group 'Release' - + description "Stages ORM @Incubating report" dependsOn ':documentation:generateIncubationReport' + tasks.stageOrmReports.dependsOn task - from project( ":documentation" ).tasks.generateIncubationReport.reportFileReferenceAccess - into "${buildDir}/documentation/incubating" + from project( ":documentation" ).tasks.generateIncubationReport + into layout.buildDirectory.dir( "documentation/incubating" ) } -task stageOrmInternalsReport(type: Copy) { task -> +def stageInternalsReportTask = tasks.register( "stageInternalsReport", Copy ) { task -> group 'Release' - + description "Stages the @Internal report" dependsOn ':documentation:generateInternalsReport' - tasks.stageOrmReports.dependsOn task - from project( ":documentation" ).tasks.generateInternalsReport.reportFileReferenceAccess - into "${buildDir}/documentation/internals" + from project( ":documentation" ).tasks.generateInternalsReport + into layout.buildDirectory.dir( "documentation/internals" ) } -task stageOrmDeprecationReport(type: Copy) { task -> +def stageDeprecationReportTask = tasks.register( "stageDeprecationReport", Copy ) { group 'Release' + description "Stages the @Deprecated/@Remove report" dependsOn ':documentation:generateDeprecationReport' - tasks.stageOrmReports.dependsOn task - from project( ":documentation" ).tasks.generateDeprecationReport.reportFileReferenceAccess - into "${buildDir}/documentation/deprecated" + from project( ":documentation" ).tasks.generateDeprecationReport + into layout.buildDirectory.dir( "documentation/deprecated" ) } -task stageOrmLoggingReport(type: Copy) { task -> +def stageLoggingReportTask = tasks.register( "stageLoggingReport", Copy ) { task -> group 'Release' + description "Stages the logging report" dependsOn ':documentation:renderLoggingReport' - tasks.stageOrmReports.dependsOn task - from project( ":documentation" ).tasks.renderLoggingReport.outputDir - into "${buildDir}/documentation/logging" + from project( ":documentation" ).tasks.renderLoggingReport + into layout.buildDirectory.dir( "documentation/logging" ) } - -task stageOrmDialectReport(type: Copy) { task -> +def stageDialectReportTask = tasks.register( "stageDialectReport", Copy ) { task -> group 'Release' - + description "Stages the supported Dialects report" dependsOn ':documentation:renderDialectReport' - tasks.stageOrmReports.dependsOn task - from project( ":documentation" ).tasks.renderDialectReport.outputDir + from project( ":documentation" ).tasks.renderDialectReport into "${buildDir}/documentation/dialect" } +def stageOrmReportsTask = tasks.register( "stageOrmReports" ) { + group 'Release' + description "Stages all ORM reports as part of preparing for release" + + dependsOn ':documentation:generateReports' + dependsOn stageIncubationReportTask + dependsOn stageInternalsReportTask + dependsOn stageDeprecationReportTask + dependsOn stageLoggingReportTask + dependsOn stageDialectReportTask +} + /** * Assembles all documentation into the {buildDir}/documentation directory. * * Depends on building the docs */ -task assembleDocumentation { +def assembleDocumentationTask = tasks.register( "assembleDocumentation" ) { group 'Release' description 'Assembles all documentation into the {buildDir}/documentation directory' dependsOn ':documentation:buildDocsForPublishing' - dependsOn tasks.aggregateJavadocs - dependsOn tasks.stageIntegrationGuide - dependsOn tasks.stageTopicalGuide - dependsOn tasks.stageQuickstart - dependsOn tasks.stageIntroduction - dependsOn tasks.stageQL - dependsOn tasks.stageUserGuide - dependsOn tasks.stageMigrationGuide - dependsOn tasks.stageOrmReports + dependsOn aggregateJavadocsTask + dependsOn stageQuickstartTask + dependsOn stageIntroductionGuideTask + dependsOn stageUserGuideTask + dependsOn stageQueryGuideTasks + dependsOn stageIntegrationGuideTask + dependsOn stageTopicalGuideTask + dependsOn stageMigrationGuideTask + dependsOn stageOrmReportsTask } -//task assembleProjectTemplates(type:Copy, dependsOn: project( ":project-template" ).tasks.assembleDist) { -// def templateProject = project( ":project-template" ) -// from templateProject.layout.buildDirectory.dir( "distributions" ) -// into projectTemplateStagingDir -//} - -tasks.uploadDocumentation { - dependsOn assembleDocumentation +tasks.named( "uploadDocumentation" ) { + dependsOn assembleDocumentationTask doFirst { if ( rootProject.ormVersion.isSnapshot ) { @@ -384,25 +378,23 @@ tasks.uploadDocumentation { } } -task releaseChecks { +def releaseChecksTask = tasks.register( "releaseChecks" ) { group 'Release' description 'Checks and preparation for release' } -task preVerifyRelease{ +def preVerifyReleaseTask = tasks.register( "preVerifyRelease" ){ group 'Release' description 'Pre-verifies a release job execution (Run locally before a CI release)' - dependsOn clean - dependsOn assembleDocumentation + dependsOn tasks.clean + dependsOn assembleDocumentationTask } - -task changeLogFile { +def changeLogFileTask = tasks.register( "changeLogFile" ) { group 'Release' description 'Updates the changelog.txt file based on the change-log report from Jira' - - dependsOn project.tasks.releaseChecks + dependsOn releaseChecksTask doFirst { logger.lifecycle( "Appending version `${project.releaseVersion}` to changelog..." ) @@ -410,11 +402,11 @@ task changeLogFile { } } -task changeToReleaseVersion { +def changeToReleaseVersionTask = tasks.register( "changeToReleaseVersion" ) { group 'Release' description 'Updates `gradle/version.properties` file to the specified release-version' - dependsOn project.tasks.releaseChecks + dependsOn releaseChecksTask doFirst { logger.lifecycle( "Updating version-file to release-version : `${project.releaseVersion}`" ) @@ -422,9 +414,9 @@ task changeToReleaseVersion { } } -task gitPreparationForRelease { - dependsOn changeLogFile - dependsOn changeToReleaseVersion +def gitPreparationForReleaseTask = tasks.register( 'gitPreparationForRelease' ) { + dependsOn changeLogFileTask + dependsOn changeToReleaseVersionTask doLast { logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" ) @@ -433,11 +425,11 @@ task gitPreparationForRelease { } } -task changeToDevelopmentVersion { +def changeToDevelopmentVersionTask = tasks.register( 'changeToDevelopmentVersion' ) { group 'Release' description 'Updates `gradle/version.properties` file to the specified development-version' - dependsOn project.tasks.releaseChecks + dependsOn releaseChecksTask doFirst { logger.lifecycle( "Updating version-file to development-version : `${project.developmentVersion}`" ) @@ -445,8 +437,8 @@ task changeToDevelopmentVersion { } } -task gitTasksAfterRelease { - dependsOn changeToDevelopmentVersion +def gitTasksAfterReleaseTask = tasks.register( 'gitTasksAfterRelease' ) { + dependsOn changeToDevelopmentVersionTask doLast { logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" ) @@ -454,7 +446,7 @@ task gitTasksAfterRelease { executeGitCommand( 'commit', '-m', "Post-steps for release : `${project.ormVersion.fullName}`" ) if ( project.createTag ) { - logger.lifecycle("Tagging release : `${project.releaseTag}`...") + logger.lifecycle( "Tagging release : `${project.releaseTag}`..." ) executeGitCommand( 'tag', '-a', project.releaseTag, '-m', "Release $project.ormVersion.fullName" ) } } @@ -465,50 +457,51 @@ void updateVersionFile(String version) { project.ormVersionFile.text = "hibernateVersion=${version}" } -task publishReleaseArtifacts { - dependsOn releaseChecks - dependsOn uploadDocumentation +def publishReleaseArtifactsTask = tasks.register( 'publishReleaseArtifacts' ) { + dependsOn releaseChecksTask + mustRunAfter gitPreparationForReleaseTask - mustRunAfter gitPreparationForRelease + dependsOn uploadDocumentation + dependsOn uploadDocumentationDescriptor } -task release { +def releaseTask = tasks.register( 'release' ) { group 'Release' description 'Performs a release on local check-out, including updating changelog and ' - dependsOn gitPreparationForRelease - dependsOn publishReleaseArtifacts + dependsOn gitPreparationForReleaseTask + dependsOn publishReleaseArtifactsTask - finalizedBy gitTasksAfterRelease + finalizedBy gitTasksAfterReleaseTask } -task ciReleaseChecks { +def ciReleaseChecksTask = tasks.register( 'ciReleaseChecks' ) { dependsOn releaseChecks } -task gitTasksAfterCiRelease { - dependsOn gitTasksAfterRelease +def gitTasksAfterCiReleaseTask = tasks.register( 'gitTasksAfterCiRelease' ) { + dependsOn gitTasksAfterReleaseTask doLast { if ( project.createTag ) { logger.lifecycle( "Pushing branch and tag to remote `${project.gitRemote}`..." ) - executeGitCommand( 'push', '--atomic', project.gitRemote , project.gitBranch, project.releaseTag ) + executeGitCommand( 'push', '--atomic', project.gitRemote, project.gitBranch, project.releaseTag ) } else { - logger.lifecycle("Pushing branch to remote `${project.gitRemote}`..." ) - executeGitCommand( 'push', project.gitRemote , project.gitBranch ) + logger.lifecycle( "Pushing branch to remote `${project.gitRemote}`..." ) + executeGitCommand( 'push', project.gitRemote, project.gitBranch ) } } } -task ciRelease { +def ciReleaseTask = tasks.register( 'ciRelease' ) { group 'Release' description 'Performs a release: the hibernate version is set and the changelog.txt file updated, the changes are pushed to github, then the release is performed, tagged and the hibernate version is set to the development one.' - dependsOn ciReleaseChecks - dependsOn release + dependsOn ciReleaseChecksTask + dependsOn releaseTask - finalizedBy gitTasksAfterCiRelease + finalizedBy gitTasksAfterCiReleaseTask } static String executeGitCommand(Object ... subcommand){ diff --git a/settings.gradle b/settings.gradle index 70ec165da6..9a6a81268d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -52,207 +52,203 @@ dependencyResolutionManagement { versionCatalogs { jdks { - version( "baseline", "11" ) + version "baseline", "11" // Gradle does bytecode transformation on tests. // You can't use bytecode higher than what Gradle supports, even with toolchains. - version( "maxSupportedBytecode", "21" ) + version "maxSupportedBytecode", "21" } libs { - def antlrVersion = "4.10.1" - def byteBuddyVersion = "1.14.5" - def classmateVersion = "1.5.1" - def geolatteVersion = "1.8.2" - def hcannVersion = "6.0.6.Final" - def jandexVersion = "3.1.2" - def jacksonVersion = "2.14.1" - def jbossLoggingVersion = "3.5.0.Final" - def jbossLoggingToolVersion = "2.2.1.Final" + def antlrVersion = version "antlr", "4.10.1" + def byteBuddyVersion = version "byteBuddy", "1.14.5" + def classmateVersion = version "classmate", "1.5.1" + def geolatteVersion = version "geolatte", "1.8.2" + def hcannVersion = version "hcann", "6.0.6.Final" + def jandexVersion = version "jandex", "3.1.2" + def jacksonVersion = version "jackson", "2.14.1" + def jbossLoggingVersion = version "jbossLogging", "3.5.0.Final" + def jbossLoggingToolVersion = version "jbossLoggingTool", "2.2.1.Final" - def agroalVersion = "2.0" - def c3poVersion = "0.9.5.5" - def hikaricpVersion = "3.2.0" - def proxoolVersion = "0.8.3" - def viburVersion = "25.0" + def agroalVersion = version "agroal", "2.0" + def c3poVersion = version"c3p0", "0.9.5.5" + def hikaricpVersion = version "hikaricp", "3.2.0" + def proxoolVersion = version "proxool", "0.8.3" + def viburVersion = version "vibur", "25.0" - def jcacheVersion = "1.0.0" - def ehcache3Version = "3.10.8" + def jcacheVersion = version "jcache", "1.0.0" + def ehcache3Version = version "ehcache3", "3.10.8" - def micrometerVersion = "1.10.4" + def micrometerVersion = version "micrometer", "1.10.4" - def hibernateValidatorVersion = "8.0.0.Final" + def hibernateValidatorVersion = version "hibernateValidator", "8.0.0.Final" - // these versions are referenced directly in build scripts - version( "byteBuddy", byteBuddyVersion ) - version( "vibur", viburVersion ) + library( "antlr", "org.antlr", "antlr4" ).versionRef( antlrVersion ) + library( "antlrRuntime", "org.antlr", "antlr4-runtime" ).versionRef( antlrVersion) - library( "antlr", "org.antlr", "antlr4" ).version( antlrVersion ) - library( "antlrRuntime", "org.antlr", "antlr4-runtime" ).version( antlrVersion) + library( "byteBuddy", "net.bytebuddy", "byte-buddy" ).versionRef( byteBuddyVersion ) + library( "byteBuddyAgent", "net.bytebuddy", "byte-buddy-agent" ).versionRef( byteBuddyVersion ) - library( "byteBuddy", "net.bytebuddy", "byte-buddy" ).version( byteBuddyVersion ) - library( "byteBuddyAgent", "net.bytebuddy", "byte-buddy-agent" ).version( byteBuddyVersion ) + library( "logging", "org.jboss.logging", "jboss-logging" ).versionRef( jbossLoggingVersion ) + library( "loggingAnnotations", "org.jboss.logging", "jboss-logging-annotations" ).versionRef( jbossLoggingToolVersion ) + library( "loggingProcessor", "org.jboss.logging", "jboss-logging-processor" ).versionRef( jbossLoggingToolVersion ) - library( "logging", "org.jboss.logging", "jboss-logging" ).version( jbossLoggingVersion ) - library( "loggingAnnotations", "org.jboss.logging", "jboss-logging-annotations" ).version( jbossLoggingToolVersion ) - library( "loggingProcessor", "org.jboss.logging", "jboss-logging-processor" ).version( jbossLoggingToolVersion ) + library( "hcann", "org.hibernate.common", "hibernate-commons-annotations" ).versionRef( hcannVersion ) + library( "jandex", "io.smallrye", "jandex" ).versionRef( jandexVersion ) + library( "classmate", "com.fasterxml", "classmate" ).versionRef( classmateVersion ) - library( "hcann", "org.hibernate.common", "hibernate-commons-annotations" ).version( hcannVersion ) - library( "jandex", "io.smallrye", "jandex" ).version( jandexVersion ) - library( "classmate", "com.fasterxml", "classmate" ).version( classmateVersion ) + library( "jackson", "com.fasterxml.jackson.core", "jackson-databind" ).versionRef( jacksonVersion ) + library( "jacksonXml", "com.fasterxml.jackson.dataformat", "jackson-dataformat-xml" ).versionRef( jacksonVersion ) + library( "jacksonJsr310", "com.fasterxml.jackson.datatype", "jackson-datatype-jsr310" ).versionRef( jacksonVersion ) + library( "validator", "org.hibernate.validator", "hibernate-validator" ).versionRef( hibernateValidatorVersion ) - library( "jackson", "com.fasterxml.jackson.core", "jackson-databind" ).version( jacksonVersion ) - library( "jacksonXml", "com.fasterxml.jackson.dataformat", "jackson-dataformat-xml" ).version( jacksonVersion ) - library( "jacksonJsr310", "com.fasterxml.jackson.datatype", "jackson-datatype-jsr310" ).version( jacksonVersion ) - library( "validator", "org.hibernate.validator", "hibernate-validator" ).version( hibernateValidatorVersion ) + library( "agroal", "io.agroal", "agroal-api" ).versionRef( agroalVersion ) + library( "agroalPool", "io.agroal", "agroal-pool" ).versionRef( agroalVersion ) - library( "agroal", "io.agroal", "agroal-api" ).version( agroalVersion ) - library( "agroalPool", "io.agroal", "agroal-pool" ).version( agroalVersion ) + library( "c3p0", "com.mchange", "c3p0" ).versionRef( c3poVersion ) - library( "c3p0", "com.mchange", "c3p0" ).version( c3poVersion ) + library( "hikaricp", "com.zaxxer", "HikariCP" ).versionRef( hikaricpVersion ) - library( "hikaricp", "com.zaxxer", "HikariCP" ).version( hikaricpVersion ) + library( "proxool", "proxool", "proxool" ).versionRef( proxoolVersion ) - library( "proxool", "proxool", "proxool" ).version( proxoolVersion ) + library( "vibur", "org.vibur", "vibur-dbcp" ).versionRef( viburVersion ) - library( "vibur", "org.vibur", "vibur-dbcp" ).version( viburVersion ) + library( "geolatte", "org.geolatte", "geolatte-geom" ).versionRef( geolatteVersion ) - library( "geolatte", "org.geolatte", "geolatte-geom" ).version( geolatteVersion ) + library( "jcache", "javax.cache", "cache-api" ).versionRef( jcacheVersion ) + library( "ehcache3", "org.ehcache", "ehcache" ).versionRef( ehcache3Version ) - library( "jcache", "javax.cache", "cache-api" ).version( jcacheVersion ) - library( "ehcache3", "org.ehcache", "ehcache" ).version( ehcache3Version ) - - library( "micrometer", "io.micrometer", "micrometer-core" ).version( micrometerVersion ) + library( "micrometer", "io.micrometer", "micrometer-core" ).versionRef( micrometerVersion ) library( "ant", "org.apache.ant", "ant" ).version( "1.8.2" ) } jakartaLibs { // `jakartaJpaVersion` comes from the local-build-plugins to allow for command-line overriding of the JPA version to use - def jpaVersion = "${jakartaJpaVersion}" + def jpaVersion = version "jpa", "${jakartaJpaVersion}" - def annotationVersion = "2.1.1" - def cdiVersion = "4.0.1" - def elVersion = "5.0.0" - def injectVersion = "2.0.1" - def interceptorsVersion = "2.1.0" - def jaccVersion = "2.1.0" - def jaxbApiVersion = "4.0.0" - def jaxbRuntimeVersion = "4.0.2" - def jsonbApiVersion = "3.0.0" - def jsonbRuntimeVersion = "3.0.2" - def jtaVersion = "2.0.1" - def validationVersion = "3.0.2" - def xjcVersion = jaxbRuntimeVersion + def annotationVersion = version "annotation", "2.1.1" + def cdiVersion = version "cdi", "4.0.1" + def elVersion = version "el", "5.0.0" + def injectVersion = version "inject", "2.0.1" + def interceptorsVersion = version "interceptors", "2.1.0" + def jaccVersion = version "jacc", "2.1.0" + def jaxbApiVersion = version "jaxbApi", "4.0.0" + def jaxbRuntimeVersion = version "jaxbRuntime", "4.0.2" + def jsonbApiVersion = version "jsonbApi", "3.0.0" + def jsonbRuntimeVersion = version "jsonbRuntime", "3.0.2" + def jtaVersion = version "jta", "2.0.1" + def validationVersion = version "validation", "3.0.2" + def xjcVersion = version "jaxbRuntime", jaxbRuntimeVersion - library( "jpa", "jakarta.persistence", "jakarta.persistence-api" ).version( jpaVersion ) - library( "jta", "jakarta.transaction", "jakarta.transaction-api" ).version( jtaVersion ) + library( "jpa", "jakarta.persistence", "jakarta.persistence-api" ).versionRef( jpaVersion ) + library( "jta", "jakarta.transaction", "jakarta.transaction-api" ).versionRef( jtaVersion ) - library( "validation", "jakarta.validation", "jakarta.validation-api" ).version( validationVersion ) - library( "jacc", "jakarta.authorization", "jakarta.authorization-api" ).version( jaccVersion ) - library( "cdi", "jakarta.enterprise", "jakarta.enterprise.cdi-api" ).version( cdiVersion ) - library( "annotation", "jakarta.annotation", "jakarta.annotation-api" ).version( annotationVersion ) - library( "interceptors", "jakarta.interceptor", "jakarta.interceptor-api" ).version( interceptorsVersion ) - library( "jsonbApi", "jakarta.json.bind", "jakarta.json.bind-api" ).version( jsonbApiVersion ) - library( "jsonb", "org.eclipse", "yasson" ).version( jsonbRuntimeVersion ) - library( "inject", "jakarta.inject", "jakarta.inject-api" ).version( injectVersion ) - library( "jaxbApi", "jakarta.xml.bind", "jakarta.xml.bind-api" ).version( jaxbApiVersion ) - library( "jaxb", "org.glassfish.jaxb", "jaxb-runtime" ).version( jaxbRuntimeVersion ) - library( "xjc", "org.glassfish.jaxb", "jaxb-xjc" ).version( xjcVersion ) - library( "el", "org.glassfish.expressly", "expressly" ).version( elVersion ) + library( "validation", "jakarta.validation", "jakarta.validation-api" ).versionRef( validationVersion ) + library( "jacc", "jakarta.authorization", "jakarta.authorization-api" ).versionRef( jaccVersion ) + library( "cdi", "jakarta.enterprise", "jakarta.enterprise.cdi-api" ).versionRef( cdiVersion ) + library( "annotation", "jakarta.annotation", "jakarta.annotation-api" ).versionRef( annotationVersion ) + library( "interceptors", "jakarta.interceptor", "jakarta.interceptor-api" ).versionRef( interceptorsVersion ) + library( "jsonbApi", "jakarta.json.bind", "jakarta.json.bind-api" ).versionRef( jsonbApiVersion ) + library( "jsonb", "org.eclipse", "yasson" ).versionRef( jsonbRuntimeVersion ) + library( "inject", "jakarta.inject", "jakarta.inject-api" ).versionRef( injectVersion ) + library( "jaxbApi", "jakarta.xml.bind", "jakarta.xml.bind-api" ).versionRef( jaxbApiVersion ) + library( "jaxb", "org.glassfish.jaxb", "jaxb-runtime" ).versionRef( jaxbRuntimeVersion ) + library( "xjc", "org.glassfish.jaxb", "jaxb-xjc" ).versionRef( xjcVersion ) + library( "el", "org.glassfish.expressly", "expressly" ).versionRef( elVersion ) } testLibs { - def junit5Version = "5.9.2" - def junit4Version = "4.13.2" + def junit5Version = version "junit5", "5.9.2" + def junit4Version = version "junit4", "4.13.2" - def assertjVersion = "3.22.0" - def bytemanVersion = "4.0.20" - def jbossJtaVersion = "7.0.0.Final" - def jbossTxSpiVersion = "8.0.0.Final" - def log4jVersion = "2.17.1" - def mockitoVersion = "5.2.0" + def assertjVersion = version "assertj", "3.22.0" + def bytemanVersion = version "byteman", "4.0.20" + def jbossJtaVersion = version "jbossJta", "7.0.0.Final" + def jbossTxSpiVersion = version "jbossTxSpi", "8.0.0.Final" + def log4jVersion = version "log4j", "2.17.1" + def mockitoVersion = version "mockito", "5.2.0" //Compatible with JDK20 - def shrinkwrapVersion = "1.2.6" - def shrinkwrapDescriptorsVersion = "2.0.0" - def weldVersion = "4.0.1.SP1" - def wildFlyTxnClientVersion = "2.0.0.Final" - def xapoolVersion = "1.5.0" + def shrinkwrapVersion = version "shrinkwrap", "1.2.6" + def shrinkwrapDescriptorsVersion = version "shrinkwrapDescriptors", "2.0.0" + def weldVersion = version "weld", "4.0.1.SP1" + def wildFlyTxnClientVersion = version "wildFlyTxnClient", "2.0.0.Final" + def xapoolVersion = version "xapool", "1.5.0" - library( "junit5Api", "org.junit.jupiter", "junit-jupiter-api" ).version( junit5Version ) - library( "junit5Engine", "org.junit.jupiter", "junit-jupiter-engine" ).version( junit5Version ) - library( "junit5Params", "org.junit.jupiter", "junit-jupiter-params" ).version( junit5Version ) - library( "junit4Engine", "org.junit.vintage", "junit-vintage-engine" ).version( junit5Version ) - library( "junit4", "junit", "junit" ).version( junit4Version ) + library( "junit5Api", "org.junit.jupiter", "junit-jupiter-api" ).versionRef( junit5Version ) + library( "junit5Engine", "org.junit.jupiter", "junit-jupiter-engine" ).versionRef( junit5Version ) + library( "junit5Params", "org.junit.jupiter", "junit-jupiter-params" ).versionRef( junit5Version ) + library( "junit4Engine", "org.junit.vintage", "junit-vintage-engine" ).versionRef( junit5Version ) + library( "junit4", "junit", "junit" ).versionRef( junit4Version ) - library( "assertjCore", "org.assertj", "assertj-core" ).version( assertjVersion ) - library( "assertjApi", "org.assertj", "assertj-core-api" ).version( assertjVersion ) + library( "assertjCore", "org.assertj", "assertj-core" ).versionRef( assertjVersion ) + library( "assertjApi", "org.assertj", "assertj-core-api" ).versionRef( assertjVersion ) - library( "log4j2", "org.apache.logging.log4j", "log4j-core" ).version( log4jVersion ) + library( "log4j2", "org.apache.logging.log4j", "log4j-core" ).versionRef( log4jVersion ) - library( "shrinkwrap", "org.jboss.shrinkwrap", "shrinkwrap-impl-base" ).version( shrinkwrapVersion ) - library( "shrinkwrapApi", "org.jboss.shrinkwrap", "shrinkwrap-api" ).version( shrinkwrapVersion ) - library( "shrinkwrapDescriptors", "org.jboss.shrinkwrap.descriptors", "shrinkwrap-descriptors-impl-javaee" ).version( shrinkwrapDescriptorsVersion ) - library( "shrinkwrapDescriptorsApi", "org.jboss.shrinkwrap.descriptors", "shrinkwrap-descriptors-api-javaee" ).version( shrinkwrapDescriptorsVersion ) + library( "shrinkwrap", "org.jboss.shrinkwrap", "shrinkwrap-impl-base" ).versionRef( shrinkwrapVersion ) + library( "shrinkwrapApi", "org.jboss.shrinkwrap", "shrinkwrap-api" ).versionRef( shrinkwrapVersion ) + library( "shrinkwrapDescriptors", "org.jboss.shrinkwrap.descriptors", "shrinkwrap-descriptors-impl-javaee" ).versionRef( shrinkwrapDescriptorsVersion ) + library( "shrinkwrapDescriptorsApi", "org.jboss.shrinkwrap.descriptors", "shrinkwrap-descriptors-api-javaee" ).versionRef( shrinkwrapDescriptorsVersion ) - library( "byteman", "org.jboss.byteman", "byteman" ).version( bytemanVersion ) - library( "bytemanInstall", "org.jboss.byteman", "byteman-install" ).version( bytemanVersion ) - library( "bytemanBmunit", "org.jboss.byteman", "byteman-bmunit" ).version( bytemanVersion ) + library( "byteman", "org.jboss.byteman", "byteman" ).versionRef( bytemanVersion ) + library( "bytemanInstall", "org.jboss.byteman", "byteman-install" ).versionRef( bytemanVersion ) + library( "bytemanBmunit", "org.jboss.byteman", "byteman-bmunit" ).versionRef( bytemanVersion ) - library( "mockito", "org.mockito", "mockito-core" ).version( mockitoVersion ) - library( "mockitoInline", "org.mockito", "mockito-inline" ).version( mockitoVersion ) + library( "mockito", "org.mockito", "mockito-core" ).versionRef( mockitoVersion ) + library( "mockitoInline", "org.mockito", "mockito-inline" ).versionRef( mockitoVersion ) - library( "xapool", "com.experlog", "xapool" ).version( xapoolVersion ) - library( "jbossJta", "org.jboss.narayana.jta", "narayana-jta" ).version( jbossJtaVersion ) - library( "jbossTxSpi", "org.jboss", "jboss-transaction-spi" ).version( jbossTxSpiVersion ) - library( "wildFlyTxnClient", "org.wildfly.transaction", "wildfly-transaction-client-jakarta" ).version( wildFlyTxnClientVersion ) + library( "xapool", "com.experlog", "xapool" ).versionRef( xapoolVersion ) + library( "jbossJta", "org.jboss.narayana.jta", "narayana-jta" ).versionRef( jbossJtaVersion ) + library( "jbossTxSpi", "org.jboss", "jboss-transaction-spi" ).versionRef( jbossTxSpiVersion ) + library( "wildFlyTxnClient", "org.wildfly.transaction", "wildfly-transaction-client-jakarta" ).versionRef( wildFlyTxnClientVersion ) - library( "weld", "org.jboss.weld.se", "weld-se-shaded" ).version( weldVersion ) + library( "weld", "org.jboss.weld.se", "weld-se-shaded" ).versionRef( weldVersion ) } dbLibs { - def h2Version = overrideableVersion( "gradle.libs.versions.h2", "2.2.220" ) + def h2Version = version "h2", overrideableVersion( "gradle.libs.versions.h2", "2.2.220" ) - def db2Version = "11.5.8.0" + def db2Version = version "db2", "11.5.8.0" // Latest Derby version 10.16.1.1 only supports JDK 17+, but 10.15.2 should be compatible - def derbyVersion = overrideableVersion( "gradle.libs.versions.derby", "10.15.2.0" ) - def firebirdVersion = "4.0.8.java11" - def hanaVersion = "2.16.14" - def h2gisVersion = overrideableVersion( "gradle.libs.versions.h2gis", "2.2.0" ) - def hsqldbVersion = overrideableVersion( "gradle.libs.versions.hsqldb", "2.7.2" ) - def informixVersion = "4.10.12" - def mariadbVersion = "2.7.9" - def mssqlVersion = "12.2.0.jre11" - def mysqlVersion = "8.0.33" - def oracleVersion = "23.2.0.0" - def pgsqlVersion = "42.6.0" - def sybaseVersion = "1.3.1" - def tidbVersion = mysqlVersion + def derbyVersion = version "dervy", overrideableVersion( "gradle.libs.versions.derby", "10.15.2.0" ) + def firebirdVersion = version "firebird", "4.0.8.java11" + def hanaVersion = version "hana", "2.16.14" + def h2gisVersion = version "h2gis", overrideableVersion( "gradle.libs.versions.h2gis", "2.2.0" ) + def hsqldbVersion = version "hsqldb", overrideableVersion( "gradle.libs.versions.hsqldb", "2.7.2" ) + def informixVersion = version "informix", "4.10.12" + def mariadbVersion = version "mariadb", "2.7.9" + def mssqlVersion = version "mssql", "12.2.0.jre11" + def mysqlVersion = version "mysql", "8.0.33" + def oracleVersion = version "oracle", "23.2.0.0" + def pgsqlVersion = version "pgsql", "42.6.0" + def sybaseVersion = version "sybase", "1.3.1" + def tidbVersion = version "tidb", mysqlVersion - library( "h2", "com.h2database", "h2" ).version( h2Version ) - library( "h2gis", "org.orbisgis", "h2gis" ).version( h2gisVersion ) - library( "hsqldb", "org.hsqldb", "hsqldb" ).version( hsqldbVersion ) - library( "derby", "org.apache.derby", "derby" ).version( derbyVersion ) - library( "postgresql", "org.postgresql", "postgresql" ).version( pgsqlVersion ) - library( "cockroachdb", "org.postgresql", "postgresql" ).version( pgsqlVersion ) - library( "mysql", "com.mysql", "mysql-connector-j" ).version( mysqlVersion ) - library( "tidb", "com.mysql", "mysql-connector-j" ).version( tidbVersion ) - library( "mariadb", "org.mariadb.jdbc", "mariadb-java-client" ).version( mariadbVersion ) - library( "oracle", "com.oracle.database.jdbc", "ojdbc11" ).version( oracleVersion ) - library( "oracleXml", "com.oracle.database.xml", "xdb" ).version( oracleVersion ) - library( "oracleXmlParser", "com.oracle.database.xml", "xmlparserv2" ).version( oracleVersion ) - library( "mssql", "com.microsoft.sqlserver", "mssql-jdbc" ).version( mssqlVersion ) - library( "db2", "com.ibm.db2", "jcc" ).version( db2Version ) - library( "hana", "com.sap.cloud.db.jdbc", "ngdbc" ).version( hanaVersion ) - library( "sybase", "net.sourceforge.jtds", "jtds" ).version( sybaseVersion ) - library( "informix", "com.ibm.informix", "jdbc" ).version( informixVersion ) - library( "firebird", "org.firebirdsql.jdbc", "jaybird" ).version( firebirdVersion ) + library( "h2", "com.h2database", "h2" ).versionRef( h2Version ) + library( "h2gis", "org.orbisgis", "h2gis" ).versionRef( h2gisVersion ) + library( "hsqldb", "org.hsqldb", "hsqldb" ).versionRef( hsqldbVersion ) + library( "derby", "org.apache.derby", "derby" ).versionRef( derbyVersion ) + library( "postgresql", "org.postgresql", "postgresql" ).versionRef( pgsqlVersion ) + library( "cockroachdb", "org.postgresql", "postgresql" ).versionRef( pgsqlVersion ) + library( "mysql", "com.mysql", "mysql-connector-j" ).versionRef( mysqlVersion ) + library( "tidb", "com.mysql", "mysql-connector-j" ).versionRef( tidbVersion ) + library( "mariadb", "org.mariadb.jdbc", "mariadb-java-client" ).versionRef( mariadbVersion ) + library( "oracle", "com.oracle.database.jdbc", "ojdbc11" ).versionRef( oracleVersion ) + library( "oracleXml", "com.oracle.database.xml", "xdb" ).versionRef( oracleVersion ) + library( "oracleXmlParser", "com.oracle.database.xml", "xmlparserv2" ).versionRef( oracleVersion ) + library( "mssql", "com.microsoft.sqlserver", "mssql-jdbc" ).versionRef( mssqlVersion ) + library( "db2", "com.ibm.db2", "jcc" ).versionRef( db2Version ) + library( "hana", "com.sap.cloud.db.jdbc", "ngdbc" ).versionRef( hanaVersion ) + library( "sybase", "net.sourceforge.jtds", "jtds" ).versionRef( sybaseVersion ) + library( "informix", "com.ibm.informix", "jdbc" ).versionRef( informixVersion ) + library( "firebird", "org.firebirdsql.jdbc", "jaybird" ).versionRef( firebirdVersion ) } mavenLibs { - def mavenCoreVersion = "3.8.1" - def mavenVersion = "3.0.5" - def mavenPluginToolsVersion = "3.2" + def mavenCoreVersion = version "mavenCore", "3.8.1" + def mavenVersion = version "maven", "3.0.5" + def mavenPluginToolsVersion = version "mavenPluginTools", "3.2" - library( "mavenCore", "org.apache.maven", "maven-core" ).version( mavenCoreVersion ) - library( "mavenArtifact", "org.apache.maven", "maven-artifact" ).version( mavenVersion ) - library( "mavenPlugin", "org.apache.maven", "maven-plugin-api" ).version( mavenVersion ) - library( "mavenPluginTools", "org.apache.maven.plugin-tools", "maven-plugin-annotations" ).version( mavenPluginToolsVersion ) + library( "mavenCore", "org.apache.maven", "maven-core" ).versionRef( mavenCoreVersion ) + library( "mavenArtifact", "org.apache.maven", "maven-artifact" ).versionRef( mavenVersion ) + library( "mavenPlugin", "org.apache.maven", "maven-plugin-api" ).versionRef( mavenVersion ) + library( "mavenPluginTools", "org.apache.maven.plugin-tools", "maven-plugin-annotations" ).versionRef( mavenPluginToolsVersion ) } } }