hibernate-orm/release/release.gradle

378 lines
13 KiB
Groovy

/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
plugins {
id "com.jfrog.bintray" version "1.7"
}
apply plugin: 'base'
apply plugin: 'idea'
apply plugin: 'distribution'
buildDir = "target"
idea.module {
}
final File documentationDir = mkdir( "${project.buildDir}/documentation" );
/**
* Assembles all documentation into the {buildDir}/documentation directory.
*
* Depends on building the docs
*/
task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documentation' ).tasks.buildDocsForPublishing]) {
description = 'Assembles all documentation into the {buildDir}/documentation directory'
doLast {
// 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
// Integrations Guide
copy {
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc/integrationguide"
into "${documentationDir}/integrationguide"
}
// Getting-started Guide
copy {
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc/quickstart"
into "${documentationDir}/quickstart"
}
// Topical Guide
copy {
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc/topical"
into "${documentationDir}/topical"
}
// User Guide
copy {
from "${rootProject.project( 'documentation' ).buildDir}/asciidoc/userguide"
into "${documentationDir}/userguide"
}
// Aggregated JavaDoc
copy {
from "${rootProject.project( 'documentation' ).buildDir}/javadocs"
into "${documentationDir}/javadocs"
}
}
}
/**
* Upload the documentation to the JBoss doc server
*/
task uploadDocumentation(type:Exec, dependsOn: assembleDocumentation) {
description = "Uploads documentation to the JBoss doc server"
final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${rootProject.hibernateMajorMinorVersion}";
executable 'rsync'
args '-avz', '--links', '--protocol=28', "${documentationDir.absolutePath}/", url
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
*/
distributions {
main {
baseName = 'hibernate-release'
contents {
from rootProject.file( 'lgpl.txt' )
from rootProject.file( 'changelog.txt' )
from rootProject.file( '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
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' }
}
// into( 'lib/jpa' ) {
// from parent.project( 'hibernate-entitymanager' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
// }
into( 'lib/spatial' ) {
from(
( parent.project( 'hibernate-spatial' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
+ parent.project( 'hibernate-spatial' ).configurations.runtime )
- parent.project( 'hibernate-core' ).configurations.runtime
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
)
}
into( 'lib/jpa-metamodel-generator' ) {
from parent.project( 'hibernate-jpamodelgen' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') }
}
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 )
- parent.project( 'hibernate-core' ).configurations.runtime
- parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
)
}
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
)
from(
parent.project( 'hibernate-osgi' ).extensions.karafFeatures.featuresXmlFile
)
}
// 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
)
}
}
into('documentation') {
from documentationDir
}
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' )
}
}
}
}
}
distZip.dependsOn assembleDocumentation
distTar.dependsOn assembleDocumentation
distTar {
compression = Compression.GZIP
}
/**
* "virtual" task for building both types of dist bundles
*/
task buildBundles(type: Task, dependsOn: [distZip,distTar]) {
description = "Builds all release bundles"
}
task uploadBundlesSourceForge(type: Exec, dependsOn: buildBundles) {
description = "Uploads release bundles to SourceForge"
final String url = "frs.sourceforge.net:/home/frs/project/hibernate/hibernate-orm/${version}";
executable 'rsync'
args '-vr', '-e ssh', "${project.buildDir}/distributions/", url
doFirst {
if ( version.endsWith( "SNAPSHOT" ) ) {
logger.error( "Cannot perform upload of SNAPSHOT bundles to SourceForge" );
throw new RuntimeException( "Cannot perform upload of SNAPSHOT bundles to SourceForge" )
}
else {
logger.lifecycle( "Uploading release bundles to SourceForge..." )
}
}
doLast {
logger.lifecycle( 'Done uploading release bundles to SourceForge' )
}
}
configurations {
bundles {
description = 'Configuration used to group the archives output from the distribution plugin.'
}
}
artifacts {
bundles distTar
bundles distZip
}
String binTrayUser = null
String binTrayApiKey = null
if ( project.hasProperty( "BINTRAY_USER" ) ) {
binTrayUser = project.property( "BINTRAY_USER" ) as String;
}
if ( binTrayUser == null ) {
binTrayUser = System.getProperty( "BINTRAY_USER" );
}
if ( binTrayUser == null ) {
binTrayUser = System.getenv( "BINTRAY_USER" );
}
if ( binTrayUser == null ) {
binTrayUser = 'UNDEFINED'
}
if ( project.hasProperty( "BINTRAY_APIKEY" ) ) {
binTrayApiKey = project.property( "BINTRAY_APIKEY" ) as String;
}
if ( binTrayApiKey == null ) {
binTrayApiKey = System.getProperty( "BINTRAY_APIKEY" );
}
if ( binTrayApiKey == null ) {
binTrayApiKey = System.getenv( "BINTRAY_APIKEY" );
}
if ( binTrayApiKey == null ) {
binTrayApiKey = 'UNDEFINED'
}
bintray {
user = binTrayUser
key = binTrayApiKey
publish = true
configurations = ['bundles']
pkg {
userOrg = 'hibernate'
repo = 'bundles'
name = 'hibernate-orm'
version {
name = project.version
desc = "The ${project.version} release of the Hibernate ORM project"
gpg {
sign = true
passphrase = 'hibernate'
}
}
}
}
bintrayUpload.dependsOn buildBundles
bintrayUpload {
doFirst {
if ( version.endsWith( "SNAPSHOT" ) ) {
logger.error( "Cannot perform upload of SNAPSHOT bundles to BinTray" );
throw new RuntimeException( "Cannot perform upload of SNAPSHOT bundles to BinTray" )
}
else {
logger.lifecycle( "Uploading release bundles to BinTray..." )
}
}
}
task uploadBundles(dependsOn: [bintrayUpload, uploadBundlesSourceForge]) {
description = 'Performs all release bundle uploads'
}
// 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...' } }
task release(type: Task, dependsOn: [buildAllSubProjects, uploadReleaseArtifacts, announce]) {
description = "Coordinates all release tasks; does not perform a clean first (see cleanAndRelease task)"
}
task cleanAndRelease(type: Task, dependsOn: [cleanAllSubProjects, release]) {
description = "Coordinates all release tasks *including clean*"
}
// 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
}
}