HHH-6000 - split annotation processor execution out into separate tasks
This commit is contained in:
parent
97a310d26d
commit
b1a9f36375
56
build.gradle
56
build.gradle
|
@ -128,56 +128,64 @@ subprojects { subProject ->
|
||||||
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
|
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
|
||||||
}
|
}
|
||||||
|
|
||||||
generatedLoggingSrcMainDir = dir( buildDirName + "/generated-src/logging/main" )
|
aptDumpDir = file( buildDirName + "/temp/apt" )
|
||||||
generatedLoggingSrcTestDir = dir( buildDirName + "/generated-src/logging/test" )
|
|
||||||
|
|
||||||
sourceSets{
|
sourceSets.main {
|
||||||
main {
|
compileClasspath += configurations.provided
|
||||||
java {
|
|
||||||
srcDir( generatedLoggingSrcMainDir.dir )
|
|
||||||
}
|
|
||||||
compileClasspath += configurations.provided
|
|
||||||
}
|
|
||||||
test {
|
|
||||||
java {
|
|
||||||
srcDir( generatedLoggingSrcTestDir.dir )
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sourceSets.all {
|
||||||
|
originalJavaSrcDirs = java.srcDirs
|
||||||
|
generatedLoggingSrcDir = file( "${buildDir}/generated-src/logging/${name}" )
|
||||||
|
java.srcDir generatedLoggingSrcDir
|
||||||
|
}
|
||||||
|
|
||||||
task generateMainLoggingClasses(type: Compile, dependsOn: generatedLoggingSrcMainDir) {
|
task generateMainLoggingClasses(type: Compile) {
|
||||||
classpath = compileJava.classpath + configurations.jbossLoggingTool
|
classpath = compileJava.classpath + configurations.jbossLoggingTool
|
||||||
source = compileJava.source
|
source = sourceSets.main.originalJavaSrcDirs
|
||||||
destinationDir = generatedLoggingSrcMainDir.dir
|
destinationDir = aptDumpDir
|
||||||
options.define(
|
options.define(
|
||||||
compilerArgs: [
|
compilerArgs: [
|
||||||
"-nowarn",
|
"-nowarn",
|
||||||
"-proc:only",
|
"-proc:only",
|
||||||
"-processor", "org.jboss.logging.LoggingToolsProcessor",
|
"-processor", "org.jboss.logging.LoggingToolsProcessor",
|
||||||
"-s", "$generatedLoggingSrcMainDir.dir.absolutePath"
|
"-s", "$sourceSets.main.generatedLoggingSrcDir.absolutePath"
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
|
outputs.dir sourceSets.main.generatedLoggingSrcDir;
|
||||||
|
doFirst {
|
||||||
|
sourceSets.main.generatedLoggingSrcDir.mkdirs()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for the time being eat the annoying output from running the annotation processors
|
||||||
|
generateMainLoggingClasses.logging.captureStandardError(LogLevel.INFO)
|
||||||
|
|
||||||
compileJava.dependsOn generateMainLoggingClasses
|
compileJava.dependsOn generateMainLoggingClasses
|
||||||
compileJava.options.define(compilerArgs: ["-proc:none"])
|
compileJava.options.define(compilerArgs: ["-proc:none"])
|
||||||
|
|
||||||
|
|
||||||
task generateTestLoggingClasses(type: Compile, dependsOn: generatedLoggingSrcTestDir) {
|
task generateTestLoggingClasses(type: Compile) {
|
||||||
classpath = compileTestJava.classpath + configurations.jbossLoggingTool
|
classpath = compileTestJava.classpath + configurations.jbossLoggingTool
|
||||||
source = compileTestJava.source
|
source = sourceSets.test.originalJavaSrcDirs
|
||||||
destinationDir = generatedLoggingSrcTestDir.dir
|
destinationDir = aptDumpDir
|
||||||
options.define(
|
options.define(
|
||||||
compilerArgs: [
|
compilerArgs: [
|
||||||
"-nowarn",
|
"-nowarn",
|
||||||
"-proc:only",
|
"-proc:only",
|
||||||
"-processor", "org.jboss.logging.LoggingToolsProcessor",
|
"-processor", "org.jboss.logging.LoggingToolsProcessor",
|
||||||
"-s", "$generatedLoggingSrcTestDir.dir.absolutePath"
|
"-s", "$sourceSets.test.generatedLoggingSrcDir.absolutePath"
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
|
outputs.dir sourceSets.test.generatedLoggingSrcDir;
|
||||||
|
doFirst {
|
||||||
|
sourceSets.test.generatedLoggingSrcDir.mkdirs()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for the time being eat the annoying output from running the annotation processors
|
||||||
|
generateTestLoggingClasses.logging.captureStandardError(LogLevel.INFO)
|
||||||
|
|
||||||
compileTestJava.dependsOn generateTestLoggingClasses
|
compileTestJava.dependsOn generateTestLoggingClasses
|
||||||
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
||||||
|
|
||||||
|
|
|
@ -19,38 +19,42 @@ dependencies {
|
||||||
testRuntime( libraries.validator )
|
testRuntime( libraries.validator )
|
||||||
}
|
}
|
||||||
|
|
||||||
generatedJpaMetamodelSrcDir = dir( buildDirName + "/generated-src/jpamodelgen/test" )
|
aptDumpDir = file( buildDirName + "/temp/apt" )
|
||||||
|
|
||||||
sourceSets{
|
sourceSets.test {
|
||||||
test {
|
originalJavaSrcDirs = java.srcDirs
|
||||||
java {
|
generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
|
||||||
srcDir( generatedJpaMetamodelSrcDir.dir )
|
java.srcDir generatedJpaMetamodelSrcDir
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task generateJpaMetamodelClasses(type: Compile, dependsOn: generatedJpaMetamodelSrcDir) {
|
task generateJpaMetamodelClasses(type: Compile) {
|
||||||
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
|
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
|
||||||
source = compileTestJava.source
|
source = sourceSets.test.originalJavaSrcDirs
|
||||||
destinationDir = generatedJpaMetamodelSrcDir.dir
|
destinationDir = aptDumpDir
|
||||||
options.define(
|
options.define(
|
||||||
compilerArgs: [
|
compilerArgs: [
|
||||||
"-proc:only",
|
"-proc:only",
|
||||||
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
|
"-processor", "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor",
|
||||||
"-s", "$generatedJpaMetamodelSrcDir.dir.absolutePath"
|
"-s", "$sourceSets.test.generatedJpaMetamodelSrcDir.absolutePath"
|
||||||
]
|
]
|
||||||
)
|
);
|
||||||
|
outputs.dir sourceSets.test.generatedJpaMetamodelSrcDir;
|
||||||
|
doFirst {
|
||||||
|
sourceSets.test.generatedJpaMetamodelSrcDir.mkdirs()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for the time being eat the annoying output from running the annotation processors
|
||||||
|
generateJpaMetamodelClasses.logging.captureStandardError(LogLevel.INFO)
|
||||||
|
|
||||||
compileTestJava.dependsOn generateJpaMetamodelClasses
|
compileTestJava.dependsOn generateJpaMetamodelClasses
|
||||||
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
||||||
|
|
||||||
|
|
||||||
bundlesTargetDirName = "$buildDirName/bundles"
|
bundlesTargetDir = file( "$buildDirName/bundles" )
|
||||||
bundlesTargetDir = dir( bundlesTargetDirName )
|
|
||||||
task copyBundleResources (type: Copy) {
|
task copyBundleResources (type: Copy) {
|
||||||
from file('src/test/bundles')
|
from file('src/test/bundles')
|
||||||
into bundlesTargetDir.dir
|
into bundlesTargetDir
|
||||||
filter(ReplaceTokens, tokens: [
|
filter(ReplaceTokens, tokens: [
|
||||||
buildDirName: buildDir.absolutePath,
|
buildDirName: buildDir.absolutePath,
|
||||||
'db.dialect': 'org.hibernate.dialect.H2Dialect',
|
'db.dialect': 'org.hibernate.dialect.H2Dialect',
|
||||||
|
@ -58,9 +62,11 @@ task copyBundleResources (type: Copy) {
|
||||||
'jdbc.user': 'sa',
|
'jdbc.user': 'sa',
|
||||||
'jdbc.pass': '',
|
'jdbc.pass': '',
|
||||||
'jdbc.url': 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE',
|
'jdbc.url': 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE',
|
||||||
])
|
]);
|
||||||
|
doFirst {
|
||||||
|
bundlesTargetDir.mkdirs()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
copyBundleResources.dependsOn bundlesTargetDir
|
|
||||||
|
|
||||||
// make sure that the bundles for the packaged test (PackagingTestCase) are copied as well
|
// make sure that the bundles for the packaged test (PackagingTestCase) are copied as well
|
||||||
processTestResources.dependsOn copyBundleResources
|
processTestResources.dependsOn copyBundleResources
|
||||||
|
|
Loading…
Reference in New Issue