2016-06-27 08:07:08 -04:00
|
|
|
/*
|
|
|
|
* 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>.
|
|
|
|
*/
|
2016-06-29 16:48:20 -04:00
|
|
|
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'
|
|
|
|
|
|
|
|
buildDir = "target"
|
2016-06-27 08:07:08 -04:00
|
|
|
|
2017-12-27 21:19:02 -05:00
|
|
|
test.enabled = false
|
|
|
|
|
2016-06-27 08:07:08 -04:00
|
|
|
ext {
|
|
|
|
// Exact ORM version, e.g. "5.1.1.Final"
|
2016-08-05 11:08:35 -04:00
|
|
|
slot = rootProject.hibernateFullVersion
|
2016-06-27 08:07:08 -04:00
|
|
|
// Just the minor ORM version, e.g. "5.1"; Is used as an alias for the exact version
|
2016-08-05 11:08:35 -04:00
|
|
|
minorSlot = rootProject.hibernateMajorMinorVersion
|
|
|
|
|
|
|
|
final String[] wildFlyVersionComponents = wildflyVersion.split( '\\.' );
|
|
|
|
|
|
|
|
// e.g. "10" for WildFly 10.x
|
|
|
|
wildFlyMajorVersion = wildFlyVersionComponents[0];
|
2017-12-15 08:06:32 -05:00
|
|
|
wildFlyJPA22PatchVersion = '1.0.0.Beta1'
|
2016-08-05 11:08:35 -04:00
|
|
|
|
|
|
|
artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist"
|
2016-06-29 16:48:20 -04:00
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
moduleXmlStagingDir = file( "$buildDir/tmp/modules" )
|
2016-06-27 08:07:08 -04:00
|
|
|
|
2016-08-06 15:05:03 -04:00
|
|
|
wildFlyInstallDirBase = rootProject.buildDir
|
|
|
|
wildFlyInstallDir = "${rootProject.buildDir.absolutePath}/wildfly-${wildflyVersion}"
|
|
|
|
|
|
|
|
expandedModuleProperties = [
|
|
|
|
slot: slot,
|
|
|
|
minorSlot: minorSlot,
|
|
|
|
version: rootProject.hibernateTargetVersion,
|
|
|
|
wildflyVersion: wildflyVersion,
|
2016-10-04 16:43:27 -04:00
|
|
|
byteBuddyVersion: byteBuddyVersion
|
2016-08-06 15:05:03 -04:00
|
|
|
];
|
2016-08-05 11:08:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
mavenPom {
|
|
|
|
name = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}"
|
|
|
|
description = "Hibernate ORM modules for WildFly ${wildFlyMajorVersion}"
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
2016-06-29 16:48:20 -04:00
|
|
|
jipijapa {
|
|
|
|
transitive = false
|
|
|
|
}
|
|
|
|
|
2016-06-27 08:07:08 -04:00
|
|
|
wildflyDist
|
2017-12-15 08:06:32 -05:00
|
|
|
wildflyJPA22Patch
|
2016-10-04 16:43:27 -04:00
|
|
|
byteBuddy
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
jipijapa "org.wildfly:jipijapa-hibernate5:${wildflyVersion}"
|
|
|
|
wildflyDist "org.wildfly:wildfly-dist:${wildflyVersion}@zip"
|
2016-10-04 16:43:27 -04:00
|
|
|
byteBuddy libraries.byteBuddy
|
2017-12-15 08:06:32 -05:00
|
|
|
wildflyJPA22Patch "org.hibernate.javax.persistence:hibernate-jpa-api-2.2-wildflymodules:${wildFlyJPA22PatchVersion}:wildfly-${wildflyVersion}-patch@zip"
|
2016-06-27 08:07:08 -04:00
|
|
|
|
|
|
|
testCompile project( ":hibernate-core" )
|
2016-09-13 15:57:21 -04:00
|
|
|
testCompile project( ":hibernate-envers" )
|
2016-06-27 08:07:08 -04:00
|
|
|
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
|
2017-09-21 06:54:35 -04:00
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// 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' )
|
|
|
|
}
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// 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'
|
|
|
|
|
2016-08-06 15:05:03 -04:00
|
|
|
inputs.properties( expandedModuleProperties as Map )
|
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
into moduleXmlStagingDir
|
2016-08-06 15:05:03 -04:00
|
|
|
expand( expandedModuleProperties as Map )
|
2016-06-27 08:07:08 -04:00
|
|
|
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
|
2016-06-29 16:48:20 -04:00
|
|
|
// create alias for the short name
|
2016-06-27 08:07:08 -04:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
task createModulesZip(type: Zip, dependsOn: [copyAndExpandModuleXml]) {
|
|
|
|
baseName 'hibernate-orm-modules'
|
|
|
|
classifier artifactClassifier
|
2016-06-29 16:48:20 -04:00
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
from moduleXmlStagingDir
|
2016-06-27 08:07:08 -04:00
|
|
|
|
|
|
|
into( 'org/hibernate/' + slot ) {
|
|
|
|
from parent.project( 'hibernate-core' ).configurations.archives.allArtifacts.files
|
|
|
|
from parent.project( 'hibernate-envers' ).configurations.archives.allArtifacts.files
|
2016-10-04 16:43:27 -04:00
|
|
|
// also need Byte Buddy's jar
|
|
|
|
from configurations.byteBuddy
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
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 ) {
|
2016-06-29 16:48:20 -04:00
|
|
|
from configurations.jipijapa
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-29 16:48:20 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
mavenZip( MavenPublication ) {
|
|
|
|
artifact( createModulesZip ) {
|
|
|
|
classifier artifactClassifier
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
build.dependsOn createModulesZip
|
|
|
|
|
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
|
|
|
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
// tasks related to in-container (Arquillian + WF) testing
|
2016-06-27 08:07:08 -04:00
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
task installWildFly(type: Copy) {
|
|
|
|
description = 'Downloads the WildFly distribution and installs it into a local directory (if needed)'
|
2016-07-27 10:53:00 -04:00
|
|
|
|
2016-06-27 08:07:08 -04:00
|
|
|
from {
|
|
|
|
configurations.wildflyDist.collect { zipTree(it) }
|
|
|
|
}
|
2016-08-06 15:05:03 -04:00
|
|
|
into wildFlyInstallDirBase
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
2017-12-15 08:06:32 -05:00
|
|
|
task patchWildFlytoJPA22(type: Copy, dependsOn: [installWildFly]) {
|
|
|
|
description = 'Patch the WildFly server to expose the JPA 2.2 API (instead of JPA 2.1)'
|
|
|
|
from configurations.wildflyJPA22Patch
|
|
|
|
into "$buildDir/jpa22-wildfly-patch"
|
|
|
|
doLast {
|
|
|
|
exec {
|
|
|
|
executable "$wildFlyInstallDirBase/wildfly-$wildflyVersion/bin/jboss-cli.sh"
|
|
|
|
//TODO find out how to reliably skip applying this patch when already applied?
|
|
|
|
//the current solution is close by making this task a 'Copy' rather than Exec,
|
|
|
|
//using the 'into' section as a marker for this being already done,
|
|
|
|
//but it's not very reliable so we need to enable 'ignoreExitValue'.
|
|
|
|
ignoreExitValue = true
|
|
|
|
args "patch apply $buildDir/jpa22-wildfly-patch/hibernate-jpa-api-2.2-wildflymodules-${wildFlyJPA22PatchVersion}-wildfly-$wildflyVersion-patch.zip"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
task installHibernateModule( type:Copy, dependsOn: [createModulesZip, installWildFly]) {
|
2016-06-27 08:07:08 -04:00
|
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
|
|
from zipTree( createModulesZip.archivePath )
|
2016-08-06 15:05:03 -04:00
|
|
|
into "${wildFlyInstallDir}/modules"
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
2017-12-15 08:06:32 -05:00
|
|
|
task prepareWildFlyForTests( dependsOn: [installWildFly, installHibernateModule, patchWildFlytoJPA22] )
|
2016-08-05 11:08:35 -04:00
|
|
|
|
|
|
|
test.dependsOn prepareWildFlyForTests
|
2016-06-27 08:07:08 -04:00
|
|
|
|
2016-06-29 16:48:20 -04:00
|
|
|
processTestResources {
|
2016-08-06 15:05:03 -04:00
|
|
|
expand( wildFlyInstallDir: wildFlyInstallDir, arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments" )
|
2016-06-27 08:07:08 -04:00
|
|
|
}
|
|
|
|
|
2016-08-05 11:08:35 -04:00
|
|
|
|