hibernate-orm/hibernate-orm-modules/hibernate-orm-modules.gradle

155 lines
5.3 KiB
Groovy
Raw Normal View History

/*
* 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 "org.wildfly.build.provision" version '0.0.5'
id "org.wildfly.build.featurepack" version '0.0.5'
}
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'java'
apply from: rootProject.file( 'gradle/libraries.gradle' )
apply plugin: 'maven-publish'
apply plugin: 'maven-publish-auth'
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
apply plugin: 'build-dashboard'
apply plugin: 'project-report'
apply plugin: 'idea'
project.tasks.jar.enabled = false
project.tasks.javadoc.enabled = false
ext {
// NOTE : `wildflyVersion` comes from libraries.gradle...
// "10" for WildFly 10.x, "11" for 11.x, etc
wildFlyMajorVersion = project.wildflyVersion.split( '\\.' )[0]
bytebuddyVersion = project.byteBuddyVersion
artifactClassifier = "wildfly-${wildFlyMajorVersion}-dist"
wildFlyInstallDir = "$rootProject.buildDir/wildfly"
fpackStagingDir = file( "target/featurepack" ) //Target build directory for the Feature Pack
}
description = "Feature Pack of Hibernate ORM modules for WildFly ${project.wildFlyMajorVersion}"
configurations {
featurePack {
description = "Dependencies to be included in the published Feature Pack"
}
provisioning {
description = "Dependencies which should be made available to the provisioning of WildFly"
}
}
repositories {
mavenLocal()
mavenCentral()
maven {
name 'jboss-nexus'
url "http://repository.jboss.org/nexus/content/groups/public/"
}
}
//This builds the WildFly Feature Packs which define the Hibernate ORM modules
// # Definitions of the modules are in /module-templates
// # Versions of the included libraries are defined in the "featurePack" configuration (below)
// # See the "variables" option to replace tokens in the module definitions
// # This just creates the exploded feature pack: does NOT create a zip nor a publication, which are handled by other tasks below.
featurepack {
moduleTemplates = file( 'module-templates' ) //where to find the templates for module.xml files to generate
destinationDir = project.fpackStagingDir
configurationName 'featurePack'
// Variables to be replaced in the template. N.B. not all variables need to be replaced!
// Exact ORM version, e.g. "5.3.0.Final"
variables['slot'] = rootProject.hibernateVersion
// Just the minor ORM version, e.g. "5.3"; Is used as an alias for the exact version
variables['minorSlot'] = rootProject.hibernateMajorMinorVersion
variables['bytebuddySlot'] = bytebuddyVersion
//Dependency on another Feature Pack:
dependency "org.wildfly:wildfly-feature-pack:${project.wildflyVersion}" // It will assume it is "zip" by default
}
task createCoreFeaturePackZip( type: Zip, dependsOn: [featurepack] ) {
baseName 'hibernate-core-jbossmodules'
from project.fpackStagingDir
}
provision {
dependsOn( createCoreFeaturePackZip )
dependsOn( ":hibernate-envers:jar")
dependsOn( ":hibernate-core:jar")
configuration = file( 'wildfly-server-provisioning.xml' )
destinationDir = file( "$project.wildFlyInstallDir" )
//Replace the JPA API with version 2.2 in the provisioned WildFly server:
override( 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api' ) {
groupId = 'javax.persistence'
artifactId = 'javax.persistence-api'
version = '2.2'
}
/**TODO: explore overriding any other library we might need?
Example: (not currently necessary)
override( 'org.hibernate.common:hibernate-commons-annotations' ) {
version = '5.0.2.Final'
}*/
variables['wildfly.version'] = project.wildflyVersion
variables['hibernate-orm.version'] = rootProject.hibernateVersion
}
dependencies {
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
featurePack libraries.byteBuddy
featurePack project( ":hibernate-core" )
featurePack project( ":hibernate-envers" )
featurePack "org.wildfly:jipijapa-hibernate5:${wildflyVersion}"
}
publishing {
publications {
publishedArtifacts {
artifact( createCoreFeaturePackZip ) {
artifactId 'hibernate-core-jbossmodules'
description 'Main feature pack of Hibernate ORM: hibernate-core and hibernate-envers'
}
}
}
}
task ciBuild( dependsOn: [clean, test, publish] )
2018-02-01 15:00:37 -05:00
task release( dependsOn: [clean, test, bintrayUpload] )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// tasks related to in-container (Arquillian + WF) testing
task prepareWildFlyForTests( dependsOn: [provision] ) {
description = 'Downloads the WildFly distribution, installs it into a local directory, includes present version of Hibernate ORM, JPA 2.2 : ready for integration tests'
}
test.dependsOn prepareWildFlyForTests
processTestResources {
expand(
[
wildFlyInstallDir : project.wildFlyInstallDir,
arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments"
]
)
}