2011-03-03 12:53:20 -05:00
|
|
|
import org.apache.tools.ant.filters.ReplaceTokens
|
2010-10-09 14:02:49 -04:00
|
|
|
|
2010-10-26 05:01:39 -04:00
|
|
|
apply plugin: 'java'
|
2010-10-09 14:02:49 -04:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
shrinkwrapVersion = '1.0.0-alpha-6'
|
|
|
|
|
|
|
|
compile( project(':hibernate-core') )
|
|
|
|
compile( libraries.dom4j )
|
|
|
|
compile( libraries.commons_annotations )
|
|
|
|
compile( libraries.jpa )
|
|
|
|
compile( libraries.jta )
|
|
|
|
compile( libraries.javassist )
|
|
|
|
testCompile( project(':hibernate-core').sourceSets.test.classes )
|
|
|
|
testCompile( libraries.junit )
|
|
|
|
testCompile( libraries.shrinkwrap_api )
|
|
|
|
testCompile( libraries.shrinkwrap )
|
|
|
|
testCompile( libraries.validation )
|
|
|
|
testRuntime( libraries.validator )
|
|
|
|
}
|
|
|
|
|
2011-03-09 14:15:47 -05:00
|
|
|
generatedJpaMetamodelSrcDir = dir( buildDirName + "/generated-src/jpamodelgen/test" )
|
|
|
|
|
|
|
|
sourceSets{
|
|
|
|
test {
|
|
|
|
java {
|
|
|
|
srcDir( generatedJpaMetamodelSrcDir.dir )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task generateJpaMetamodelClasses(type: Compile, dependsOn: generatedJpaMetamodelSrcDir) {
|
|
|
|
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
|
|
|
|
source = compileTestJava.source
|
|
|
|
destinationDir = generatedJpaMetamodelSrcDir.dir
|
|
|
|
options.define(
|
|
|
|
compilerArgs: [
|
|
|
|
"-proc:only",
|
|
|
|
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
|
|
|
|
"-s", "$generatedJpaMetamodelSrcDir.dir.absolutePath"
|
|
|
|
]
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
compileTestJava.dependsOn generateJpaMetamodelClasses
|
|
|
|
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
|
|
|
|
|
|
|
|
2010-10-26 08:47:51 -04:00
|
|
|
bundlesTargetDirName = "$buildDirName/bundles"
|
|
|
|
bundlesTargetDir = dir( bundlesTargetDirName )
|
2010-10-26 05:01:39 -04:00
|
|
|
task copyBundleResources (type: Copy) {
|
|
|
|
from file('src/test/bundles')
|
|
|
|
into bundlesTargetDir.dir
|
|
|
|
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',
|
|
|
|
])
|
2010-10-09 14:02:49 -04:00
|
|
|
}
|
2010-10-26 08:47:51 -04:00
|
|
|
copyBundleResources.dependsOn bundlesTargetDir
|
|
|
|
|
|
|
|
// make sure that the bundles for the packaged test (PackagingTestCase) are copied as well
|
2010-10-26 05:01:39 -04:00
|
|
|
processTestResources.dependsOn copyBundleResources
|