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'
|
2011-08-31 12:08:29 -04:00
|
|
|
apply plugin: org.hibernate.gradle.testing.matrix.MatrixTestingPlugin
|
2010-10-09 14:02:49 -04:00
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
|
|
|
compile( project(':hibernate-core') )
|
|
|
|
compile( libraries.dom4j )
|
|
|
|
compile( libraries.commons_annotations )
|
|
|
|
compile( libraries.jpa )
|
|
|
|
compile( libraries.jta )
|
|
|
|
compile( libraries.javassist )
|
2011-03-07 17:20:53 -05:00
|
|
|
testCompile( project(':hibernate-testing') )
|
2010-10-09 14:02:49 -04:00
|
|
|
testCompile( libraries.junit )
|
|
|
|
testCompile( libraries.shrinkwrap_api )
|
|
|
|
testCompile( libraries.shrinkwrap )
|
|
|
|
testCompile( libraries.validation )
|
|
|
|
testRuntime( libraries.validator )
|
|
|
|
}
|
|
|
|
|
2011-04-13 23:33:54 -04:00
|
|
|
aptDumpDir = file( buildDirName + "/tmp/apt" )
|
2011-03-09 14:15:47 -05:00
|
|
|
|
2011-03-09 16:29:16 -05:00
|
|
|
sourceSets.test {
|
|
|
|
originalJavaSrcDirs = java.srcDirs
|
|
|
|
generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
|
|
|
|
java.srcDir generatedJpaMetamodelSrcDir
|
2011-03-09 14:15:47 -05:00
|
|
|
}
|
2011-11-20 21:16:30 -05:00
|
|
|
compileMatrixJava.options.define(compilerArgs: ["-proc:none", "-encoding", "UTF-8"])
|
2011-08-30 03:20:51 -04:00
|
|
|
sourceSets {
|
|
|
|
matrix {
|
|
|
|
java {
|
|
|
|
srcDir 'src/matrix/java'
|
|
|
|
}
|
|
|
|
resources {
|
|
|
|
srcDir 'src/matrix/resources'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-13 23:33:54 -04:00
|
|
|
ideaModule {
|
|
|
|
excludeDirs += file("$buildDir/bundles")
|
2011-08-30 03:20:51 -04:00
|
|
|
testSourceDirs += file( 'src/matrix/java')
|
|
|
|
testSourceDirs += file( 'src/matrix/resources')
|
2011-04-13 23:33:54 -04:00
|
|
|
}
|
|
|
|
|
2011-03-09 16:29:16 -05:00
|
|
|
task generateJpaMetamodelClasses(type: Compile) {
|
2011-03-09 14:15:47 -05:00
|
|
|
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
|
2011-03-09 16:29:16 -05:00
|
|
|
source = sourceSets.test.originalJavaSrcDirs
|
|
|
|
destinationDir = aptDumpDir
|
2011-03-09 14:15:47 -05:00
|
|
|
options.define(
|
|
|
|
compilerArgs: [
|
|
|
|
"-proc:only",
|
|
|
|
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
|
2011-03-09 16:29:16 -05:00
|
|
|
"-s", "$sourceSets.test.generatedJpaMetamodelSrcDir.absolutePath"
|
2011-03-09 14:15:47 -05:00
|
|
|
]
|
2011-03-09 16:29:16 -05:00
|
|
|
);
|
|
|
|
outputs.dir sourceSets.test.generatedJpaMetamodelSrcDir;
|
|
|
|
doFirst {
|
|
|
|
sourceSets.test.generatedJpaMetamodelSrcDir.mkdirs()
|
|
|
|
}
|
2011-03-09 14:15:47 -05:00
|
|
|
}
|
|
|
|
|
2011-03-09 16:29:16 -05:00
|
|
|
// for the time being eat the annoying output from running the annotation processors
|
|
|
|
generateJpaMetamodelClasses.logging.captureStandardError(LogLevel.INFO)
|
|
|
|
|
2011-03-09 14:15:47 -05:00
|
|
|
compileTestJava.dependsOn generateJpaMetamodelClasses
|
|
|
|
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
|
|
|
|
|
|
|
|
2011-03-09 16:29:16 -05:00
|
|
|
bundlesTargetDir = file( "$buildDirName/bundles" )
|
2010-10-26 05:01:39 -04:00
|
|
|
task copyBundleResources (type: Copy) {
|
|
|
|
from file('src/test/bundles')
|
2011-03-09 16:29:16 -05:00
|
|
|
into bundlesTargetDir
|
2010-10-26 05:01:39 -04: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 16:29:16 -05:00
|
|
|
]);
|
|
|
|
doFirst {
|
|
|
|
bundlesTargetDir.mkdirs()
|
|
|
|
}
|
2010-10-09 14:02:49 -04:00
|
|
|
}
|
2010-10-26 08:47:51 -04:00
|
|
|
|
|
|
|
// 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
|