2010-10-12 16:39:33 -04:00
|
|
|
apply plugin: 'base'
|
|
|
|
apply plugin: 'idea'
|
2013-04-05 16:15:11 -04:00
|
|
|
apply plugin: 'distribution'
|
2010-10-12 16:39:33 -04:00
|
|
|
|
|
|
|
buildDir = "target"
|
|
|
|
|
2012-02-15 17:31:29 -05:00
|
|
|
idea.module {
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
|
|
|
|
final File documentationDir = mkdir( "${project.buildDir}/documentation" );
|
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
final String[] versionComponents = version.split( '\\.' );
|
|
|
|
final String majorVersion = versionComponents[0];
|
|
|
|
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
final File stagingDir = mkdir( "${project.buildDir}/staging" );
|
|
|
|
final File documentationUploadStagingDir = mkdir( new File( stagingDir, "docs" ) );
|
2013-05-17 15:29:33 -04:00
|
|
|
final File versionedDocumentationDir = mkdir( new File( new File( documentationUploadStagingDir, "orm" ), majorMinorVersion ) );
|
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
/**
|
2013-11-22 15:51:56 -05:00
|
|
|
* Assembles all documentation into the {buildDir}/documentation directory.
|
2013-05-16 19:34:36 -04:00
|
|
|
*
|
2013-11-22 15:51:56 -05:00
|
|
|
* Depends on building the docs
|
2013-05-16 19:34:36 -04:00
|
|
|
*/
|
2013-11-22 15:51:56 -05:00
|
|
|
task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documentation' ).tasks.buildDocs]) {
|
|
|
|
description = 'Assembles all documentation into the {buildDir}/documentation directory'
|
2013-05-16 19:34:36 -04:00
|
|
|
|
|
|
|
doLast {
|
2014-01-10 14:43:19 -05:00
|
|
|
// copy documentation outputs into target/documentation.
|
|
|
|
// * this is used in building the dist bundles
|
|
|
|
// * it is also used as a base to build a staged directory for documentation upload
|
2013-05-16 19:34:36 -04:00
|
|
|
copy {
|
|
|
|
from "${rootProject.project( 'documentation' ).buildDir}/docbook/publish"
|
2013-05-17 15:29:33 -04:00
|
|
|
into documentationDir
|
|
|
|
}
|
2013-11-18 15:48:10 -05:00
|
|
|
copy {
|
|
|
|
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc"
|
|
|
|
into documentationDir
|
|
|
|
}
|
2013-05-17 15:29:33 -04:00
|
|
|
copy {
|
2014-01-10 14:43:19 -05:00
|
|
|
from "${rootProject.project( 'documentation' ).buildDir}/javadocs"
|
|
|
|
into "${documentationDir}/javadocs"
|
2013-05-16 19:34:36 -04:00
|
|
|
}
|
2013-11-22 15:51:56 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2013-05-16 19:34:36 -04:00
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
doLast {
|
2013-05-16 19:34:36 -04:00
|
|
|
if ( ! version.endsWith( 'SNAPSHOT' ) ) {
|
2013-05-17 15:29:33 -04:00
|
|
|
final File currentSymLinkContainerDir = new File( documentationUploadStagingDir, 'stable' )
|
2013-05-16 19:34:36 -04:00
|
|
|
currentSymLinkContainerDir.mkdirs();
|
|
|
|
ant.symlink(
|
|
|
|
action: 'delete',
|
|
|
|
link: "${currentSymLinkContainerDir.absolutePath}/orm"
|
|
|
|
)
|
|
|
|
ant.symlink(
|
|
|
|
action: 'single',
|
|
|
|
link: "${currentSymLinkContainerDir.absolutePath}/orm",
|
2013-05-29 14:42:26 -04:00
|
|
|
resource: "../orm/${majorMinorVersion}"
|
2013-05-16 19:34:36 -04:00
|
|
|
)
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
/**
|
|
|
|
* Upload the documentation to the JBoss doc server
|
|
|
|
*/
|
2013-11-22 15:51:56 -05:00
|
|
|
task uploadDocumentation(type:Exec, dependsOn: stageDocumentationForUpload) {
|
2013-05-16 19:34:36 -04:00
|
|
|
description = "Uploads documentation to the JBoss doc server"
|
|
|
|
|
|
|
|
final String url = 'filemgmt.jboss.org:/docs_htdocs/hibernate/';
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
executable 'rsync'
|
2013-05-23 15:07:48 -04:00
|
|
|
args '-avz', '--links', '--protocol=28', "${documentationUploadStagingDir.absolutePath}/", url
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
doFirst {
|
|
|
|
if ( version.endsWith( "SNAPSHOT" ) ) {
|
|
|
|
logger.error( "Cannot perform upload of SNAPSHOT documentation" );
|
|
|
|
throw new RuntimeException( "Cannot perform upload of SNAPSHOT documentation" );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger.lifecycle( "Uploading documentation [{$url}]..." )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle( 'Done uploading documentation' )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Configuration of the distribution plugin, used to build release bundle as both ZIP and TGZ
|
|
|
|
*/
|
2013-04-05 16:15:11 -04:00
|
|
|
distributions {
|
|
|
|
main {
|
|
|
|
baseName = 'hibernate-release'
|
|
|
|
contents {
|
2013-05-16 19:34:36 -04:00
|
|
|
from rootProject.file( 'lgpl.txt' )
|
|
|
|
from rootProject.file( 'changelog.txt' )
|
|
|
|
from rootProject.file( 'hibernate_logo.gif' )
|
2013-04-05 16:15:11 -04:00
|
|
|
|
|
|
|
into('lib/required') {
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.provided.files { dep -> dep.name == 'jta' }
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.runtime
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
|
|
|
// for now,
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.provided.files { dep -> dep.name == 'javassist' }
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-04-05 16:15:11 -04:00
|
|
|
into( 'lib/jpa' ) {
|
|
|
|
from parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-10-28 10:16:47 -04:00
|
|
|
into( 'lib/jpa-metamodel-generator' ) {
|
2013-11-12 10:07:00 -05:00
|
|
|
from parent.project( 'hibernate-jpamodelgen' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
2013-10-28 10:16:47 -04:00
|
|
|
}
|
|
|
|
|
2013-04-05 16:15:11 -04:00
|
|
|
into( 'lib/envers' ) {
|
|
|
|
from(
|
|
|
|
( parent.project( 'hibernate-envers' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
|
|
|
+ parent.project( 'hibernate-envers' ).configurations.runtime )
|
2011-03-18 10:49:00 -04:00
|
|
|
- parent.project( 'hibernate-core' ).configurations.runtime
|
2012-03-26 03:12:10 -04:00
|
|
|
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
2013-04-05 16:15:11 -04:00
|
|
|
- parent.project( 'hibernate-entitymanager' ).configurations.runtime
|
|
|
|
- parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files
|
2011-03-18 10:49:00 -04:00
|
|
|
)
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-06-29 12:46:40 -04:00
|
|
|
into( 'lib/osgi' ) {
|
|
|
|
from(
|
|
|
|
( parent.project( 'hibernate-osgi' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
|
|
|
+ parent.project( 'hibernate-osgi' ).configurations.runtime )
|
|
|
|
- parent.project( 'hibernate-core' ).configurations.runtime
|
|
|
|
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
|
|
|
- parent.project( 'hibernate-entitymanager' ).configurations.runtime
|
|
|
|
- parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2013-04-05 16:15:11 -04:00
|
|
|
// todo : this closure is problematic as it does not write into the hibernate-release-$project.version directory
|
|
|
|
// due to http://issues.gradle.org/browse/GRADLE-1450
|
|
|
|
[ 'hibernate-c3p0', 'hibernate-proxool', 'hibernate-ehcache', 'hibernate-infinispan' ].each { feature ->
|
|
|
|
final String shortName = feature.substring( 'hibernate-'.length() );
|
|
|
|
// WORKAROUND http://issues.gradle.org/browse/GRADLE-1450
|
|
|
|
// into('lib/optional/' + shortName) {
|
|
|
|
owner.into('lib/optional/' + shortName) {
|
|
|
|
from (
|
|
|
|
( parent.project( feature ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
|
|
|
|
+ parent.project( feature ).configurations.runtime )
|
|
|
|
- parent.project( 'hibernate-core' ).configurations.runtime
|
|
|
|
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2011-03-18 10:49:00 -04:00
|
|
|
|
2013-04-05 16:15:11 -04:00
|
|
|
into('documentation') {
|
2013-05-17 15:29:33 -04:00
|
|
|
from documentationDir
|
2013-04-05 16:15:11 -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' )
|
|
|
|
}
|
2011-03-18 10:49:00 -04:00
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-22 15:51:56 -05:00
|
|
|
distZip.dependsOn assembleDocumentation
|
|
|
|
distTar.dependsOn assembleDocumentation
|
2013-04-05 17:53:29 -04:00
|
|
|
distTar {
|
|
|
|
compression = Compression.GZIP
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
/**
|
|
|
|
* "virtual" task for building both types of dist bundles
|
|
|
|
*/
|
|
|
|
task buildBundles(type: Task, dependsOn: [distZip,distTar]) {
|
|
|
|
description = "Builds all release bundles"
|
|
|
|
}
|
|
|
|
|
|
|
|
task uploadBundles(type: Exec, dependsOn: buildBundles) {
|
|
|
|
description = "Uploads release bundles to SourceForge"
|
|
|
|
|
2015-04-30 00:21:38 -04:00
|
|
|
final String url = "frs.sourceforge.net:/home/frs/project/hibernate/hibernate-orm/${majorVersion}/${version}";
|
2013-05-16 19:34:36 -04:00
|
|
|
|
|
|
|
executable 'rsync'
|
|
|
|
args '-vr', '-e ssh', "${project.buildDir}/distributions/", url
|
|
|
|
|
|
|
|
doFirst {
|
|
|
|
if ( version.endsWith( "SNAPSHOT" ) ) {
|
|
|
|
logger.error( "Cannot perform upload of SNAPSHOT documentation" );
|
|
|
|
throw new RuntimeException( "Cannot perform upload of SNAPSHOT bundles" )
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
logger.lifecycle( "Uploading release bundles [${url}]..." )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
logger.lifecycle( 'Done uploading release bundles' )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Full release related tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
task cleanAllSubProjects(type: Task) {
|
|
|
|
description = 'Performs clean on all sub-projects'
|
|
|
|
}
|
|
|
|
|
|
|
|
task testAllSubProjects(type: Task) {
|
|
|
|
description = 'Performs test on all sub-projects'
|
|
|
|
}
|
|
|
|
|
|
|
|
task publishAllSubProjects(type: Task) {
|
|
|
|
description = 'Performs publish on all sub-projects'
|
|
|
|
}
|
|
|
|
|
|
|
|
task buildAllSubProjects(type: Task, dependsOn: [testAllSubProjects,publishAllSubProjects])
|
|
|
|
|
|
|
|
task uploadReleaseArtifacts(type: Task, dependsOn: [uploadDocumentation, uploadBundles])
|
|
|
|
|
|
|
|
task announce(type: Task) { doFirst { println 'Hear ye, hear ye...' } }
|
|
|
|
|
2014-01-22 10:50:55 -05:00
|
|
|
task release(type: Task, dependsOn: [buildAllSubProjects, uploadReleaseArtifacts, announce]) {
|
|
|
|
description = "Coordinates all release tasks; does not perform a clean first (see cleanAndRelease task)"
|
2013-05-16 19:34:36 -04:00
|
|
|
}
|
|
|
|
|
2014-01-22 12:14:18 -05:00
|
|
|
task cleanAndRelease(type: Task, dependsOn: [cleanAllSubProjects, release]) {
|
|
|
|
description = "Coordinates all release tasks *including clean*"
|
|
|
|
}
|
|
|
|
|
2013-05-16 19:34:36 -04:00
|
|
|
|
|
|
|
// must-run-afters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
buildAllSubProjects.mustRunAfter cleanAllSubProjects
|
|
|
|
|
|
|
|
publishAllSubProjects.mustRunAfter testAllSubProjects
|
|
|
|
publishAllSubProjects.mustRunAfter cleanAllSubProjects
|
|
|
|
|
|
|
|
uploadReleaseArtifacts.mustRunAfter buildAllSubProjects
|
|
|
|
|
|
|
|
announce.mustRunAfter uploadReleaseArtifacts
|
|
|
|
|
|
|
|
|
|
|
|
// sub-project task dependencies ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
rootProject.subprojects { Project subproject ->
|
|
|
|
final Task subprojectCleanTask = subproject.tasks.findByPath( 'clean' );
|
|
|
|
if ( subprojectCleanTask != null ) {
|
|
|
|
cleanAllSubProjects.dependsOn subprojectCleanTask
|
|
|
|
}
|
|
|
|
|
|
|
|
final Task subprojectTestTask = subproject.tasks.findByPath( 'test' );
|
|
|
|
if ( subprojectTestTask != null ) {
|
|
|
|
testAllSubProjects.dependsOn subprojectTestTask
|
|
|
|
}
|
|
|
|
|
|
|
|
final Task subprojectPublishTask = subproject.tasks.findByPath( 'publish' );
|
|
|
|
if ( subprojectPublishTask != null ) {
|
|
|
|
publishAllSubProjects.dependsOn subprojectPublishTask
|
|
|
|
}
|
2010-10-12 16:39:33 -04:00
|
|
|
}
|