Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 106 lines (94 sloc) 3.376 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
buildscript {
  repositories {
      mavenCentral()
      mavenLocal()
mavenRepo name: 'jboss-nexus', url: "http://repository.jboss.org/nexus/content/groups/public/"
  }
  dependencies {
      classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.1"
  }
}

apply plugin: "java"
apply plugin: "jdocbook"
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'
        // only html supported due to tutorials.zip
// formats.pdf.enable = false
    }
devguide {
masterSourceDocumentName = 'Hibernate_Development_Guide.xml'
useRelativeImageUris = false
}
// todo : need to remove this once all content moved to devguide
manual {
masterSourceDocumentName = 'HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.xml'
// translation = ['de-DE','es-ES','fr-FR','ja-JP','pt-BR','zh-CN']
}
}

// 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")
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,
            slf4j: parent.slf4jVersion,
            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();
}
Something went wrong with that request. Please try again.