Skip to content

Commit

Permalink
Use gradle-nullaway-plugin for nullaway. (open-telemetry#3117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuraag Agrawal authored and robododge committed Jun 17, 2021
1 parent 8981148 commit 9b77940
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 20 deletions.
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ plugins {
id "com.diffplug.spotless"
id "com.github.spotbugs" apply false
id "net.ltgt.errorprone" apply false
id "net.ltgt.nullaway" apply false
}

release {
Expand Down Expand Up @@ -71,6 +72,31 @@ allprojects {
downloadSources = false
}
}

plugins.withId('net.ltgt.errorprone') {
plugins.apply('net.ltgt.nullaway')
dependencies {
errorprone "com.google.errorprone:error_prone_core"
errorprone "com.uber.nullaway:nullaway"
}

nullaway {
annotatedPackages.addAll("io.opentelemetry", "com.linecorp.armeria,com.google.common")
}

tasks.withType(JavaCompile).configureEach {
if (!name.toLowerCase().contains("test")) {
options.errorprone {
nullaway {
severity = net.ltgt.gradle.errorprone.CheckSeverity.ERROR
}

// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")
}
}
}
}
}

apply plugin: 'com.diffplug.spotless'
Expand Down
20 changes: 0 additions & 20 deletions gradle/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -240,23 +240,3 @@ tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}

plugins.withId('net.ltgt.errorprone') {
dependencies {
annotationProcessor "com.uber.nullaway:nullaway"
errorprone "com.google.errorprone:error_prone_core"
}

tasks.withType(JavaCompile).configureEach {
if (!name.toLowerCase().contains("test")) {
options.errorprone {
error("NullAway")

// Doesn't work well with Java 8
disable("FutureReturnValueIgnored")

option("NullAway:AnnotatedPackages", "io.opentelemetry,com.linecorp.armeria,com.google.common")
}
}
}
}
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pluginManagement {
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
id "me.champeau.jmh" version "0.6.4"
id "net.ltgt.errorprone" version "1.3.0"
id "net.ltgt.nullaway" version "1.1.0"
id 'org.jetbrains.kotlin.jvm' version '1.5.10'
id 'org.unbroken-dome.test-sets' version '4.0.0'
id "nebula.release" version "15.3.0"
Expand Down

0 comments on commit 9b77940

Please sign in to comment.