2011-03-22 11:39:53 -04:00
|
|
|
buildscript {
|
2013-11-21 14:46:03 -05:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
mavenLocal()
|
|
|
|
maven {
|
|
|
|
name 'jboss-nexus'
|
|
|
|
url "http://repository.jboss.org/nexus/content/groups/public/"
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name 'Bintray Asciidoctor repo'
|
|
|
|
url 'http://dl.bintray.com/content/aalmiray/asciidoctor'
|
|
|
|
}
|
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
2013-11-22 15:51:56 -05:00
|
|
|
classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.2"
|
2013-11-21 14:46:03 -05:00
|
|
|
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0'
|
|
|
|
}
|
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"
|
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)'
|
|
|
|
}
|
|
|
|
}
|
2013-10-14 21:12:47 -04:00
|
|
|
|
2011-03-22 11:39:53 -04:00
|
|
|
dependencies {
|
2013-11-22 15:51:56 -05:00
|
|
|
ext.pressgangVersion = '3.0.0'
|
|
|
|
|
|
|
|
asciidoclet 'org.asciidoctor:asciidoclet:0.+'
|
|
|
|
|
2012-03-07 21:38:55 -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}"
|
2011-03-22 11:39:53 -04:00
|
|
|
}
|
2011-03-29 16:14:09 -04:00
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
|
|
|
|
task buildDocs {
|
|
|
|
group 'Documentation'
|
|
|
|
description 'Grouping task for performing all documentation building tasks'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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 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
|
|
|
|
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" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
buildDocs.dependsOn aggregateJavadocs
|
|
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
quickstart {
|
|
|
|
masterSourceDocumentName = 'Hibernate_Getting_Started_Guide.xml'
|
|
|
|
}
|
|
|
|
|
|
|
|
devguide {
|
|
|
|
masterSourceDocumentName = 'Hibernate_Development_Guide.xml'
|
|
|
|
useRelativeImageUris = false
|
|
|
|
}
|
|
|
|
|
|
|
|
manual {
|
|
|
|
masterSourceDocumentName = 'HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.xml'
|
|
|
|
}
|
2011-03-29 16:14:09 -04:00
|
|
|
}
|
|
|
|
|
2012-02-01 13:22:06 -05:00
|
|
|
// todo : make this part of gradle-jdocbook.
|
|
|
|
// specifically the ability to supply ant-style resource for images (dir + include/exclude patterns)
|
|
|
|
stageStyles_devguide.doLast {
|
2012-02-15 17:31:29 -05:00
|
|
|
logger.lifecycle( "Staging devguide-specific style resources")
|
2012-02-01 13:22:06 -05:00
|
|
|
copy {
|
|
|
|
into project.file( 'target/docbook/stage/devguide/images' )
|
|
|
|
from project.file( 'src/main/docbook/devguide/en-US' )
|
|
|
|
include '**/images/*.png'
|
|
|
|
include '**/images/*.svg'
|
|
|
|
includeEmptyDirs = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-31 07:08:36 -04:00
|
|
|
[ 'devguide', 'manual', 'quickstart' ].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
|
|
|
|
}
|
|
|
|
tasks[ "stageStyles_$bookName" ].dependsOn "stageLocalStyles_$bookName"
|
2012-02-15 17:31:29 -05:00
|
|
|
}
|
|
|
|
|
2011-03-29 16:14:09 -04:00
|
|
|
task buildTutorialZip(type: Zip) {
|
|
|
|
destinationDir = file( "target/work/tutorials" )
|
|
|
|
archiveName = 'hibernate-tutorials.zip'
|
|
|
|
from 'src/main/docbook/quickstart/tutorials'
|
2011-12-30 13:15:23 -05:00
|
|
|
expand(
|
|
|
|
version: project.version,
|
2013-10-09 13:14:26 -04:00
|
|
|
slf4j: "1.7.5",
|
2011-12-30 13:15:23 -05:00
|
|
|
junit: parent.junitVersion,
|
|
|
|
h2: parent.h2Version
|
2011-03-29 16:14:09 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
buildDocs.dependsOn buildTutorialZip
|
|
|
|
|
|
|
|
buildDocs.doLast {
|
|
|
|
for ( File languageDir : dirList( "target/docbook/publish/quickstart" ) ) {
|
|
|
|
for ( File formatDir : dirList( languageDir ) ) {
|
|
|
|
final File copyDir = new File( formatDir, "files" );
|
|
|
|
copyDir.mkdirs();
|
|
|
|
ant.copy( file: buildTutorialZip.archivePath.getAbsolutePath(), todir: copyDir.getAbsolutePath() )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
File[] dirList(String dirName) {
|
|
|
|
return dirList( (File) file(dirName) );
|
|
|
|
}
|
|
|
|
|
|
|
|
File[] dirList(File dir) {
|
|
|
|
return dir.listFiles({file -> file.isDirectory() } as FileFilter).sort();
|
2011-03-22 11:39:53 -04:00
|
|
|
}
|
2013-10-14 21:12:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
// asciidoctor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-11-22 15:51:56 -05:00
|
|
|
|
2013-11-19 15:11:05 -05:00
|
|
|
task asciidoctor(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documentation') {
|
|
|
|
description = 'Generates the Asciidoc(tor) topical guides in HTML format.'
|
2013-10-14 21:12:47 -04:00
|
|
|
backend = 'html5'
|
2013-11-19 15:11:05 -05:00
|
|
|
sourceDir = file( 'src/main/asciidoc/topical' )
|
2013-10-31 07:08:36 -04:00
|
|
|
outputDir = new File("$buildDir/asciidoc/topical/html")
|
|
|
|
}
|
|
|
|
|
2013-10-14 21:12:47 -04:00
|
|
|
tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) { docTask ->
|
|
|
|
options = [
|
|
|
|
logDocuments: true,
|
|
|
|
attributes: [
|
|
|
|
icons: 'font',
|
|
|
|
'source-highlighter': 'prettify',
|
|
|
|
experimental: true
|
|
|
|
]
|
|
|
|
]
|
2013-10-31 07:08:36 -04:00
|
|
|
}
|
|
|
|
|
2013-11-18 15:48:10 -05:00
|
|
|
buildDocs.dependsOn asciidoctor
|