HHH-6000 - split annotation processor execution out into separate tasks
This commit is contained in:
parent
8e71b82183
commit
43b812c1de
87
build.gradle
87
build.gradle
|
@ -100,6 +100,12 @@ subprojects { subProject ->
|
||||||
// todo : need to make sure these are non-exported
|
// todo : need to make sure these are non-exported
|
||||||
description = 'Non-exported compile-time dependencies.'
|
description = 'Non-exported compile-time dependencies.'
|
||||||
}
|
}
|
||||||
|
jbossLoggingTool {
|
||||||
|
description = "Dependencies for running the JBoss logging AnnotationProcessor tool"
|
||||||
|
}
|
||||||
|
hibernateJpaModelGenTool {
|
||||||
|
description = "Dependencies for running the Hibernate JPA Metamodel Generator AnnotationProcessor tool"
|
||||||
|
}
|
||||||
deployerJars {
|
deployerJars {
|
||||||
description = 'Jars needed for doing deployment to JBoss Nexus repo'
|
description = 'Jars needed for doing deployment to JBoss Nexus repo'
|
||||||
}
|
}
|
||||||
|
@ -108,7 +114,6 @@ subprojects { subProject ->
|
||||||
// appropriately inject the common dependencies into each sub-project
|
// appropriately inject the common dependencies into each sub-project
|
||||||
dependencies {
|
dependencies {
|
||||||
compile( libraries.logging )
|
compile( libraries.logging )
|
||||||
compile( libraries.logging_tools )
|
|
||||||
compile( libraries.slf4j_api )
|
compile( libraries.slf4j_api )
|
||||||
testCompile( libraries.junit )
|
testCompile( libraries.junit )
|
||||||
testCompile( libraries.atomikos )
|
testCompile( libraries.atomikos )
|
||||||
|
@ -118,42 +123,64 @@ subprojects { subProject ->
|
||||||
testRuntime( libraries.jcl )
|
testRuntime( libraries.jcl )
|
||||||
testRuntime( libraries.javassist )
|
testRuntime( libraries.javassist )
|
||||||
testRuntime( libraries.h2 )
|
testRuntime( libraries.h2 )
|
||||||
|
jbossLoggingTool( libraries.logging_tools )
|
||||||
|
hibernateJpaModelGenTool( libraries.jpa_modelgen )
|
||||||
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
|
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
|
||||||
}
|
}
|
||||||
|
|
||||||
generatedSrcDirName = buildDirName + "/generated-src/main/java"
|
generatedLoggingSrcMainDir = dir( buildDirName + "/generated-src/logging/main" )
|
||||||
generatedSrcDir = dir( generatedSrcDirName )
|
generatedLoggingSrcTestDir = dir( buildDirName + "/generated-src/logging/test" )
|
||||||
|
|
||||||
task compileJavaAnnotations(type: Compile, dependsOn: generatedSrcDir) {
|
|
||||||
classpath = compileJava.classpath
|
|
||||||
source = compileJava.source
|
|
||||||
destinationDir = compileJava.destinationDir
|
|
||||||
options.define(compilerArgs: ["-proc:only", "-s", "$generatedSrcDir.dir.absolutePath"])
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava.dependsOn compileJavaAnnotations
|
|
||||||
compileJava.source += fileTree(generatedSrcDirName)
|
|
||||||
compileJava.options.define(compilerArgs: ["-proc:none"])
|
|
||||||
|
|
||||||
generatedTestSrcDirName = buildDirName + "/generated-src/test/java"
|
|
||||||
generatedTestSrcDir = dir( generatedTestSrcDirName )
|
|
||||||
|
|
||||||
task compileTestJavaAnnotations(type: Compile, dependsOn: generatedTestSrcDir) {
|
|
||||||
classpath = compileTestJava.classpath
|
|
||||||
source = compileTestJava.source
|
|
||||||
destinationDir = compileTestJava.destinationDir
|
|
||||||
options.define(compilerArgs: ["-proc:only", "-s", "$generatedTestSrcDir.dir.absolutePath"])
|
|
||||||
}
|
|
||||||
|
|
||||||
compileTestJava.dependsOn compileTestJavaAnnotations
|
|
||||||
compileTestJava.source += fileTree(generatedTestSrcDirName)
|
|
||||||
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
|
||||||
|
|
||||||
sourceSets{
|
sourceSets{
|
||||||
main {
|
main {
|
||||||
|
java {
|
||||||
|
srcDir( generatedLoggingSrcMainDir.dir )
|
||||||
|
}
|
||||||
compileClasspath += configurations.provided
|
compileClasspath += configurations.provided
|
||||||
}
|
}
|
||||||
|
test {
|
||||||
|
java {
|
||||||
|
srcDir( generatedLoggingSrcTestDir.dir )
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
task generateMainLoggingClasses(type: Compile, dependsOn: generatedLoggingSrcMainDir) {
|
||||||
|
classpath = compileJava.classpath + configurations.jbossLoggingTool
|
||||||
|
source = compileJava.source
|
||||||
|
destinationDir = generatedLoggingSrcMainDir.dir
|
||||||
|
options.define(
|
||||||
|
compilerArgs: [
|
||||||
|
"-nowarn",
|
||||||
|
"-proc:only",
|
||||||
|
"-processor", "org.jboss.logging.LoggingToolsProcessor",
|
||||||
|
"-s", "$generatedLoggingSrcMainDir.dir.absolutePath"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava.dependsOn generateMainLoggingClasses
|
||||||
|
compileJava.options.define(compilerArgs: ["-proc:none"])
|
||||||
|
|
||||||
|
|
||||||
|
task generateTestLoggingClasses(type: Compile, dependsOn: generatedLoggingSrcTestDir) {
|
||||||
|
classpath = compileTestJava.classpath + configurations.jbossLoggingTool
|
||||||
|
source = compileTestJava.source
|
||||||
|
destinationDir = generatedLoggingSrcTestDir.dir
|
||||||
|
options.define(
|
||||||
|
compilerArgs: [
|
||||||
|
"-nowarn",
|
||||||
|
"-proc:only",
|
||||||
|
"-processor", "org.jboss.logging.LoggingToolsProcessor",
|
||||||
|
"-s", "$generatedLoggingSrcTestDir.dir.absolutePath"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
compileTestJava.dependsOn generateTestLoggingClasses
|
||||||
|
compileTestJava.options.define(compilerArgs: ["-proc:none"])
|
||||||
|
|
||||||
|
|
||||||
manifest.mainAttributes(
|
manifest.mainAttributes(
|
||||||
provider: 'gradle',
|
provider: 'gradle',
|
||||||
|
@ -190,8 +217,8 @@ subprojects { subProject ->
|
||||||
whenConfigured { module ->
|
whenConfigured { module ->
|
||||||
module.dependencies*.exported = true
|
module.dependencies*.exported = true
|
||||||
}
|
}
|
||||||
testSourceDirs.add( file( generatedSrcDirName ) )
|
// testSourceDirs.add( file( generatedSrcDirName ) )
|
||||||
testSourceDirs.add( file( generatedTestSrcDirName ) )
|
// testSourceDirs.add( file( generatedTestSrcDirName ) )
|
||||||
}
|
}
|
||||||
eclipseClasspath {
|
eclipseClasspath {
|
||||||
plusConfigurations.add( configurations.provided )
|
plusConfigurations.add( configurations.provided )
|
||||||
|
|
|
@ -20,6 +20,33 @@ dependencies {
|
||||||
testRuntime( libraries.validator )
|
testRuntime( libraries.validator )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"])
|
||||||
|
|
||||||
|
|
||||||
bundlesTargetDirName = "$buildDirName/bundles"
|
bundlesTargetDirName = "$buildDirName/bundles"
|
||||||
bundlesTargetDir = dir( bundlesTargetDirName )
|
bundlesTargetDir = dir( bundlesTargetDirName )
|
||||||
task copyBundleResources (type: Copy) {
|
task copyBundleResources (type: Copy) {
|
||||||
|
|
Loading…
Reference in New Issue