hibernate-orm/documentation/documentation.gradle

468 lines
13 KiB
Groovy

import org.asciidoctor.gradle.jvm.AsciidoctorTask
import org.asciidoctor.gradle.jvm.pdf.AsciidoctorPdfTask
plugins {
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id "org.asciidoctor.jvm.gems" version "3.3.2"
}
repositories {
mavenCentral()
ruby.gems()
}
/*
* 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
apply from: rootProject.file( 'gradle/module.gradle' )
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'
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')
asciidoctorGems 'rubygems:rouge:4.1.1'
}
if ( project.ormVersion.isSnapshot ) {
// only run the ci build tasks for SNAPSHOT versions
tasks.register('ciBuild') { dependsOn clean }
tasks.release.enabled false
}
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 {
pdf {
version '2.3.7'
}
}
attributes icons: 'font',
experimental: true,
'source-highlighter': 'rouge',
majorMinorVersion: rootProject.ormVersion.family,
fullVersion: rootProject.ormVersion.fullName
options logDocuments: true
}
// Topical Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tasks.register('renderTopicalGuides', 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")
resources {
from('src/main/asciidoc/topical/') {
include '**/images/**'
}
}
}
// Getting Started Guides (quick starts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tasks.register('renderGettingStartedGuides', 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")
attributes linkcss: true,
stylesheet: "css/hibernate.css",
docinfo: 'private',
jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/"
resources {
from('src/main/style/asciidoctor') {
include 'images/**'
}
from('src/main/style/asciidoctor') {
include 'css/**'
}
from('src/main/style/asciidoctor') {
include 'js/**'
}
}
}
tasks.register('renderGettingStartedGuidesPdf', 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"
attributes jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/"
}
tasks.register('buildTutorialZip', Zip) { task ->
from 'src/main/asciidoc/quickstart/tutorials'
destinationDirectory = tasks.renderGettingStartedGuides.outputDir
archiveFileName = 'hibernate-tutorials.zip'
expand(
version: project.version,
slf4j: "2.0.7",
junit: testLibs.versions.junit4.get(),
h2: dbLibs.versions.h2.get()
)
tasks.renderGettingStartedGuides.dependsOn task
}
// 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->
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'
}
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/"
resources {
from('src/main/asciidoc/introduction/') {
include 'images/**'
}
from('src/main/style/asciidoctor') {
include 'images/**'
}
from('src/main/style/asciidoctor') {
include 'css/**'
}
from('src/main/style/asciidoctor') {
include 'js/**'
}
}
}
// HQL Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tasks.register('renderQLPdf', 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' )
baseDir = file( 'src/main/asciidoc/querylanguage' )
sources {
include 'Hibernate_Query_Language.adoc'
}
outputDir = "$buildDir/asciidoc/querylanguage/pdf"
attributes jpaJavadocUrlPrefix: "https://javaee.github.io/javaee-spec/javadocs/javax/persistence/"
}
tasks.register('renderQL', AsciidoctorTask) {task->
group = "Documentation"
description = 'Renders the Query Language document in HTML format using Asciidoctor.'
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 ->
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"
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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tasks.register( "renderIntegrationGuide", AsciidoctorTask.class, 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' )
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
tasks.register( "renderMigrationGuide", AsciidoctorTask.class, 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
}
attributes linkcss: true,
stylesheet: "css/hibernate.css"
resources {
from('src/main/style/asciidoctor') {
include 'images/**'
}
from('src/main/style/asciidoctor') {
include 'css/**'
}
}
} )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ORM Reports
tasks.register('renderOrmReports') { task ->
group 'Documentation'
description 'Grouping task for rendering all ORM reports'
dependsOn tasks.generateIncubationReport
dependsOn tasks.generateInternalsReport
dependsOn tasks.generateDeprecationReport
tasks.buildDocs.dependsOn task
tasks.buildDocsForPublishing.dependsOn task
}
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
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.register('renderDialectReport', AsciidoctorTask) { task ->
group 'Documentation'
description = 'Renders the ORM Dialect report in HTML format using Asciidoctor.'
dependsOn tasks.generateDialectReport
dependsOn tasks.generateLoggingReport
tasks.renderOrmReports.dependsOn task
inputs.property "version", project.ormVersion
sourceDir = layout.buildDirectory.dir('orm/reports')
sources {
include 'dialect.adoc'
}
outputDir = project.layout.buildDirectory.dir('asciidoc/dialect')
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'
}
}