HHH-6000 - split annotation processor execution out into separate tasks
This commit is contained in:
parent
97a310d26d
commit
b1a9f36375
54
build.gradle
54
build.gradle
|
@ -128,55 +128,63 @@ subprojects { subProject ->
|
|||
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
|
||||
}
|
||||
|
||||
generatedLoggingSrcMainDir = dir( buildDirName + "/generated-src/logging/main" )
|
||||
generatedLoggingSrcTestDir = dir( buildDirName + "/generated-src/logging/test" )
|
||||
aptDumpDir = file( buildDirName + "/temp/apt" )
|
||||
|
||||
sourceSets{
|
||||
main {
|
||||
java {
|
||||
srcDir( generatedLoggingSrcMainDir.dir )
|
||||
}
|
||||
sourceSets.main {
|
||||
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
|
||||
source = compileJava.source
|
||||
destinationDir = generatedLoggingSrcMainDir.dir
|
||||
source = sourceSets.main.originalJavaSrcDirs
|
||||
destinationDir = aptDumpDir
|
||||
options.define(
|
||||
compilerArgs: [
|
||||
"-nowarn",
|
||||
"-proc:only",
|
||||
"-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.options.define(compilerArgs: ["-proc:none"])
|
||||
|
||||
|
||||
task generateTestLoggingClasses(type: Compile, dependsOn: generatedLoggingSrcTestDir) {
|
||||
task generateTestLoggingClasses(type: Compile) {
|
||||
classpath = compileTestJava.classpath + configurations.jbossLoggingTool
|
||||
source = compileTestJava.source
|
||||
destinationDir = generatedLoggingSrcTestDir.dir
|
||||
source = sourceSets.test.originalJavaSrcDirs
|
||||
destinationDir = aptDumpDir
|
||||
options.define(
|
||||
compilerArgs: [
|
||||
"-nowarn",
|
||||
"-proc:only",
|
||||
"-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.options.define(compilerArgs: ["-proc:none"])
|
||||
|
|
|
@ -19,38 +19,42 @@ dependencies {
|
|||
testRuntime( libraries.validator )
|
||||
}
|
||||
|
||||
generatedJpaMetamodelSrcDir = dir( buildDirName + "/generated-src/jpamodelgen/test" )
|
||||
aptDumpDir = file( buildDirName + "/temp/apt" )
|
||||
|
||||
sourceSets{
|
||||
test {
|
||||
java {
|
||||
srcDir( generatedJpaMetamodelSrcDir.dir )
|
||||
}
|
||||
}
|
||||
sourceSets.test {
|
||||
originalJavaSrcDirs = java.srcDirs
|
||||
generatedJpaMetamodelSrcDir = file( "${buildDir}/generated-src/jpamodelgen/${name}" )
|
||||
java.srcDir generatedJpaMetamodelSrcDir
|
||||
}
|
||||
|
||||
task generateJpaMetamodelClasses(type: Compile, dependsOn: generatedJpaMetamodelSrcDir) {
|
||||
task generateJpaMetamodelClasses(type: Compile) {
|
||||
classpath = compileTestJava.classpath + configurations.hibernateJpaModelGenTool
|
||||
source = compileTestJava.source
|
||||
destinationDir = generatedJpaMetamodelSrcDir.dir
|
||||
source = sourceSets.test.originalJavaSrcDirs
|
||||
destinationDir = aptDumpDir
|
||||
options.define(
|
||||
compilerArgs: [
|
||||
"-proc:only",
|
||||
"-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.options.define(compilerArgs: ["-proc:none"])
|
||||
|
||||
|
||||
bundlesTargetDirName = "$buildDirName/bundles"
|
||||
bundlesTargetDir = dir( bundlesTargetDirName )
|
||||
bundlesTargetDir = file( "$buildDirName/bundles" )
|
||||
task copyBundleResources (type: Copy) {
|
||||
from file('src/test/bundles')
|
||||
into bundlesTargetDir.dir
|
||||
into bundlesTargetDir
|
||||
filter(ReplaceTokens, tokens: [
|
||||
buildDirName: buildDir.absolutePath,
|
||||
'db.dialect': 'org.hibernate.dialect.H2Dialect',
|
||||
|
@ -58,9 +62,11 @@ task copyBundleResources (type: Copy) {
|
|||
'jdbc.user': 'sa',
|
||||
'jdbc.pass': '',
|
||||
'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
|
||||
processTestResources.dependsOn copyBundleResources
|
||||
|
|
Loading…
Reference in New Issue