HHH-8733 - General build cleanup

This commit is contained in:
Steve Ebersole 2013-11-22 14:51:56 -06:00
parent 11033040e6
commit c1612fe004
6 changed files with 205 additions and 246 deletions

View File

@ -170,51 +170,43 @@ subprojects { subProject ->
} }
sourceSets.all { sourceSets.all {
ext.originalJavaSrcDirs = java.srcDirs ext.aptGeneratedSourceDir = file( "${buildDir}/generated-src/apt/${name}" )
ext.generatedLoggingSrcDir = file( "${buildDir}/generated-src/logging/${name}" ) if ( !aptGeneratedSourceDir.exists() ) {
java.srcDir generatedLoggingSrcDir aptGeneratedSourceDir.mkdirs()
}
} }
task generateMainLoggingClasses(type: JavaCompile) { tasks.withType( JavaCompile.class ).all { task->
ext.aptDumpDir = subProject.file( "${buildDir}/tmp/apt/logging" ) task.options.define(
classpath = compileJava.classpath + configurations.jbossLoggingTool
source = sourceSets.main.originalJavaSrcDirs
destinationDir = aptDumpDir
options.define(
compilerArgs: [ compilerArgs: [
"-nowarn", "-nowarn",
"-proc:only",
"-encoding", "UTF-8", "-encoding", "UTF-8",
"-processor", "org.jboss.logging.processor.apt.LoggingToolsProcessor",
"-s", "$sourceSets.main.generatedLoggingSrcDir.absolutePath",
// "-AloggingVersion=3.0",
"-Adebug=true",
"-AskipTranslations=true",
"-source", rootProject.javaLanguageLevel, "-source", rootProject.javaLanguageLevel,
"-target", rootProject.javaLanguageLevel, "-target", rootProject.javaLanguageLevel,
"-AtranslationFilesPath=${project.rootDir}/src/main/resources"
] ]
); )
outputs.dir sourceSets.main.generatedLoggingSrcDir;
doFirst {
// source = sourceSets.main.originalJavaSrcDirs
sourceSets.main.generatedLoggingSrcDir.mkdirs()
}
doLast {
aptDumpDir.delete()
}
} }
// for the time being eat the annoying output from running the annotation processors // alter the compileJava (src/main/java javac task) to add JBoss Logging AP hooks
generateMainLoggingClasses.logging.captureStandardError(LogLevel.INFO) compileJava {
classpath += configurations.jbossLoggingTool
options.compilerArgs += [
"-s", "$sourceSets.main.aptGeneratedSourceDir.absolutePath",
"-Adebug=true",
"-AskipTranslations=true",
"-AtranslationFilesPath=${project.rootDir}/src/main/resources"
]
}
// alter the compileTestJava (src/test/java javac task) to add AP hooks
compileTestJava {
options.compilerArgs += [
"-s", "$sourceSets.test.aptGeneratedSourceDir.absolutePath"
]
}
task generateSources( type: Task ) task generateSources( type: Task )
generateSources.dependsOn generateMainLoggingClasses
compileJava.dependsOn generateMainLoggingClasses
compileJava.options.define(compilerArgs: ["-proc:none", "-encoding", "UTF-8"])
compileTestJava.options.define(compilerArgs: ["-proc:none", "-encoding", "UTF-8"])
jar { jar {
Set<String> exportPackages = new HashSet<String>() Set<String> exportPackages = new HashSet<String>()
@ -362,7 +354,7 @@ subprojects { subProject ->
checkstyleClasspath = checkstyleMain.checkstyleClasspath checkstyleClasspath = checkstyleMain.checkstyleClasspath
classpath = checkstyleMain.classpath classpath = checkstyleMain.classpath
configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' ) configFile = rootProject.file( 'shared/config/checkstyle/checkstyle.xml' )
source subProject.sourceSets.main.originalJavaSrcDirs source subProject.sourceSets.main.java.srcDirs
// exclude generated sources // exclude generated sources
exclude '**/generated-src/**' exclude '**/generated-src/**'
// because cfg package is a mess mainly from annotation stuff // because cfg package is a mess mainly from annotation stuff
@ -489,7 +481,7 @@ subprojects { subProject ->
model { model {
tasks.generatePomFileForMavenJavaPublication { tasks.generatePomFileForMavenJavaPublication {
destination = file("$buildDir/generated-pom.xml") destination = file( "$project.buildDir/generated-pom.xml" )
} }
} }

View File

@ -13,38 +13,146 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
// classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.1" classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.2"
classpath "org.jboss.jdocbook:gradle-jdocbook:1.2.2-SNAPSHOT"
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0' classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.0'
} }
} }
apply plugin: "java" apply plugin: "java"
apply plugin: "jdocbook" apply plugin: "jdocbook"
apply from: "../utilities.gradle"
ext.pressgangVersion = '3.0.0' defaultTasks 'buildDocs'
configurations {
asciidoclet {
description = 'Dependencies for Asciidoclet (the javadoc doclet tool for using Asciidoc)'
}
}
dependencies { dependencies {
ext.pressgangVersion = '3.0.0'
asciidoclet 'org.asciidoctor:asciidoclet:0.+'
jdocbookXsl "org.jboss.pressgang:pressgang-xslt-ns:${pressgangVersion}" jdocbookXsl "org.jboss.pressgang:pressgang-xslt-ns:${pressgangVersion}"
jdocbookXsl "org.jboss.pressgang:pressgang-fonts:${pressgangVersion}" jdocbookXsl "org.jboss.pressgang:pressgang-fonts:${pressgangVersion}"
jdocbookStyles "org.jboss.pressgang:pressgang-jdocbook-style:${pressgangVersion}" jdocbookStyles "org.jboss.pressgang:pressgang-jdocbook-style:${pressgangVersion}"
} }
defaultTasks 'buildDocs'
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'
options.docletpath = configurations.asciidoclet.files.asType(List)
options.doclet = 'org.asciidoctor.Asciidoclet'
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
if ( ! ['release','documentation'].contains( subProject.name ) ) {
subProject.sourceSets.each { sourceSet ->
// skip certain source sets
if ( ! ['test','matrix'].contains( sourceSet.name ) ) {
source sourceSet.java
if( classpath ) {
classpath += sourceSet.output + sourceSet.compileClasspath
}
else {
classpath = sourceSet.output + sourceSet.compileClasspath
}
sourceSet.java.each { javaFile ->
final String packageName = determinePackageName( sourceSet.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 );
}
}
}
}
}
}
// 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 &copy; 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jdocbook { jdocbook {
// apply shared formatting config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // shared config
format('html_single') { format('html_single') {
finalName = "index.html" finalName = "index.html"
stylesheet = "classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl" stylesheet = "classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml-single.xsl"
} }
format('html') { format('html') {
finalName = "index.html" finalName = "index.html"
stylesheet = "classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl" stylesheet = "classpath:/xslt/org/hibernate/jdocbook/xslt/xhtml.xsl"
} }
// book-specific config ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // book-specific config
quickstart { quickstart {
masterSourceDocumentName = 'Hibernate_Getting_Started_Guide.xml' masterSourceDocumentName = 'Hibernate_Getting_Started_Guide.xml'
} }
@ -73,14 +181,12 @@ stageStyles_devguide.doLast {
} }
[ 'devguide', 'manual', 'quickstart' ].each { bookName -> [ 'devguide', 'manual', 'quickstart' ].each { bookName ->
tasks[ "stageStyles_$bookName" ].doLast { task "stageLocalStyles_$bookName"(type: Copy) {
logger.lifecycle( "Staging local style resources")
copy {
into project.file( "target/docbook/stage/$bookName" ) into project.file( "target/docbook/stage/$bookName" )
from project.file( 'src/main/style' ) from project.file( 'src/main/style' )
includeEmptyDirs = false includeEmptyDirs = false
} }
} tasks[ "stageStyles_$bookName" ].dependsOn "stageLocalStyles_$bookName"
} }
task buildTutorialZip(type: Zip) { task buildTutorialZip(type: Zip) {
@ -117,6 +223,7 @@ File[] dirList(File dir) {
// asciidoctor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // asciidoctor ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task asciidoctor(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documentation') { task asciidoctor(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documentation') {
description = 'Generates the Asciidoc(tor) topical guides in HTML format.' description = 'Generates the Asciidoc(tor) topical guides in HTML format.'
backend = 'html5' backend = 'html5'
@ -124,20 +231,6 @@ task asciidoctor(type: org.asciidoctor.gradle.AsciidoctorTask, group: 'Documenta
outputDir = new File("$buildDir/asciidoc/topical/html") 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 -> tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) { docTask ->
options = [ options = [
logDocuments: true, logDocuments: true,
@ -149,8 +242,4 @@ tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) { docTask ->
] ]
} }
// - aggregator
//task asciidoctor(type: Task, group: 'Documentation')
//asciidoctor.dependsOn generateRegistryGuideHtml, generateMetamodelgenGuideHtml
buildDocs.dependsOn asciidoctor buildDocs.dependsOn asciidoctor

View File

@ -88,7 +88,6 @@ jar {
sourceSets.main { sourceSets.main {
ext.jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" ) ext.jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
java.srcDir jaxbTargetDir java.srcDir jaxbTargetDir
originalJavaSrcDirs = java.srcDirs
} }
// resources inherently exclude sources // resources inherently exclude sources
@ -159,8 +158,8 @@ task jaxb {
} }
generateMainLoggingClasses.dependsOn jaxb //generateMainLoggingClasses.dependsOn jaxb
generateMainLoggingClasses.dependsOn generateGrammarSource //generateMainLoggingClasses.dependsOn generateGrammarSource
generateSources.dependsOn jaxb generateSources.dependsOn jaxb
generateSources.dependsOn generateGrammarSource generateSources.dependsOn generateGrammarSource

View File

@ -68,41 +68,10 @@ jar {
} }
} }
////////////////////////////////////////////////////////////////////////////////////////////////////////
// JPA model-gen set up
////////////////////////////////////////////////////////////////////////////////////////////////////////
sourceSets.test { compileTestJava {
originalJavaSrcDirs = java.srcDirs classpath += configurations.hibernateJpaModelGenTool
ext.generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
java.srcDir generatedJpaMetamodelSrcDir
} }
task generateTestJpaMetamodelClasses(type: JavaCompile) {
ext.aptDumpDir = file( "${buildDir}/tmp/apt/jpamodelgen" )
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
source = sourceSets.test.originalJavaSrcDirs
destinationDir = aptDumpDir
options.define(
compilerArgs: [
"-proc:only",
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
"-s", "$sourceSets.test.generatedJpaMetamodelSrcDir.absolutePath"
]
);
outputs.dir sourceSets.test.generatedJpaMetamodelSrcDir;
doFirst {
sourceSets.test.generatedJpaMetamodelSrcDir.mkdirs()
}
doLast {
aptDumpDir.delete()
}
}
// for the time being eat the annoying output from running the annotation processors
generateTestJpaMetamodelClasses.logging.captureStandardError(LogLevel.INFO)
compileTestJava.dependsOn generateTestJpaMetamodelClasses
compileTestJava.options.define(compilerArgs: ["-proc:none"])
generateSources.dependsOn generateTestJpaMetamodelClasses
//////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -9,10 +9,13 @@ configurations {
dependencies { dependencies {
compile( project( ':hibernate-core' ) ) compile( project( ':hibernate-core' ) )
compile( project( ':hibernate-entitymanager' ) ) compile( project( ':hibernate-entitymanager' ) )
provided( [group: 'org.hibernate', name: 'hibernate-tools', version: '3.2.0.ga'] ) provided( [group: 'org.hibernate', name: 'hibernate-tools', version: '3.2.0.ga'] )
provided( libraries.ant ) provided( libraries.ant )
testCompile( project(':hibernate-testing') ) testCompile( project(':hibernate-testing') )
testCompile( project(path: ':hibernate-entitymanager', configuration: 'tests') ) testCompile( project(path: ':hibernate-entitymanager', configuration: 'tests') )
testRuntime( libraries.javassist ) testRuntime( libraries.javassist )
hibernateJpaModelGenTool( project( ':hibernate-jpamodelgen' ) ) hibernateJpaModelGenTool( project( ':hibernate-jpamodelgen' ) )
@ -26,13 +29,8 @@ def pomDescription() {
return 'Entity versioning support' return 'Entity versioning support'
} }
sourceSets { sourceSets {
main {
ext.generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
java {
srcDir generatedJpaMetamodelSrcDir
}
}
test { test {
ext.enversDemoJavaDir = file( "src/demo/java" ) ext.enversDemoJavaDir = file( "src/demo/java" )
ext.enversDemoResourcesDir = file( "src/demo/resources" ) ext.enversDemoResourcesDir = file( "src/demo/resources" )
@ -45,25 +43,9 @@ sourceSets {
} }
} }
// Generate JPA2 static metamodel for default revision entities compileTestJava {
task generateJpaMetamodelClasses(type: JavaCompile) { classpath += configurations.hibernateJpaModelGenTool
classpath = compileJava.classpath + configurations.hibernateJpaModelGenTool
source = sourceSets.main.originalJavaSrcDirs
destinationDir = file( "${buildDir}/tmp/apt" )
options.define(
compilerArgs: [
"-proc:only",
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
"-s", "$sourceSets.main.generatedJpaMetamodelSrcDir.absolutePath"
]
);
outputs.dir sourceSets.main.generatedJpaMetamodelSrcDir;
doFirst {
sourceSets.main.generatedJpaMetamodelSrcDir.mkdirs()
} }
}
compileJava.dependsOn generateJpaMetamodelClasses
generateSources.dependsOn generateJpaMetamodelClasses
jar { jar {
manifest { manifest {

View File

@ -1,113 +1,30 @@
apply plugin: 'base' apply plugin: 'base'
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'distribution' apply plugin: 'distribution'
apply from: "../utilities.gradle"
buildDir = "target" buildDir = "target"
idea.module { idea.module {
} }
final File documentationDir = mkdir( "${project.buildDir}/documentation" );
final String[] versionComponents = version.split( '\\.' ); final String[] versionComponents = version.split( '\\.' );
final String majorVersion = versionComponents[0]; final String majorVersion = versionComponents[0];
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1]; final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];
final File documentationDir = mkdir( new File( project.buildDir, 'documentation' ) ); final File stagingDir = mkdir( "${project.buildDir}/staging" );
final File javadocDir = mkdir( new File( documentationDir, 'javadocs' ) ); final File documentationUploadStagingDir = mkdir( new File( stagingDir, "docs" ) );
/**
* 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
if ( ! ['release','documentation'].contains( subProject.name ) ) {
subProject.sourceSets.each { sourceSet ->
// skip certain source sets
if ( ! ['test','matrix'].contains( sourceSet.name ) ) {
source sourceSet.java
if( classpath ) {
classpath += sourceSet.output + sourceSet.compileClasspath
}
else {
classpath = sourceSet.output + sourceSet.compileClasspath
}
sourceSet.java.each { javaFile ->
final String packageName = determinePackageName( sourceSet.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 );
}
}
}
}
}
}
// 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 &copy; 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" )
}
}
}
final File documentationUploadStagingDir = mkdir( "${project.buildDir}/tmp/documentation" );
final File versionedDocumentationDir = mkdir( new File( new File( documentationUploadStagingDir, "orm" ), majorMinorVersion ) ); final File versionedDocumentationDir = mkdir( new File( new File( documentationUploadStagingDir, "orm" ), majorMinorVersion ) );
/** /**
* Builds the complete documentation set in preparation for upload to the doc server. * Assembles all documentation into the {buildDir}/documentation directory.
* *
* It builds the docbook manuals as well as the aggregated, cross-project JavaDocs and stages them into * Depends on building the docs
* a single directory that can be directly rsync-ed to the doc server
*/ */
task buildDocumentation(type: Task, dependsOn: [rootProject.project( 'documentation' ).tasks.buildDocs, aggregateJavadocs]) { task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documentation' ).tasks.buildDocs]) {
description = "Builds and consolidates all documentation" description = 'Assembles all documentation into the {buildDir}/documentation directory'
doLast { doLast {
// copy docbook outputs into target/documentation (javadocs are already there). this is used in // copy docbook outputs into target/documentation (javadocs are already there). this is used in
@ -120,14 +37,25 @@ task buildDocumentation(type: Task, dependsOn: [rootProject.project( 'documentat
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc" from "${rootProject.project( 'documentation' ).buildDir}/asciidoc"
into documentationDir into documentationDir
} }
// now prepare the upload staging directory
versionedDocumentationDir.mkdirs()
copy { copy {
from documentationDir from "${rootProject.project( 'documentation' ).buildDir}/javadoc"
into versionedDocumentationDir into documentationDir
}
}
} }
/**
* Stages the documentation into a version specific directory in preparation for uploading them to the JBoss
* doc server. Essentially copies the output from the {buildDir}/documentation directory (output of the
* assembleDocumentation task) into a version-specific directory
*/
task stageDocumentationForUpload(type: Copy, dependsOn: assembleDocumentation) {
description = 'Stages the documentation in preparation for uploading to the JBoss doc server'
from documentationDir
into versionedDocumentationDir
doLast {
if ( ! version.endsWith( 'SNAPSHOT' ) ) { if ( ! version.endsWith( 'SNAPSHOT' ) ) {
final File currentSymLinkContainerDir = new File( documentationUploadStagingDir, 'stable' ) final File currentSymLinkContainerDir = new File( documentationUploadStagingDir, 'stable' )
currentSymLinkContainerDir.mkdirs(); currentSymLinkContainerDir.mkdirs();
@ -147,7 +75,7 @@ task buildDocumentation(type: Task, dependsOn: [rootProject.project( 'documentat
/** /**
* Upload the documentation to the JBoss doc server * Upload the documentation to the JBoss doc server
*/ */
task uploadDocumentation(type:Exec, dependsOn: buildDocumentation) { task uploadDocumentation(type:Exec, dependsOn: stageDocumentationForUpload) {
description = "Uploads documentation to the JBoss doc server" description = "Uploads documentation to the JBoss doc server"
final String url = 'filemgmt.jboss.org:/docs_htdocs/hibernate/'; final String url = 'filemgmt.jboss.org:/docs_htdocs/hibernate/';
@ -268,8 +196,8 @@ distributions {
} }
} }
distZip.dependsOn buildDocumentation distZip.dependsOn assembleDocumentation
distTar.dependsOn buildDocumentation distTar.dependsOn assembleDocumentation
distTar { distTar {
compression = Compression.GZIP compression = Compression.GZIP
} }