Skip to content

Commit

Permalink
Only use ErrorProne when building with JDK8
Browse files Browse the repository at this point in the history
ErrorProne is not compatible with JDK9, so the default compiler is used when compiling with JDK9.
See google/error-prone#448.
  • Loading branch information
floscher committed Sep 16, 2017
1 parent 7c3a72e commit 3482975
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "org.kordamp.markdown.convert" version "1.1.0"
id 'org.openstreetmap.josm.gradle.plugin' version '0.1.7'
id "com.github.ben-manes.versions" version "0.15.0"
id "net.ltgt.errorprone" version "0.0.11"
id "net.ltgt.errorprone" version "0.0.11" apply false
}

apply plugin: 'eclipse'
Expand All @@ -17,6 +17,15 @@ apply from: 'gradle/version-functions.gradle'
apply from: 'gradle/tool-config.gradle'
apply from: 'gradle/markdown.gradle'

// Set up ErrorProne (currently only for JDK8, until JDK9 is supported)
if (JavaVersion.current().isJava8()) {
apply plugin: 'net.ltgt.errorprone'
dependencies.errorprone 'com.google.errorprone:error_prone_core:'+property('tool.errorprone.version')
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xep:DefaultCharset:ERROR' << '-Xep:ClassCanBeStatic:ERROR'
}
}

sourceCompatibility = '1.8'
version = getVersionName()
archivesBaseName = 'Mapillary'
Expand All @@ -26,7 +35,6 @@ repositories {
}

dependencies {
errorprone 'com.google.errorprone:error_prone_core:'+property('tool.errorprone.version')
testImplementation ('org.openstreetmap.josm:josm-unittest'){changing=true}
testImplementation 'junit:junit:4.12'
}
Expand Down Expand Up @@ -77,7 +85,6 @@ eclipseProject.dependsOn cleanEclipseProject
tasks.eclipse.dependsOn = ['eclipseClasspath', 'eclipseProject']

tasks.withType(JavaCompile) {
options.compilerArgs << '-Xep:DefaultCharset:ERROR' << '-Xep:ClassCanBeStatic:ERROR'
// Character encoding of Java files
options.encoding = 'UTF-8'
}
Expand Down

0 comments on commit 3482975

Please sign in to comment.