222 lines
7.4 KiB
Groovy
222 lines
7.4 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>.
|
|
*/
|
|
apply plugin: 'java'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'maven-publish-auth'
|
|
apply plugin: 'build-dashboard'
|
|
apply plugin: 'project-report'
|
|
apply plugin: org.hibernate.build.HibernateBuildPlugin
|
|
apply plugin: 'idea'
|
|
|
|
ext {
|
|
// NOTE : `wildflyVersion` comes from libraries.gradle...
|
|
|
|
// Exact ORM version, e.g. "5.1.1.Final"
|
|
slot = rootProject.hibernateFullVersion
|
|
// Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version
|
|
minorSlot = rootProject.hibernateMajorMinorVersion
|
|
|
|
// "10" for WildFly 10.x, "11" for 11.x, etc
|
|
wildFlyMajorVersion = wildflyVersion.split( '\\.' )[0]
|
|
wildFlyJPA22PatchVersion = '1.0.0.Beta1'
|
|
|
|
artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist"
|
|
|
|
moduleXmlStagingDir = file( "$buildDir/tmp/modules" )
|
|
|
|
wildFlyInstallDirBase = "$rootProject.buildDir.absolutePath/wildfly"
|
|
// this is just a "guess" as to the root directory inside the dist zip
|
|
// todo : Would be better to actually ask the zip
|
|
wildFlyInstallDir = "$wildFlyInstallDirBase/wildfly-${wildflyVersion}"
|
|
|
|
expandedModuleProperties = [
|
|
slot: slot,
|
|
minorSlot: minorSlot,
|
|
version: rootProject.hibernateTargetVersion,
|
|
wildflyVersion: wildflyVersion,
|
|
byteBuddyVersion: byteBuddyVersion
|
|
]
|
|
}
|
|
|
|
mavenPom {
|
|
name = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}"
|
|
description = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}"
|
|
}
|
|
|
|
configurations {
|
|
jipijapa {
|
|
transitive = false
|
|
}
|
|
|
|
wildflyDist
|
|
wildflyJPA22Patch
|
|
byteBuddy
|
|
}
|
|
|
|
dependencies {
|
|
jipijapa "org.wildfly:jipijapa-hibernate5:${wildflyVersion}"
|
|
wildflyDist "org.wildfly:wildfly-dist:${wildflyVersion}@zip"
|
|
byteBuddy libraries.byteBuddy
|
|
wildflyJPA22Patch "org.hibernate.javax.persistence:hibernate-jpa-api-2.2-wildflymodules:${wildFlyJPA22PatchVersion}:wildfly-${wildflyVersion}-patch@zip"
|
|
|
|
testCompile project( ":hibernate-core" )
|
|
testCompile project( ":hibernate-envers" )
|
|
testCompile libraries.junit
|
|
testCompile libraries.arquillian_junit_container
|
|
testCompile libraries.arquillian_protocol_servlet
|
|
testCompile libraries.shrinkwrap_descriptors_api_javaee
|
|
testCompile libraries.shrinkwrap_descriptors_impl_javaee
|
|
testCompile libraries.wildfly_arquillian_container_managed
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Java 9 ftw!
|
|
if ( JavaVersion.current().isJava9Compatible() ) {
|
|
compile( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
|
|
compile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
|
|
compile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
|
|
compile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
|
|
compile( 'javax:javaee-api:7.0' )
|
|
|
|
testCompile( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
|
|
testCompile( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
|
|
testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
|
|
testCompile( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
|
|
testCompile( 'javax:javaee-api:7.0' )
|
|
|
|
testRuntime( 'com.sun.xml.bind:jaxb-impl:2.2.11' )
|
|
testRuntime( 'org.glassfish.jaxb:jaxb-xjc:2.2.11' )
|
|
testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics:0.11.0' )
|
|
testRuntime( 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.11.0' )
|
|
testRuntime( 'javax:javaee-api:7.0' )
|
|
}
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
}
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// tasks related to creating and publishing the module zip
|
|
|
|
task copyAndExpandModuleXml(type: Copy) {
|
|
description 'Performs a copy of the XML files defining the module into a staging directory for the purpose of performing token-replacement'
|
|
|
|
inputs.properties( expandedModuleProperties as Map )
|
|
|
|
into moduleXmlStagingDir
|
|
expand( expandedModuleProperties as Map )
|
|
|
|
into( 'org/hibernate/' + slot ) {
|
|
from 'src/main/modules/org/hibernate/core'
|
|
}
|
|
|
|
into( 'org/hibernate/infinispan/' + slot ) {
|
|
from 'src/main/modules/org/hibernate/infinispan'
|
|
}
|
|
|
|
into( 'org/hibernate/jipijapa-hibernate5/' + slot ) {
|
|
from 'src/main/modules/org/hibernate/jipijapa-hibernate5'
|
|
}
|
|
|
|
// create alias for the short name
|
|
into( 'org/hibernate/' + minorSlot ) {
|
|
from 'src/main/aliases/org/hibernate/core'
|
|
}
|
|
|
|
into( 'org/hibernate/infinispan/' + minorSlot ) {
|
|
from 'src/main/aliases/org/hibernate/infinispan'
|
|
}
|
|
|
|
into( 'org/hibernate/jipijapa-hibernate5/' + minorSlot ) {
|
|
from 'src/main/aliases/org/hibernate/jipijapa-hibernate5'
|
|
}
|
|
}
|
|
|
|
task createModulesZip(type: Zip, dependsOn: [copyAndExpandModuleXml]) {
|
|
baseName 'hibernate-orm-modules'
|
|
classifier artifactClassifier
|
|
|
|
from moduleXmlStagingDir
|
|
|
|
into( 'org/hibernate/' + slot ) {
|
|
from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
|
from parent.project( 'hibernate-envers' ).configurations.archives.allArtifacts.files
|
|
// also need Byte Buddy's jar
|
|
from configurations.byteBuddy
|
|
}
|
|
|
|
into( 'org/hibernate/infinispan/' + slot ) {
|
|
from parent.project( 'hibernate-infinispan' ).configurations.archives.allArtifacts.files.filter{ file -> !file.name.endsWith('-sources.jar') && !file.name.endsWith('-tests.jar') }
|
|
}
|
|
|
|
into( 'org/hibernate/jipijapa-hibernate5/' + slot ) {
|
|
from configurations.jipijapa
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenZip( MavenPublication ) {
|
|
artifact( createModulesZip ) {
|
|
classifier artifactClassifier
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
build.dependsOn createModulesZip
|
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// tasks related to in-container (Arquillian + WF) testing
|
|
|
|
task installWildFly(type: Copy, dependsOn: createModulesZip) {
|
|
description = 'Downloads the WildFly distribution, installs it into a local directory and prepares it for use (in testing)'
|
|
|
|
from configurations.wildflyDist.collect { zipTree(it) }
|
|
into wildFlyInstallDirBase
|
|
|
|
final File patchFile = configurations.wildflyJPA22Patch.resolvedConfiguration.resolvedArtifacts[0].file
|
|
inputs.file( patchFile )
|
|
|
|
doFirst {
|
|
cleanInstallWildFly
|
|
}
|
|
|
|
doLast {
|
|
|
|
// until we have a version of WF supporting EE 8 (JPA 2.2), we need to patch
|
|
// the install to support JPA 2.2
|
|
exec {
|
|
ignoreExitValue = true
|
|
|
|
executable "$wildFlyInstallDir/bin/jboss-cli.sh"
|
|
args "patch apply $patchFile.absolutePath"
|
|
}
|
|
|
|
// and then install the Hibernate
|
|
copy {
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
from zipTree( createModulesZip.archivePath )
|
|
into "${wildFlyInstallDir}/modules"
|
|
}
|
|
}
|
|
}
|
|
|
|
clean.dependsOn cleanInstallWildFly
|
|
|
|
task installHibernateModule( dependsOn: [createModulesZip, installWildFly])
|
|
|
|
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule] )
|
|
|
|
test.dependsOn prepareWildFlyForTests
|
|
|
|
processTestResources {
|
|
expand( wildFlyInstallDir: wildFlyInstallDir, arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments" )
|
|
}
|
|
|
|
|