2015-07-14 15:46:02 -04:00
|
|
|
import org.asciidoctor.gradle.AsciidoctorTask
|
2015-05-19 00:23:35 -04:00
|
|
|
/*
|
|
|
|
* 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>.
|
|
|
|
*/
|
2011-03-22 11:39:53 -04:00
|
|
|
buildscript {
|
2013-11-21 14:46:03 -05:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
2015-07-14 15:46:02 -04:00
|
|
|
|
2013-11-21 14:46:03 -05:00
|
|
|
maven {
|
|
|
|
name 'jboss-nexus'
|
|
|
|
url "http://repository.jboss.org/nexus/content/groups/public/"
|
|
|
|
}
|
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
2013-11-22 15:51:56 -05:00
|
|
|
classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.2"
|
2015-07-14 15:46:02 -04:00
|
|
|
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
|
2013-11-21 14:46:03 -05:00
|
|
|
}
|
2011-03-22 11:39:53 -04:00
|
|
|
}
|
2011-03-29 16:14:09 -04:00
|
|
|
|
|
|
|
apply plugin: "java"
|
2011-03-22 11:39:53 -04:00
|
|
|
apply plugin: "jdocbook"
|
2015-07-14 15:46:02 -04:00
|
|
|
apply plugin: 'org.asciidoctor.convert'
|
|
|
|
|
2016-02-18 04:16:46 -05:00
|
|
|
apply plugin: 'hibernate-matrix-testing'
|
|
|
|
|
2013-12-02 21:53:19 -05:00
|
|
|
apply from: "${rootProject.projectDir}/utilities.gradle"
|
2013-10-14 21:12:47 -04:00
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
defaultTasks 'buildDocs'
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
asciidoclet {
|
|
|
|
description = 'Dependencies for Asciidoclet (the javadoc doclet tool for using Asciidoc)'
|
|
|
|
}
|
2016-01-11 10:25:13 -05:00
|
|
|
//asciidoctor
|
2013-11-22 15:51:56 -05:00
|
|
|
}
|
2013-10-14 21:12:47 -04:00
|
|
|
|
2015-03-24 21:38:39 -04:00
|
|
|
if ( JavaVersion.current().isJava8Compatible() ) {
|
|
|
|
tasks.withType( Javadoc ) {
|
|
|
|
options.addStringOption( 'Xdoclint:none', '-quiet' )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-22 11:39:53 -04:00
|
|
|
dependencies {
|
2016-02-08 10:33:09 -05:00
|
|
|
ext.pressgangVersion = '3.0.0'
|
2013-11-22 15:51:56 -05:00
|
|
|
|
2016-02-08 10:33:09 -05:00
|
|
|
// asciidoctor 'org.asciidoctor:asciidoctorj:1.5.2'
|
|
|
|
asciidoclet 'org.asciidoctor:asciidoclet:0.+'
|
2013-11-22 15:51:56 -05:00
|
|
|
|
2016-02-08 10:33:09 -05:00
|
|
|
jdocbookXsl "org.jboss.pressgang:pressgang-xslt-ns:${pressgangVersion}"
|
|
|
|
jdocbookXsl "org.jboss.pressgang:pressgang-fonts:${pressgangVersion}"
|
|
|
|
jdocbookStyles "org.jboss.pressgang:pressgang-jdocbook-style:${pressgangVersion}"
|
|
|
|
|
|
|
|
compile( libraries.jpa )
|
|
|
|
compile( project( ':hibernate-jpamodelgen' ) )
|
|
|
|
|
|
|
|
testCompile( 'org.apache.commons:commons-lang3:3.4' )
|
2011-03-29 16:14:09 -04:00
|
|
|
|
2016-01-13 01:28:20 -05:00
|
|
|
testCompile( project(':hibernate-core') )
|
|
|
|
testCompile( project(':hibernate-entitymanager') )
|
2016-01-21 09:50:53 -05:00
|
|
|
testCompile( project(':hibernate-ehcache') )
|
2016-02-25 03:48:45 -05:00
|
|
|
testCompile( project(':hibernate-spatial') )
|
2016-01-13 01:28:20 -05:00
|
|
|
|
|
|
|
testCompile( project(':hibernate-testing') )
|
|
|
|
testCompile( project(path: ':hibernate-entitymanager', configuration: 'tests') )
|
2016-02-08 10:33:09 -05:00
|
|
|
|
2016-01-13 01:28:20 -05:00
|
|
|
testRuntime( libraries.h2 )
|
|
|
|
}
|
2013-11-22 15:51:56 -05:00
|
|
|
|
2016-02-11 16:59:13 -05:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// grouping tasks - declaration, see below for task dependency definitions
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
task buildDocs {
|
2016-02-11 16:59:13 -05:00
|
|
|
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)'
|
2013-11-22 15:51:56 -05:00
|
|
|
}
|
|
|
|
|
2016-02-11 16:59:13 -05:00
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// aggregated JavaDoc
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-11-22 15:51:56 -05:00
|
|
|
|
|
|
|
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 copyrightYear = new GregorianCalendar().get( Calendar.YEAR );
|
|
|
|
|
|
|
|
// exclude any generated sources (this is not working: http://forums.gradle.org/gradle/topics/excluding_generated_source_from_javadoc)
|
|
|
|
exclude "**/generated-src/**"
|
|
|
|
|
|
|
|
// process each project, building up:
|
|
|
|
// 1) appropriate sources
|
|
|
|
// 2) classpath
|
|
|
|
// 3) the package list for groups
|
|
|
|
Set<String> apiPackages = new HashSet<String>()
|
|
|
|
Set<String> spiPackages = new HashSet<String>()
|
|
|
|
Set<String> internalPackages = new HashSet<String>()
|
|
|
|
parent.subprojects.each{ Project subProject->
|
|
|
|
// skip certain sub-projects
|
2013-12-02 21:53:19 -05:00
|
|
|
if ( ['release','documentation'].contains( subProject.name ) ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// we only care about the main SourceSet...
|
|
|
|
source subProject.sourceSets.main.java
|
|
|
|
|
|
|
|
if( classpath ) {
|
|
|
|
classpath += subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
classpath = subProject.sourceSets.main.output + subProject.sourceSets.main.compileClasspath
|
|
|
|
}
|
|
|
|
|
|
|
|
subProject.sourceSets.main.java.each { javaFile ->
|
|
|
|
final String packageName = determinePackageName( subProject.sourceSets.main.java, javaFile );
|
|
|
|
if ( packageName.endsWith( ".internal" ) || packageName.contains( ".internal." ) ) {
|
|
|
|
internalPackages.add( packageName );
|
|
|
|
}
|
|
|
|
else if ( packageName.endsWith( ".spi" ) || packageName.contains( ".spi." ) ) {
|
|
|
|
spiPackages.add( packageName );
|
|
|
|
}
|
|
|
|
else if ( packageName.startsWith( "org.hibernate.testing" ) ) {
|
|
|
|
// do nothing as testing support is already handled...
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
apiPackages.add( packageName );
|
|
|
|
}
|
|
|
|
}
|
2013-11-22 15:51:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// apply standard config
|
|
|
|
maxMemory = '512m'
|
|
|
|
destinationDir = javadocDir
|
|
|
|
configure( options ) {
|
|
|
|
overview = rootProject.file( 'shared/javadoc/overview.html' )
|
|
|
|
stylesheetFile = rootProject.file( 'shared/javadoc/stylesheet.css' )
|
|
|
|
windowTitle = 'Hibernate JavaDocs'
|
|
|
|
docTitle = "Hibernate JavaDoc ($project.version)"
|
|
|
|
bottom = "Copyright © 2001-$copyrightYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."
|
|
|
|
use = true
|
2015-03-24 21:38:39 -04:00
|
|
|
options.encoding = 'UTF-8'
|
2013-11-22 15:51:56 -05:00
|
|
|
links = [ 'http://download.oracle.com/javase/6/docs/api/', 'http://download.oracle.com/javaee/6/api/' ]
|
|
|
|
group( 'API', apiPackages.asList() )
|
|
|
|
group( 'SPI', spiPackages.asList() )
|
|
|
|
group( 'Internal', internalPackages.asList() )
|
|
|
|
group ( 'Testing Support', ['org.hibernate.testing*'] )
|
|
|
|
// ugh, http://issues.gradle.org/browse/GRADLE-1563
|
|
|
|
// tags ["todo:X"]
|
|
|
|
// work around:
|
|
|
|
addStringOption( "tag", "todo:X" )
|
|
|
|
}
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
copy {
|
|
|
|
from rootProject.file( 'shared/javadoc/images' )
|
|
|
|
into new File( javadocDir, "/images" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// jDocBook ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2011-03-29 16:14:09 -04:00
|
|
|
|
2011-03-22 11:39:53 -04:00
|
|
|
jdocbook {
|
2013-11-22 15:51:56 -05:00
|
|
|
// shared config
|
|
|
|
format('html_single') {
|
|
|
|
finalName = "index.html"
|
|
|
|
stylesheet = "classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl"
|
|
|
|
}
|
|
|
|
format('html') {
|
|
|
|
finalName = "index.html"
|
|
|
|
stylesheet = "classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl"
|
|
|
|
}
|
2013-10-25 15:53:32 -04:00
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
// book-specific config
|
2015-08-05 00:03:21 -04:00
|
|
|
userGuide {
|
|
|
|
masterSourceDocumentName = 'Hibernate_User_Guide.xml'
|
2013-11-22 15:51:56 -05:00
|
|
|
}
|
2015-08-05 00:03:21 -04:00
|
|
|
integrationsGuide {
|
|
|
|
masterSourceDocumentName = 'Hibernate_Integrations_Guide.xml'
|
2015-07-28 16:35:41 -04:00
|
|
|
}
|
2015-08-05 00:03:21 -04:00
|
|
|
mappingGuide {
|
|
|
|
masterSourceDocumentName = 'Hibernate_Mapping_Guide.xml'
|
2015-07-28 16:35:41 -04:00
|
|
|
}
|
2011-03-29 16:14:09 -04:00
|
|
|
}
|
|
|
|
|
2015-08-05 00:03:21 -04:00
|
|
|
[ 'integrationsGuide', 'userGuide', 'mappingGuide'].each { bookName ->
|
2013-11-22 15:51:56 -05:00
|
|
|
task "stageLocalStyles_$bookName"(type: Copy) {
|
|
|
|
into project.file( "target/docbook/stage/$bookName" )
|
|
|
|
from project.file( 'src/main/style' )
|
|
|
|
includeEmptyDirs = false
|
|
|
|
}
|
2015-07-28 16:35:41 -04:00
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
tasks[ "stageStyles_$bookName" ].dependsOn "stageLocalStyles_$bookName"
|
2015-07-28 16:35:41 -04:00
|
|
|
|
|
|
|
tasks[ "stageStyles_$bookName" ].doLast {
|
|
|
|
logger.lifecycle( "Staging devguide-specific style resources")
|
|
|
|
copy {
|
|
|
|
into project.file( "target/docbook/stage/$bookName/images" )
|
|
|
|
from project.file( "src/main/docbook/$bookName/en-US" )
|
|
|
|
include '**/images/*.png'
|
|
|
|
include '**/images/*.svg'
|
|
|
|
includeEmptyDirs = false
|
|
|
|
}
|
|
|
|
}
|
2012-02-15 17:31:29 -05:00
|
|
|
}
|
|
|
|
|
2015-07-14 15:46:02 -04:00
|
|
|
|
|
|
|
asciidoctor {
|
|
|
|
// we do not want it creating its "default task"
|
|
|
|
enabled = false
|
2011-03-29 16:14:09 -04:00
|
|
|
}
|
|
|
|
|
2015-07-14 15:46:02 -04:00
|
|
|
// Topical Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2011-03-29 16:14:09 -04:00
|
|
|
|
2015-07-14 15:46:02 -04:00
|
|
|
task renderTopicalGuides(type: AsciidoctorTask, group: 'Documentation') {
|
|
|
|
description = 'Renders the Topical Guides in HTML format using Asciidoctor.'
|
|
|
|
sourceDir = file( 'src/main/asciidoc/topical' )
|
2016-02-11 16:59:13 -05:00
|
|
|
outputDir = new File("$buildDir/asciidoc/topical/html_single")
|
2015-07-14 15:46:02 -04:00
|
|
|
backends "html5"
|
|
|
|
separateOutputDirs false
|
|
|
|
options logDocuments: true
|
|
|
|
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify'
|
2011-03-29 16:14:09 -04:00
|
|
|
}
|
|
|
|
|
2013-10-14 21:12:47 -04:00
|
|
|
|
2015-07-14 15:46:02 -04:00
|
|
|
// Getting Started Guides (quick starts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-11-22 15:51:56 -05:00
|
|
|
|
2015-07-14 15:46:02 -04:00
|
|
|
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' )
|
2016-02-11 16:59:13 -05:00
|
|
|
outputDir = new File("$buildDir/asciidoc/quickstart/html_single")
|
2015-07-14 15:46:02 -04:00
|
|
|
backends "html5"
|
|
|
|
separateOutputDirs false
|
|
|
|
options logDocuments: true
|
|
|
|
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify'
|
2013-10-31 07:08:36 -04:00
|
|
|
}
|
|
|
|
|
2016-02-11 16:59:13 -05:00
|
|
|
|
|
|
|
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: parent.junitVersion,
|
|
|
|
h2: parent.h2Version
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
renderGettingStartedGuides.dependsOn buildTutorialZip
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-01-11 10:25:13 -05:00
|
|
|
// Mapping Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
task renderMappingGuide(type: AsciidoctorTask, group: 'Documentation') {
|
|
|
|
description = 'Renders the Mapping Guides in HTML format using Asciidoctor.'
|
|
|
|
sourceDir = file( 'src/main/asciidoc/mapping' )
|
|
|
|
outputDir = new File("$buildDir/asciidoc/mapping/html")
|
|
|
|
backends "html5"
|
|
|
|
separateOutputDirs false
|
|
|
|
options logDocuments: true
|
|
|
|
//attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css"
|
|
|
|
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true
|
|
|
|
resources {
|
|
|
|
from('src/main/asciidoc/') {
|
|
|
|
include 'images/**'
|
|
|
|
include 'css/**'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// User Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2016-02-29 07:22:34 -05:00
|
|
|
final String[] versionComponents = version.split( '\\.' );
|
|
|
|
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];
|
|
|
|
|
2016-01-11 10:25:13 -05:00
|
|
|
task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') {
|
|
|
|
description = 'Renders the User Guides in HTML format using Asciidoctor.'
|
|
|
|
sourceDir = file( 'src/main/asciidoc/userguide' )
|
2016-02-11 16:59:13 -05:00
|
|
|
outputDir = new File("$buildDir/asciidoc/userguide/html_single")
|
2016-01-11 10:25:13 -05:00
|
|
|
backends "html5"
|
|
|
|
separateOutputDirs false
|
|
|
|
options logDocuments: true
|
2016-02-29 08:06:03 -05:00
|
|
|
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: majorMinorVersion
|
2016-01-11 10:25:13 -05:00
|
|
|
resources {
|
|
|
|
from('src/main/asciidoc/userguide/') {
|
|
|
|
include 'images/**'
|
|
|
|
}
|
2016-03-02 08:16:13 -05:00
|
|
|
from('src/main/style/asciidoctor') {
|
|
|
|
include 'images/**'
|
|
|
|
}
|
2016-02-29 08:06:03 -05:00
|
|
|
from('src/main/style/asciidoctor') {
|
|
|
|
include 'css/**'
|
|
|
|
}
|
2016-01-11 10:25:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-02-11 16:59:13 -05:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// grouping tasks
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2015-07-14 15:46:02 -04:00
|
|
|
|
2016-02-11 16:59:13 -05:00
|
|
|
buildDocs.dependsOn aggregateJavadocs
|
|
|
|
buildDocs.dependsOn renderTopicalGuides
|
|
|
|
buildDocs.dependsOn renderGettingStartedGuides
|
|
|
|
buildDocs.dependsOn renderUserGuide
|
|
|
|
// the jDocBook plugin already adds its main task as a dependency of the buildDocs task
|
2013-10-31 07:08:36 -04:00
|
|
|
|
2015-07-14 15:46:02 -04:00
|
|
|
|
2016-02-11 16:59:13 -05:00
|
|
|
buildDocsForPublishing.dependsOn aggregateJavadocs
|
|
|
|
buildDocsForPublishing.dependsOn renderTopicalGuides
|
|
|
|
buildDocsForPublishing.dependsOn renderGettingStartedGuides
|
|
|
|
buildDocsForPublishing.dependsOn renderUserGuide
|
|
|
|
// only html-single to match what Asciidoctor currently offers
|
|
|
|
//buildDocsForPublishing.dependsOn 'renderDocBook_integrationsGuide_en-US_html_single '
|
|
|
|
buildDocsForPublishing.dependsOn renderDocBook_integrationsGuide
|