2010-10-12 16:39:33 -04:00
|
|
|
apply plugin: 'base'
|
|
|
|
apply plugin: 'idea'
|
|
|
|
|
|
|
|
buildDir = "target"
|
|
|
|
|
2012-02-15 17:31:29 -05:00
|
|
|
idea.module {
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Javadocs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2012-03-26 03:12:10 -04:00
|
|
|
javadocBuildDir = mkdir( "${buildDir}/documentation/javadocs" )
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2011-03-18 10:02:31 -04:00
|
|
|
def copyRightYear = new java.util.GregorianCalendar().get( java.util.Calendar.YEAR );
|
|
|
|
|
2010-11-01 14:44:41 -04:00
|
|
|
task aggregateJavadocs(type: Javadoc) {
|
2011-12-20 13:02:59 -05:00
|
|
|
// 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
|
2011-12-16 15:26:52 -05:00
|
|
|
Set<String> apiPackages = new HashSet<String>()
|
|
|
|
Set<String> spiPackages = new HashSet<String>()
|
|
|
|
Set<String> internalPackages = new HashSet<String>()
|
2011-12-20 13:02:59 -05:00
|
|
|
parent.subprojects.each{ Project subProject->
|
|
|
|
// skip certain sub-projects
|
|
|
|
if ( ! ['release','documentation'].contains( subProject.name ) ) {
|
|
|
|
subProject.sourceSets.each { SourceSet sourceSet ->
|
|
|
|
// skip certain source sets
|
|
|
|
if ( ! ['test','matrix'].contains( sourceSet.name ) ) {
|
2011-12-16 15:26:52 -05:00
|
|
|
source sourceSet.java
|
|
|
|
|
|
|
|
if( classpath ) {
|
2012-03-26 03:12:10 -04:00
|
|
|
classpath += sourceSet.output + sourceSet.compileClasspath
|
2011-12-16 15:26:52 -05:00
|
|
|
}
|
|
|
|
else {
|
2012-03-26 03:12:10 -04:00
|
|
|
classpath = sourceSet.output + sourceSet.compileClasspath
|
2011-12-16 15:26:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
2011-12-20 13:02:59 -05:00
|
|
|
else if ( packageName.startsWith( "org.hibernate.testing" ) ) {
|
|
|
|
// do nothing as testing support is already handled...
|
|
|
|
}
|
2011-12-16 15:26:52 -05:00
|
|
|
else {
|
|
|
|
apiPackages.add( packageName );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-20 13:02:59 -05:00
|
|
|
// apply standard config
|
2010-10-12 16:39:33 -04:00
|
|
|
description = "Build the aggregated JavaDocs for all modules"
|
|
|
|
maxMemory = '512m'
|
2012-03-26 03:12:10 -04:00
|
|
|
destinationDir = javadocBuildDir
|
2010-10-12 16:39:33 -04:00
|
|
|
configure( options ) {
|
2011-12-20 13:02:59 -05:00
|
|
|
overview = new File( projectDir, 'src/javadoc/overview.html' )
|
2010-10-12 16:39:33 -04:00
|
|
|
stylesheetFile = new File( projectDir, 'src/javadoc/stylesheet.css' )
|
|
|
|
windowTitle = 'Hibernate JavaDocs'
|
|
|
|
docTitle = "Hibernate JavaDoc ($project.version)"
|
2011-03-18 10:02:31 -04:00
|
|
|
bottom = "Copyright © 2001-$copyRightYear <a href=\"http://redhat.com\">Red Hat, Inc.</a> All Rights Reserved."
|
2010-10-12 16:39:33 -04:00
|
|
|
use = true
|
|
|
|
links = [ 'http://download.oracle.com/javase/6/docs/api/', 'http://download.oracle.com/javaee/6/api/' ]
|
2011-12-16 15:26:52 -05:00
|
|
|
group( 'API', apiPackages.asList() )
|
|
|
|
group( 'SPI', spiPackages.asList() )
|
|
|
|
group( 'Internal', internalPackages.asList() )
|
|
|
|
group ( 'Testing Support', ['org.hibernate.testing*'] )
|
2011-12-20 13:02:59 -05:00
|
|
|
// ugh, http://issues.gradle.org/browse/GRADLE-1563
|
|
|
|
// tags ["todo:X"]
|
|
|
|
// work around:
|
|
|
|
addStringOption( "tag", "todo:X" )
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
2011-12-16 15:26:52 -05:00
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2011-12-16 15:26:52 -05:00
|
|
|
String determinePackageName(SourceDirectorySet sourceDirectorySet, File javaFile) {
|
|
|
|
final javaFileAbsolutePath = javaFile.absolutePath;
|
|
|
|
for ( File sourceDirectory : sourceDirectorySet.srcDirs ) {
|
|
|
|
final String sourceDirectoryAbsolutePath = sourceDirectory.absolutePath;
|
|
|
|
if ( javaFileAbsolutePath.startsWith( sourceDirectoryAbsolutePath ) ) {
|
|
|
|
final String javaFileRelativePath = javaFileAbsolutePath.substring(
|
|
|
|
sourceDirectoryAbsolutePath.length() + 1,
|
2012-01-16 11:17:37 -05:00
|
|
|
javaFileAbsolutePath.lastIndexOf( File.separator )
|
2011-12-16 15:26:52 -05:00
|
|
|
);
|
2012-01-16 11:17:37 -05:00
|
|
|
return javaFileRelativePath.replace( File.separator, "." );
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
}
|
2011-12-16 15:26:52 -05:00
|
|
|
throw new RuntimeException( "ugh" );
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
aggregateJavadocs.doLast {
|
|
|
|
copy {
|
|
|
|
from new File( projectDir, 'src/javadoc/images' )
|
2012-03-26 03:12:10 -04:00
|
|
|
into new File( javadocBuildDir, "/images" )
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// release bundles ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2012-03-26 03:12:10 -04:00
|
|
|
releaseBuildDir = mkdir( buildDir )
|
2012-02-07 01:31:25 -05:00
|
|
|
task prepareReleaseBundles( dependsOn: [parent.project( 'documentation' ).tasks.buildDocs,aggregateJavadocs] )
|
2010-10-12 16:39:33 -04:00
|
|
|
|
|
|
|
|
|
|
|
releaseCopySpec = copySpec {
|
2011-03-18 10:49:00 -04:00
|
|
|
into( "hibernate-release-$project.version" ) {
|
|
|
|
from new File( parent.projectDir, 'lgpl.txt' )
|
|
|
|
from new File( parent.projectDir, 'changelog.txt' )
|
|
|
|
from new File( parent.projectDir, 'hibernate_logo.gif' )
|
|
|
|
|
|
|
|
into('lib/required') {
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.provided.files { dep -> dep.name == 'jta' }
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.runtime
|
2012-03-26 03:12:10 -04:00
|
|
|
from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
2011-03-29 16:14:09 -04:00
|
|
|
// for now,
|
2011-03-18 10:49:00 -04:00
|
|
|
from parent.project( 'hibernate-core' ).configurations.provided.files { dep -> dep.name == 'javassist' }
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2011-03-29 16:14:09 -04:00
|
|
|
// into('lib/bytecode/javassist') {
|
|
|
|
// from parent.project( 'hibernate-core' ).configurations.provided.files { dep -> dep.name == 'javassist' }
|
|
|
|
// }
|
|
|
|
|
2011-03-18 10:49:00 -04:00
|
|
|
into( 'lib/jpa' ) {
|
2012-03-26 03:12:10 -04:00
|
|
|
from parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
2011-03-18 10:49:00 -04:00
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2011-03-18 10:49:00 -04:00
|
|
|
into( 'lib/envers' ) {
|
|
|
|
from(
|
2012-03-26 03:12:10 -04:00
|
|
|
( parent.project( 'hibernate-envers' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
2011-03-18 10:49:00 -04:00
|
|
|
+ parent.project( 'hibernate-envers' ).configurations.runtime )
|
2010-10-12 16:39:33 -04:00
|
|
|
- parent.project( 'hibernate-core' ).configurations.runtime
|
2012-03-26 03:12:10 -04:00
|
|
|
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
2011-03-18 10:49:00 -04:00
|
|
|
- parent.project( 'hibernate-entitymanager' ).configurations.runtime
|
2012-03-26 03:12:10 -04:00
|
|
|
- parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files
|
2010-10-12 16:39:33 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2011-03-18 10:49:00 -04:00
|
|
|
// todo : this closure is problematic as it does not write into the hibernate-release-$project.version directory
|
2011-03-22 12:35:28 -04:00
|
|
|
// due to http://issues.gradle.org/browse/GRADLE-1450
|
2011-03-18 10:49:00 -04:00
|
|
|
[ 'hibernate-c3p0', 'hibernate-proxool', 'hibernate-ehcache', 'hibernate-infinispan' ].each { feature ->
|
|
|
|
final String shortName = feature.substring( 'hibernate-'.length() );
|
2011-03-22 12:35:28 -04:00
|
|
|
// WORKAROUND http://issues.gradle.org/browse/GRADLE-1450
|
|
|
|
// into('lib/optional/' + shortName) {
|
|
|
|
owner.into('lib/optional/' + shortName) {
|
2011-03-18 10:49:00 -04:00
|
|
|
from (
|
2012-03-26 03:12:10 -04:00
|
|
|
( parent.project( feature ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
2011-03-18 10:49:00 -04:00
|
|
|
+ parent.project( feature ).configurations.runtime )
|
|
|
|
- parent.project( 'hibernate-core' ).configurations.runtime
|
2012-03-26 03:12:10 -04:00
|
|
|
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
2011-03-18 10:49:00 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2011-03-29 16:14:09 -04:00
|
|
|
into('documentation') {
|
|
|
|
from new File( parent.project( 'documentation' ).buildDir, 'docbook/publish' )
|
|
|
|
}
|
2011-03-18 10:49:00 -04:00
|
|
|
|
|
|
|
into('documentation/javadocs') {
|
2012-03-26 03:12:10 -04:00
|
|
|
from javadocBuildDir
|
2011-03-18 10:49:00 -04:00
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2011-03-18 10:49:00 -04:00
|
|
|
into( 'project' ) {
|
|
|
|
from ( rootProject.projectDir ) {
|
|
|
|
exclude( '.git' )
|
|
|
|
exclude( '.gitignore' )
|
|
|
|
exclude( 'changelog.txt' )
|
|
|
|
exclude( 'lgpl.txt' )
|
|
|
|
exclude( 'hibernate_logo.gif' )
|
|
|
|
exclude( 'tagRelease.sh' )
|
|
|
|
exclude( 'gradlew' )
|
|
|
|
exclude( 'gradlew.bat' )
|
|
|
|
exclude( 'wrapper/*' )
|
|
|
|
exclude( '**/.gradle/**' )
|
|
|
|
exclude( '**/target/**' )
|
|
|
|
exclude( '.idea' )
|
|
|
|
exclude( '**/*.ipr' )
|
|
|
|
exclude( '**/*.iml' )
|
|
|
|
exclude( '**/*.iws' )
|
|
|
|
exclude( '**/atlassian-ide-plugin.xml' )
|
|
|
|
exclude( '**/.classpath' )
|
|
|
|
exclude( '**/.project' )
|
|
|
|
exclude( '**/.settings' )
|
|
|
|
exclude( '**/.nbattrs' )
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task buildReleaseZip( type: Zip, dependsOn: [prepareReleaseBundles] ) {
|
|
|
|
description = "Build release bundle in ZIP format"
|
|
|
|
baseName = 'hibernate-release'
|
2012-03-26 03:12:10 -04:00
|
|
|
destinationDir = releaseBuildDir
|
2010-10-12 16:39:33 -04:00
|
|
|
with project.releaseCopySpec
|
|
|
|
}
|
|
|
|
|
|
|
|
task buildReleaseTgz( type: Tar, dependsOn: [prepareReleaseBundles] ) {
|
|
|
|
description = "Build release bundle in GZIP format"
|
|
|
|
baseName = 'hibernate-release'
|
2012-03-26 03:12:10 -04:00
|
|
|
destinationDir = releaseBuildDir
|
2010-10-12 16:39:33 -04:00
|
|
|
compression = Compression.GZIP
|
|
|
|
with project.releaseCopySpec
|
|
|
|
}
|
|
|
|
|
|
|
|
task buildReleaseBundles( dependsOn: [buildReleaseZip,buildReleaseTgz] ) {
|
|
|
|
description = "Build release bundle in all formats"
|
|
|
|
}
|