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

158 lines
5.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>.
*/
plugins {
id "org.wildfly.build.provision" version '0.0.11'
id "org.wildfly.build.featurepack" version '0.0.11'
}
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'
project.tasks.jar.enabled = false
project.tasks.javadoc.enabled = false
evaluationDependsOn( ':hibernate-core' )
evaluationDependsOn( ':hibernate-envers' )
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-public'
url 'https://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.ormVersion.fullName
// Just the minor ORM version, e.g. "5.3"; Is used as an alias for the exact version
variables['minorSlot'] = rootProject.ormVersion.family
variables['bytebuddySlot'] = bytebuddyVersion
variables['infinispan2lcSlot'] = 'for-orm-' + rootProject.ormVersion.family
//Dependency on another Feature Pack:
dependency "org.wildfly:wildfly-feature-pack:${project.wildflyVersion}" // It will assume it is "zip" by default
//Ensure we declare all source repositories explicitly
autoAddRepositories = false
}
task createCoreFeaturePackZip( type: Zip, dependsOn: [featurepack] ) {
baseName 'hibernate-orm-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" )
//Override HCANN:
override( 'org.hibernate.common:hibernate-commons-annotations' ) {
version = project.hibernateCommonsVersion
}
variables['wildfly.version'] = project.wildflyVersion
variables['hibernate-orm.version'] = rootProject.ormVersion.fullName
//Ensure we declare all source repositories explicitly
autoAddRepositories = false
}
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-orm-jbossmodules'
description 'Main feature pack of Hibernate ORM: hibernate-core and hibernate-envers, including essential dependencies such as Byte Buddy'
}
}
}
}
task ciBuild( dependsOn: [clean, test, publish] )
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 {
exclude 'org/hibernate/wildfly/model/**'
}
test.dependsOn prepareWildFlyForTests
processTestResources {
expand(
[
wildFlyInstallDir : project.wildFlyInstallDir,
arquillianDeploymentExportDir: "${rootProject.buildDir.absolutePath}/arquillian-deployments"
]
)
}