309 lines
9.7 KiB
Groovy
309 lines
9.7 KiB
Groovy
import org.apache.tools.ant.filters.ReplaceTokens
|
|
import org.asciidoctor.gradle.AsciidoctorTask
|
|
|
|
/*
|
|
* 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>.
|
|
*/
|
|
|
|
ext {
|
|
projectsToSkipWhenAggregatingJavadocs = [
|
|
'documentation',
|
|
'hibernate-entitymanager',
|
|
'hibernate-infinispan',
|
|
'hibernate-ehcache',
|
|
'hibernate-java8',
|
|
'hibernate-orm-modules',
|
|
'release'
|
|
]
|
|
}
|
|
|
|
rootProject.subprojects { subproject ->
|
|
if ( !this.projectsToSkipWhenAggregatingJavadocs.contains( subproject.name ) ) {
|
|
this.evaluationDependsOn( subproject.path )
|
|
}
|
|
}
|
|
|
|
apply from: rootProject.file( 'gradle/java-module.gradle' )
|
|
|
|
apply plugin: 'org.asciidoctor.convert'
|
|
|
|
apply plugin: 'hibernate-matrix-testing'
|
|
|
|
defaultTasks 'buildDocs'
|
|
|
|
|
|
dependencies {
|
|
ext.pressgangVersion = '3.0.0'
|
|
|
|
compile( libraries.jpa )
|
|
compile( project( ':hibernate-core' ) )
|
|
compile( project( ':hibernate-jpamodelgen' ) )
|
|
|
|
testCompile( 'org.apache.commons:commons-lang3:3.4' )
|
|
|
|
testCompile( project(':hibernate-envers') )
|
|
testCompile( project(':hibernate-spatial') )
|
|
testCompile( project(path: ':hibernate-core', configuration: 'tests') )
|
|
|
|
testCompile( project(':hibernate-testing') )
|
|
|
|
testCompile "org.osgi:org.osgi.core:4.3.1"
|
|
|
|
testCompile( libraries.mockito )
|
|
testCompile( libraries.mockito_inline )
|
|
|
|
testRuntime( libraries.wildfly_transaction_client )
|
|
testRuntime( libraries.h2 )
|
|
testRuntime( libraries.hsqldb )
|
|
testRuntime( libraries.postgresql )
|
|
testRuntime( libraries.mysql )
|
|
testRuntime( libraries.mariadb )
|
|
testRuntime( libraries.mssql )
|
|
testRuntime( libraries.hana )
|
|
|
|
testCompile( project( ':hibernate-jcache' ) )
|
|
testRuntime( libraries.ehcache3 )
|
|
}
|
|
|
|
|
|
if ( project.ormVersion.isSnapshot ) {
|
|
// only run the ci build tasks for SNAPSHOT versions
|
|
task ciBuild( dependsOn: [clean, test] )
|
|
}
|
|
else {
|
|
task 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)'
|
|
}
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// aggregated JavaDoc
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
final File javadocDir = mkdir( new File( (File) project.buildDir, 'javadocs' ) );
|
|
|
|
/**
|
|
* Builds the JavaDocs aggregated (unified) across all the sub-projects
|
|
*/
|
|
task aggregateJavadocs(type: Javadoc) {
|
|
description = 'Builds the aggregated (unified) JavaDocs across all sub-projects'
|
|
|
|
final int currentYear = new GregorianCalendar().get( Calendar.YEAR )
|
|
|
|
// exclude any generated sources and internal packages
|
|
exclude( '**/generated-src/**' )
|
|
exclude( '**/internal/**' )
|
|
|
|
|
|
// apply standard config
|
|
maxMemory = '512m'
|
|
destinationDir = javadocDir
|
|
configure( options ) {
|
|
overview = project.file( 'src/main/javadoc/overview.html' )
|
|
windowTitle = 'Hibernate JavaDocs'
|
|
docTitle = "Hibernate JavaDoc ($project.version)"
|
|
bottom = "Copyright © 2001-$currentYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."
|
|
use = true
|
|
options.encoding = 'UTF-8'
|
|
|
|
links = [
|
|
'https://docs.oracle.com/javase/8/docs/api/',
|
|
'http://docs.jboss.org/hibernate/beanvalidation/spec/2.0/api/',
|
|
'http://docs.jboss.org/cdi/api/2.0/',
|
|
'https://javaee.github.io/javaee-spec/javadocs/'
|
|
]
|
|
|
|
if ( JavaVersion.current().isJava11Compatible() ) {
|
|
//The need to set `--source 1.8` applies to all JVMs after 11, and also to 11
|
|
// but after excluding the first two builds; see also specific comments on
|
|
// https://bugs.openjdk.java.net/browse/JDK-8212233?focusedCommentId=14245762
|
|
// For now, let's be compatible with JDK 11.0.3+. We can improve on it if people
|
|
// complain they cannot build with JDK 11.0.0, 11.0.1 and 11.0.2.
|
|
System.out.println("Forcing Javadoc in Java 8 compatible mode");
|
|
options.source = project.baselineJavaVersion
|
|
}
|
|
|
|
options.addStringOption( 'Xdoclint:none', '-quiet' )
|
|
}
|
|
|
|
// process each project, building up:
|
|
// 1) appropriate sources
|
|
// 2) classpath
|
|
parent.subprojects.each { Project subProject->
|
|
// skip certain sub-projects
|
|
if ( ! projectsToSkipWhenAggregatingJavadocs.contains( subProject.name ) ) {
|
|
// we only care about the main SourceSet...
|
|
source subProject.sourceSets.main.java
|
|
|
|
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath + subProject.configurations.provided
|
|
}
|
|
}
|
|
}
|
|
|
|
asciidoctor {
|
|
// we do not want it creating its "default task"
|
|
enabled = false
|
|
}
|
|
|
|
// Topical Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
task renderTopicalGuides(type: AsciidoctorTask, group: 'Documentation') {
|
|
description = 'Renders the Topical Guides in HTML format using Asciidoctor.'
|
|
sourceDir = file( 'src/main/asciidoc/topical' )
|
|
outputDir = new File("$buildDir/asciidoc/topical/html_single")
|
|
backends "html5"
|
|
separateOutputDirs false
|
|
options logDocuments: true
|
|
attributes icons: 'font',
|
|
experimental: true,
|
|
'source-highlighter': 'prettify',
|
|
majorMinorVersion: rootProject.ormVersion.family,
|
|
fullVersion: rootProject.ormVersion.fullName
|
|
resources {
|
|
from('src/main/asciidoc/topical/') {
|
|
include '**/images/**'
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// Getting Started Guides (quick starts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
task renderGettingStartedGuides(type: AsciidoctorTask, group: 'Documentation') {
|
|
description = 'Renders the Getting Started Guides (quick starts) in HTML format using Asciidoctor.'
|
|
sourceDir = file( 'src/main/asciidoc/quickstart/guides' )
|
|
sources {
|
|
include 'index.adoc'
|
|
}
|
|
outputDir = new File("$buildDir/asciidoc/quickstart/html_single")
|
|
backends "html5"
|
|
separateOutputDirs false
|
|
options logDocuments: true
|
|
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify'
|
|
}
|
|
|
|
|
|
task buildTutorialZip(type: Zip) {
|
|
from 'src/main/asciidoc/quickstart/tutorials'
|
|
destinationDir = tasks.renderGettingStartedGuides.outputDir
|
|
archiveName = 'hibernate-tutorials.zip'
|
|
expand(
|
|
version: project.version,
|
|
slf4j: "1.7.5",
|
|
junit: project.junitVersion,
|
|
h2: project.h2Version
|
|
)
|
|
}
|
|
|
|
renderGettingStartedGuides.dependsOn buildTutorialZip
|
|
|
|
// User Guide ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') {
|
|
description = 'Renders the User Guides in HTML format using Asciidoctor.'
|
|
sourceDir = file( 'src/main/asciidoc/userguide' )
|
|
sources {
|
|
include 'Hibernate_User_Guide.adoc'
|
|
}
|
|
outputDir = new File("$buildDir/asciidoc/userguide/html_single")
|
|
backends "html5"
|
|
separateOutputDirs false
|
|
options logDocuments: true
|
|
attributes icons: 'font', experimental: true,
|
|
'source-highlighter': 'prettify',
|
|
linkcss: true,
|
|
stylesheet: "css/hibernate.css",
|
|
majorMinorVersion: rootProject.ormVersion.family,
|
|
fullVersion: rootProject.ormVersion.fullName,
|
|
docinfo: 'private'
|
|
|
|
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') {
|
|
description = 'Renders the User Guides in HTML format using Asciidoctor.'
|
|
sourceDir = file( 'src/main/asciidoc/integrationguide' )
|
|
sources {
|
|
include 'Hibernate_Integration_Guide.adoc'
|
|
}
|
|
outputDir = new File("$buildDir/asciidoc/integrationguide/html_single")
|
|
backends "html5"
|
|
separateOutputDirs false
|
|
options logDocuments: true
|
|
attributes icons: 'font',
|
|
experimental: true,
|
|
'source-highlighter': 'prettify',
|
|
linkcss: true,
|
|
stylesheet: "css/hibernate.css",
|
|
majorMinorVersion: rootProject.ormVersion.family
|
|
resources {
|
|
from('src/main/asciidoc/integrationguide/') {
|
|
include 'images/**'
|
|
}
|
|
from('src/main/style/asciidoctor') {
|
|
include 'images/**'
|
|
}
|
|
from('src/main/style/asciidoctor') {
|
|
include 'css/**'
|
|
}
|
|
}
|
|
}
|
|
|
|
// Testing
|
|
|
|
// resources inherently exclude sources
|
|
sourceSets.test.resources {
|
|
setSrcDirs( ['src/test/java','src/test/resources'] )
|
|
}
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// grouping tasks
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
buildDocs.dependsOn aggregateJavadocs
|
|
buildDocs.dependsOn renderTopicalGuides
|
|
buildDocs.dependsOn renderGettingStartedGuides
|
|
buildDocs.dependsOn renderUserGuide
|
|
buildDocs.dependsOn renderIntegrationGuide
|
|
|
|
buildDocsForPublishing.dependsOn aggregateJavadocs
|
|
buildDocsForPublishing.dependsOn renderTopicalGuides
|
|
buildDocsForPublishing.dependsOn renderGettingStartedGuides
|
|
buildDocsForPublishing.dependsOn renderUserGuide
|
|
buildDocsForPublishing.dependsOn renderIntegrationGuide
|
|
|
|
checkstyleMain.exclude '**/org/hibernate/userguide/model/*'
|
|
|