hibernate-orm/hibernate-entitymanager/hibernate-entitymanager.gradle

112 lines
4.2 KiB
Groovy
Raw Normal View History

import org.apache.tools.ant.filters.ReplaceTokens
2012-01-03 21:43:15 -05:00
apply plugin: org.hibernate.build.gradle.testing.matrix.MatrixTestingPlugin
dependencies {
compile( project(':hibernate-core') )
compile( libraries.dom4j )
compile( libraries.commons_annotations )
compile( libraries.jpa )
compile( libraries.jta )
compile( libraries.javassist )
provided( "javax.enterprise:cdi-api:1.0-SP4" )
2011-03-07 17:20:53 -05:00
testCompile( project(':hibernate-testing') )
testCompile( libraries.shrinkwrap_api )
testCompile( libraries.shrinkwrap )
testCompile( libraries.validation )
testRuntime( libraries.validator )
testCompile( "org.jboss.weld.arquillian.container:arquillian-weld-ee-embedded-1.1:1.1.2.Final" )
testCompile( "org.jboss.weld:weld-core:1.1.9.Final" )
testRuntime( "org.glassfish.web:el-impl:2.1.2-b04" )
testRuntime( "org.jboss.ejb3:jboss-ejb3-api:3.1.0" )
}
2013-01-23 18:22:03 -05:00
jar {
manifest {
instruction 'Bundle-Description', 'Hibernate ORM JPA Entity Manager'
instruction 'Bundle-SymbolicName', 'org.hibernate.entitymanager'
// A cdi-api OSGi bundle does not currently exist. For now, explicitly
// ignore its packages. This will only cause issues if an app tries
// to use the BeanManagerListenerFactory functionality.
// NOTE: The "!" negates the package, keeping it out of Import-Package
// and including it in Ignore-Package. Also note that '*' does not mean
// <Import-Package>*</ImportPackage> will occur. This is simply a
// BND instruction -- the auto-discovery of imported packages still
// occurs.
instruction 'Import-Package',
'!javax.enterprise*',
'*'
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
// JPA model-gen set up
////////////////////////////////////////////////////////////////////////////////////////////////////////
sourceSets.test {
originalJavaSrcDirs = java.srcDirs
2012-08-08 05:09:11 -04:00
ext.generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
java.srcDir generatedJpaMetamodelSrcDir
}
task generateTestJpaMetamodelClasses(type: Compile) {
ext.aptDumpDir = file( "${buildDir}/tmp/apt/jpamodelgen" )
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
source = sourceSets.test.originalJavaSrcDirs
destinationDir = aptDumpDir
options.define(
compilerArgs: [
"-proc:only",
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
"-s", "$sourceSets.test.generatedJpaMetamodelSrcDir.absolutePath"
]
);
outputs.dir sourceSets.test.generatedJpaMetamodelSrcDir;
doFirst {
sourceSets.test.generatedJpaMetamodelSrcDir.mkdirs()
}
doLast {
aptDumpDir.delete()
}
}
// for the time being eat the annoying output from running the annotation processors
generateTestJpaMetamodelClasses.logging.captureStandardError(LogLevel.INFO)
compileTestJava.dependsOn generateTestJpaMetamodelClasses
compileTestJava.options.define(compilerArgs: ["-proc:none"])
////////////////////////////////////////////////////////////////////////////////////////////////////////
// Process 'bundle resources' for the packaging tests
////////////////////////////////////////////////////////////////////////////////////////////////////////
task copyBundleResources (type: Copy) {
2012-08-08 05:09:11 -04:00
ext.bundlesTargetDir = file( "${buildDir}/bundles" )
from file('src/test/bundles')
into bundlesTargetDir
filter(ReplaceTokens, tokens: [
buildDirName: buildDir.absolutePath,
'db.dialect': 'org.hibernate.dialect.H2Dialect',
'jdbc.driver': 'org.h2.Driver',
'jdbc.user': 'sa',
'jdbc.pass': '',
'jdbc.url': 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE',
]);
doFirst {
bundlesTargetDir.mkdirs()
}
}
processTestResources.dependsOn copyBundleResources
// create an artifact configuration composed of the test classes so that envers can access hem test classes
task testJar(type: Jar, dependsOn: testClasses) {
classifier = 'test'
2012-08-08 05:09:11 -04:00
from sourceSets.test.output
}
configurations {
tests
}
artifacts {
tests testJar
2012-08-08 05:09:11 -04:00
}