2011-03-03 11:53:20 -06:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
2010-10-09 13:02:49 -05:00
|
|
|
|
2012-01-03 20:43:15 -06:00
|
|
|
apply plugin: org.hibernate.build.gradle.testing.matrix.MatrixTestingPlugin
|
2011-12-16 09:12:45 -06:00
|
|
|
|
|
|
|
dependencies {
|
2010-10-09 13:02:49 -05:00
|
|
|
compile( project(':hibernate-core') )
|
|
|
|
compile( libraries.dom4j )
|
|
|
|
compile( libraries.commons_annotations )
|
|
|
|
compile( libraries.jpa )
|
|
|
|
compile( libraries.jta )
|
|
|
|
compile( libraries.javassist )
|
2011-03-07 16:20:53 -06:00
|
|
|
testCompile( project(':hibernate-testing') )
|
2010-10-09 13:02:49 -05:00
|
|
|
testCompile( libraries.shrinkwrap_api )
|
|
|
|
testCompile( libraries.shrinkwrap )
|
|
|
|
testCompile( libraries.validation )
|
|
|
|
testRuntime( libraries.validator )
|
|
|
|
}
|
|
|
|
|
2011-12-25 19:59:09 -06:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// JPA model-gen set up
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2012-08-08 17:53:17 +08:00
|
|
|
ext.aptDumpDir = file( "${buildDir}/tmp/apt" )
|
2011-12-25 19:59:09 -06:00
|
|
|
|
|
|
|
sourceSets.test {
|
|
|
|
originalJavaSrcDirs = java.srcDirs
|
2012-08-08 17:53:17 +08:00
|
|
|
ext.generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
|
2011-12-25 19:59:09 -06:00
|
|
|
java.srcDir generatedJpaMetamodelSrcDir
|
|
|
|
}
|
|
|
|
task generateTestJpaMetamodelClasses(type: Compile) {
|
2011-03-09 13:15:47 -06:00
|
|
|
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
|
2011-03-09 15:29:16 -06:00
|
|
|
source = sourceSets.test.originalJavaSrcDirs
|
|
|
|
destinationDir = aptDumpDir
|
2011-03-09 13:15:47 -06:00
|
|
|
options.define(
|
|
|
|
compilerArgs: [
|
|
|
|
"-proc:only",
|
|
|
|
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
|
2011-03-09 15:29:16 -06:00
|
|
|
"-s", "$sourceSets.test.generatedJpaMetamodelSrcDir.absolutePath"
|
2011-03-09 13:15:47 -06:00
|
|
|
]
|
2011-03-09 15:29:16 -06:00
|
|
|
);
|
|
|
|
outputs.dir sourceSets.test.generatedJpaMetamodelSrcDir;
|
|
|
|
doFirst {
|
|
|
|
sourceSets.test.generatedJpaMetamodelSrcDir.mkdirs()
|
|
|
|
}
|
2011-03-09 13:15:47 -06:00
|
|
|
}
|
2011-12-25 19:59:09 -06:00
|
|
|
// 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"])
|
2011-03-09 13:15:47 -06:00
|
|
|
|
2012-06-08 07:59:54 -05:00
|
|
|
|
2011-12-25 19:59:09 -06:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2012-06-08 07:59:54 -05:00
|
|
|
// Process 'bundle resources' for the packaging tests
|
2011-12-25 19:59:09 -06:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
2010-10-26 11:01:39 +02:00
|
|
|
task copyBundleResources (type: Copy) {
|
2012-08-08 17:53:17 +08:00
|
|
|
ext.bundlesTargetDir = file( "${buildDir}/bundles" )
|
2010-10-26 11:01:39 +02:00
|
|
|
from file('src/test/bundles')
|
2011-03-09 15:29:16 -06:00
|
|
|
into bundlesTargetDir
|
2010-10-26 11:01:39 +02:00
|
|
|
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',
|
2011-03-09 15:29:16 -06:00
|
|
|
]);
|
|
|
|
doFirst {
|
|
|
|
bundlesTargetDir.mkdirs()
|
|
|
|
}
|
2010-10-09 13:02:49 -05:00
|
|
|
}
|
2012-06-08 08:08:13 -05:00
|
|
|
processTestResources.dependsOn copyBundleResources
|
2010-10-26 14:47:51 +02:00
|
|
|
|