import org.asciidoctor.gradle.jvm.AsciidoctorTask plugins { id 'org.asciidoctor.jvm.convert' version '3.3.2' } /* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ apply from: rootProject.file( 'gradle/java-module.gradle' ) apply from: rootProject.file( 'gradle/releasable.gradle' ) apply plugin: 'org.hibernate.matrix-test' apply plugin: 'org.hibernate.orm.build.reports' tasks.build.dependsOn 'buildDocs' defaultTasks 'buildDocs' dependencies { ext.pressgangVersion = '3.0.0' reportAggregation project( ':hibernate-agroal' ) reportAggregation project( ':hibernate-c3p0' ) reportAggregation project( ':hibernate-core' ) reportAggregation project(':hibernate-envers') reportAggregation project(':hibernate-graalvm') reportAggregation project(':hibernate-hikaricp') reportAggregation project(':hibernate-jcache') reportAggregation project(':hibernate-micrometer') reportAggregation project(':hibernate-proxool') reportAggregation project(':hibernate-spatial') reportAggregation project(':hibernate-vibur') reportAggregation project(':hibernate-ant') reportAggregation project(':hibernate-enhance-maven-plugin') reportAggregation project(':hibernate-jpamodelgen') implementation project( ':hibernate-core' ) annotationProcessor project( ':hibernate-jpamodelgen' ) testImplementation project(':hibernate-testing') testImplementation project(':hibernate-envers') testImplementation project(':hibernate-spatial') testImplementation project(':hibernate-jcache') testImplementation project( path: ':hibernate-core', configuration: 'tests' ) testImplementation 'org.apache.commons:commons-lang3:3.4' testImplementation 'org.osgi:org.osgi.core:4.3.1' testImplementation testLibs.mockito testImplementation testLibs.mockitoInline testImplementation jakartaLibs.jaxbApi testImplementation jakartaLibs.jaxb testImplementation jakartaLibs.jsonb testImplementation libs.jacksonXml testRuntimeOnly testLibs.wildFlyTxnClient testRuntimeOnly(libs.ehcache3) { capabilities { requireCapability 'org.ehcache.modules:ehcache-xml-jakarta' } } // Needed for JSON tests testRuntimeOnly libs.jackson } if ( project.ormVersion.isSnapshot ) { // only run the ci build tasks for SNAPSHOT versions task ciBuild( dependsOn: [clean, test] ) tasks.release.enabled false } else { tasks.release.dependsOn clean, test } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // grouping tasks - declaration, see below for task dependency definitions // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ task buildDocs { group 'Documentation' description 'Grouping task for performing all documentation building tasks' } task buildDocsForPublishing { group 'Documentation' description 'Grouping task for building all documentation for publishing (release)' } asciidoctorj { attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', majorMinorVersion: rootProject.ormVersion.family, fullVersion: rootProject.ormVersion.fullName options logDocuments: true } // Topical Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ task renderTopicalGuides(type: AsciidoctorTask, group: 'Documentation') {task-> description = 'Renders the Topical Guides in HTML format using Asciidoctor.' tasks.buildDocs.dependsOn task tasks.buildDocsForPublishing.dependsOn task sourceDir = file( 'src/main/asciidoc/topical' ) outputDir = new File("$buildDir/asciidoc/topical/html_single") resources { from('src/main/asciidoc/topical/') { include '**/images/**' } } } // Getting Started Guides (quick starts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ task renderGettingStartedGuides(type: AsciidoctorTask, group: 'Documentation') {task-> description = 'Renders the Getting Started Guides (quick starts) in HTML format using Asciidoctor.' tasks.buildDocs.dependsOn task tasks.buildDocsForPublishing.dependsOn task sourceDir = file( 'src/main/asciidoc/quickstart/guides' ) sources { include 'index.adoc' } outputDir = new File("$buildDir/asciidoc/quickstart/html_single") } task buildTutorialZip(type: Zip) {task-> from 'src/main/asciidoc/quickstart/tutorials' destinationDirectory = tasks.renderGettingStartedGuides.outputDir archiveFileName = 'hibernate-tutorials.zip' expand( version: project.version, slf4j: "1.7.5", junit: testLibs.versions.junit4.get(), h2: dbLibs.versions.h2.get() ) tasks.renderGettingStartedGuides.dependsOn task } // User Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') {task-> description = 'Renders the User Guides in HTML format using Asciidoctor.' tasks.buildDocs.dependsOn task tasks.buildDocsForPublishing.dependsOn task 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/" resources { from('src/main/asciidoc/userguide/') { include 'images/**' } from('src/main/style/asciidoctor') { include 'images/**' } from('src/main/style/asciidoctor') { include 'css/**' } from('src/main/style/asciidoctor') { include 'js/**' } } } // Integration Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ task renderIntegrationGuide(type: AsciidoctorTask, group: 'Documentation') {task-> description = 'Renders the User Guides in HTML format using Asciidoctor.' tasks.buildDocs.dependsOn task tasks.buildDocsForPublishing.dependsOn task sourceDir = file( 'src/main/asciidoc/integrationguide' ) sources { include 'Hibernate_Integration_Guide.adoc' } outputDir = project.layout.buildDirectory.dir( 'asciidoc/integrationguide/html_single' ) attributes linkcss: true, stylesheet: "css/hibernate.css" resources { from('src/main/asciidoc/integrationguide/') { include 'images/**' } from('src/main/style/asciidoctor') { include 'images/**' } from('src/main/style/asciidoctor') { include 'css/**' } } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Migration Guide task renderMigrationGuide(type: AsciidoctorTask, group: 'Documentation') {task-> description = 'Renders the Migration Guide in HTML format using Asciidoctor.' tasks.buildDocs.dependsOn task tasks.buildDocsForPublishing.dependsOn task sourceDir = rootProject.layout.projectDirectory sources { include 'migration-guide.adoc' } outputDir = project.layout.buildDirectory.dir( 'asciidoc/migration-guide' ) attributes linkcss: true, stylesheet: "css/hibernate.css" resources { from('src/main/style/asciidoctor') { include 'images/**' } from('src/main/style/asciidoctor') { include 'css/**' } } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ORM Reports task renderOrmReports { task -> group 'Documentation' description 'Grouping task for rendering all ORM reports' dependsOn tasks.generateIncubationReport dependsOn tasks.generateInternalsReport tasks.buildDocs.dependsOn task tasks.buildDocsForPublishing.dependsOn task } task renderLoggingReport(type: AsciidoctorTask, group: 'Documentation') { task -> group 'Documentation' description = 'Renders the ORM logging report in HTML format using Asciidoctor.' dependsOn tasks.generateLoggingReport tasks.renderOrmReports.dependsOn task sourceDir = layout.buildDirectory.dir( 'orm/reports' ) sources { include 'logging.adoc' } outputDir = project.layout.buildDirectory.dir( 'asciidoc/logging' ) attributes linkcss: true, stylesheet: "css/hibernate.css" resources { from('src/main/style/asciidoctor') { include 'images/**' } from('src/main/style/asciidoctor') { include 'css/**' } } } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tasks.withType(AsciidoctorTask).all { baseDirFollowsSourceDir() outputOptions { separateOutputDirs = false backends 'html5' } } // resources inherently exclude sources sourceSets.test.resources { setSrcDirs( ['src/test/java','src/test/resources'] ) } checkstyleMain.exclude '**/org/hibernate/userguide/model/*'