HHH-8219 - Adding Animal Sniffer plug-in to make sure only Java 6 APIs are used

This commit is contained in:
Gunnar Morling 2013-05-03 12:33:40 +02:00
parent 23b6f6ab06
commit 77a4c3e52e
2 changed files with 30 additions and 2 deletions

View File

@ -105,6 +105,8 @@ subprojects { subProject ->
configurations { configurations {
all*.exclude group: 'xml-apis', module: 'xml-apis' all*.exclude group: 'xml-apis', module: 'xml-apis'
} }
animalSniffer
javaApiSignature
} }
// appropriately inject the common dependencies into each sub-project // appropriately inject the common dependencies into each sub-project
@ -133,6 +135,9 @@ subprojects { subProject ->
} }
jaxb( libraries.jaxb2_basics ) jaxb( libraries.jaxb2_basics )
jaxb( libraries.jaxb2_ant ) jaxb( libraries.jaxb2_ant )
animalSniffer ( libraries.animal_sniffer )
javaApiSignature ( libraries.java16_signature )
} }
// mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // mac-specific stuff ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -308,8 +313,25 @@ subprojects { subProject ->
} }
} }
// eclipseClasspath will not add sources to classpath unless the dirs actually exist. // eclipseClasspath will not add sources to classpath unless the dirs actually exist.
eclipseClasspath.dependsOn("generateSources") eclipseClasspath.dependsOn("generateSources")
task copyJavaApiSignature(type: Copy) {
from configurations.javaApiSignature
into "$buildDir/javaApiSignature/"
rename '.*signature', 'javaApi.signature'
}
// checks that only types of the target Java version are used
task checkJavaApiSignature << {
ant.taskdef(name: 'animalSniffer', classname: 'org.codehaus.mojo.animal_sniffer.ant.CheckSignatureTask', classpath: configurations.animalSniffer.asPath)
ant.animalSniffer(signature: "$buildDir/javaApiSignature/javaApi.signature", classpath: configurations.compile.asPath + System.properties.'path.separator' + configurations.provided.asPath) {
path(path: "$buildDir/classes/main")
}
}
checkJavaApiSignature.dependsOn compileJava
checkJavaApiSignature.dependsOn copyJavaApiSignature
check.dependsOn checkJavaApiSignature
// specialized API/SPI checkstyle tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // specialized API/SPI checkstyle tasks ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task checkstylePublicSources(type: Checkstyle) { task checkstylePublicSources(type: Checkstyle) {

View File

@ -67,6 +67,12 @@ ext {
jaxb: 'com.sun.xml.bind:jaxb-xjc:2.1.6', jaxb: 'com.sun.xml.bind:jaxb-xjc:2.1.6',
jaxb2_basics: 'org.jvnet.jaxb2_commons:jaxb2-basics:0.6.0', jaxb2_basics: 'org.jvnet.jaxb2_commons:jaxb2-basics:0.6.0',
jaxb2_ant: 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.0', jaxb2_ant: 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.0',
// Animal Sniffer Ant Task and Java 1.6 API signature file
// not using 1.9 for the time being due to MANIMALSNIFFER-34
animal_sniffer: 'org.codehaus.mojo:animal-sniffer-ant-tasks:1.8',
java16_signature: 'org.codehaus.mojo.signature:java16:1.0@signature',
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing // ~~~~~~~~~~~~~~~~~~~~~~~~~~ testing
// logging for testing // logging for testing