mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-04-01 04:48:28 +00:00
Build: add animalsniffer to detect usage of java8 apis in client and client-sniffer
This commit is contained in:
parent
2856ab07de
commit
0af9d2c767
@ -87,6 +87,7 @@ dependencies {
|
|||||||
compile 'de.thetaphi:forbiddenapis:2.1'
|
compile 'de.thetaphi:forbiddenapis:2.1'
|
||||||
compile 'com.bmuschko:gradle-nexus-plugin:2.3.1'
|
compile 'com.bmuschko:gradle-nexus-plugin:2.3.1'
|
||||||
compile 'org.apache.rat:apache-rat:0.11'
|
compile 'org.apache.rat:apache-rat:0.11'
|
||||||
|
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.0.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import org.elasticsearch.gradle.precommit.PrecommitTasks
|
|||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
|
|
||||||
apply plugin: 'elasticsearch.build'
|
apply plugin: 'elasticsearch.build'
|
||||||
|
apply plugin: 'ru.vyarus.animalsniffer'
|
||||||
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_7
|
targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
@ -40,9 +41,9 @@ dependencies {
|
|||||||
testCompile "org.apache.lucene:lucene-core:${versions.lucene}"
|
testCompile "org.apache.lucene:lucene-core:${versions.lucene}"
|
||||||
testCompile "org.apache.lucene:lucene-codecs:${versions.lucene}"
|
testCompile "org.apache.lucene:lucene-codecs:${versions.lucene}"
|
||||||
testCompile "org.elasticsearch:securemock:${versions.securemock}"
|
testCompile "org.elasticsearch:securemock:${versions.securemock}"
|
||||||
|
signature "org.codehaus.mojo.signature:java17:1.0@signature"
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO compiling from 1.8 with target 1.7 and source 1.7 is best effort, not enough to ensure we are java 7 compatible
|
|
||||||
compileJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7' << '-Xlint:all,-path,-serial,-options'
|
compileJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7' << '-Xlint:all,-path,-serial,-options'
|
||||||
compileTestJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7'
|
compileTestJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7'
|
||||||
|
|
||||||
@ -56,6 +57,11 @@ forbiddenApisTest {
|
|||||||
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
|
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
animalsnifferTest {
|
||||||
|
//animalsniffer doesn't like sun classes usages (e.g. com.sun.net.httpserver.HttpServer)
|
||||||
|
exclude('org/elasticsearch/client/sniff/HostsSnifferTests.class')
|
||||||
|
}
|
||||||
|
|
||||||
//JarHell is part of es core, which we don't want to pull in
|
//JarHell is part of es core, which we don't want to pull in
|
||||||
jarHell.enabled=false
|
jarHell.enabled=false
|
||||||
//NamingConventionCheck is part of test-framework, which we don't want to pull in as it depends on es core
|
//NamingConventionCheck is part of test-framework, which we don't want to pull in as it depends on es core
|
||||||
|
@ -21,6 +21,7 @@ import org.elasticsearch.gradle.precommit.PrecommitTasks
|
|||||||
import org.gradle.api.JavaVersion
|
import org.gradle.api.JavaVersion
|
||||||
|
|
||||||
apply plugin: 'elasticsearch.build'
|
apply plugin: 'elasticsearch.build'
|
||||||
|
apply plugin: 'ru.vyarus.animalsniffer'
|
||||||
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_7
|
targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_7
|
sourceCompatibility = JavaVersion.VERSION_1_7
|
||||||
@ -38,9 +39,9 @@ dependencies {
|
|||||||
testCompile "org.apache.lucene:lucene-core:${versions.lucene}"
|
testCompile "org.apache.lucene:lucene-core:${versions.lucene}"
|
||||||
testCompile "org.apache.lucene:lucene-codecs:${versions.lucene}"
|
testCompile "org.apache.lucene:lucene-codecs:${versions.lucene}"
|
||||||
testCompile "org.elasticsearch:securemock:${versions.securemock}"
|
testCompile "org.elasticsearch:securemock:${versions.securemock}"
|
||||||
|
signature "org.codehaus.mojo.signature:java17:1.0@signature"
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO compiling from 1.8 with target 1.7 and source 1.7 is best effort, not enough to ensure we are java 7 compatible
|
|
||||||
compileJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7' << '-Xlint:all,-path,-serial,-options'
|
compileJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7' << '-Xlint:all,-path,-serial,-options'
|
||||||
compileTestJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7'
|
compileTestJava.options.compilerArgs << '-target' << '1.7' << '-source' << '1.7'
|
||||||
|
|
||||||
@ -54,6 +55,11 @@ forbiddenApisTest {
|
|||||||
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
|
signaturesURLs = [PrecommitTasks.getResource('/forbidden/jdk-signatures.txt')]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
animalsnifferTest {
|
||||||
|
//animalsniffer doesn't like sun classes usages (e.g. com.sun.net.httpserver.HttpServer)
|
||||||
|
exclude('org/elasticsearch/client/RestClientIntegTests.class')
|
||||||
|
}
|
||||||
|
|
||||||
//JarHell is part of es core, which we don't want to pull in
|
//JarHell is part of es core, which we don't want to pull in
|
||||||
jarHell.enabled=false
|
jarHell.enabled=false
|
||||||
//NamingConventionCheck is part of test-framework, which we don't want to pull in as it depends on es core
|
//NamingConventionCheck is part of test-framework, which we don't want to pull in as it depends on es core
|
||||||
|
Loading…
x
Reference in New Issue
Block a user