hibernate-orm/documentation/documentation.gradle

157 lines
5.0 KiB
Groovy
Raw Normal View History

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 {
// classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.1"
classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.2-SNAPSHOT"
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0'
}
}
apply plugin: "java"
apply plugin: "jdocbook"
2012-08-08 05:09:11 -04:00
ext.pressgangVersion = '3.0.0'
dependencies {
jdocbookXsl "org.jboss.pressgang:pressgang-xslt-ns:${pressgangVersion}"
jdocbookXsl "org.jboss.pressgang:pressgang-fonts:${pressgangVersion}"
jdocbookStyles "org.jboss.pressgang:pressgang-jdocbook-style:${pressgangVersion}"
}
defaultTasks 'buildDocs'
jdocbook {
// apply shared formatting 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"
}
// book-specific config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
quickstart {
masterSourceDocumentName = 'Hibernate_Getting_Started_Guide.xml'
}
devguide {
masterSourceDocumentName = 'Hibernate_Development_Guide.xml'
2012-02-01 13:22:06 -05:00
useRelativeImageUris = false
}
manual {
masterSourceDocumentName = 'HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.xml'
}
}
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 {
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
}
}
[ 'devguide', 'manual', 'quickstart' ].each { bookName ->
tasks[ "stageStyles_$bookName" ].doLast {
logger.lifecycle( "Staging local style resources")
copy {
into project.file( "target/docbook/stage/$bookName" )
from project.file( 'src/main/style' )
includeEmptyDirs = false
}
}
}
task buildTutorialZip(type: Zip) {
destinationDir = file( "target/work/tutorials" )
archiveName = 'hibernate-tutorials.zip'
from 'src/main/docbook/quickstart/tutorials'
expand(
version: project.version,
2013-10-09 13:14:26 -04:00
slf4j: "1.7.5",
junit: parent.junitVersion,
h2: parent.h2Version
)
}
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();
}
// asciidoctor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task asciidoctor(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documentation') {
description = 'Generates the Asciidoc(tor) topical guides in HTML format.'
backend = 'html5'
sourceDir = file( 'src/main/asciidoc/topical' )
outputDir = new File("$buildDir/asciidoc/topical/html")
}
//task generateRegistryGuideHtml(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documentation') {
// description = 'Generates the ServiceRegistry topical guide in HTML format.'
// backend = 'html5'
// sourceDir = file( 'src/main/asciidoc/topical/registries' )
// outputDir = new File("$buildDir/asciidoc/topical/html")
//}
//
//task generateMetamodelgenGuideHtml(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documentation') {
// description = 'Generates the Metamodel Generator topical guide in HTML format.'
// backend = 'html5'
// sourceDir = file( 'src/main/asciidoc/topical/metamodelgen' )
// outputDir = new File("$buildDir/asciidoc/topical/html")
//}
tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) { docTask ->
options = [
logDocuments: true,
attributes: [
icons: 'font',
'source-highlighter': 'prettify',
experimental: true
]
]
}
// - aggregator
//task asciidoctor(type: Task, group: 'Documentation')
//asciidoctor.dependsOn generateRegistryGuideHtml, generateMetamodelgenGuideHtml
buildDocs.dependsOn asciidoctor