Migrate nullaway config to plugin
MODIFY
build.gradle
build.gradle
@@ -2,19 +2,12 @@ import java.time.Duration
import nebula.plugin.release.git.opinion.Strategies
plugins {
- id 'idea'
+ id("idea")
- id "io.github.gradle-nexus.publish-plugin"
- id "nebula.release"
-
- id 'org.gradle.test-retry' apply false
-
- id 'org.unbroken-dome.test-sets' apply false
- id 'com.github.ben-manes.versions'
-
- id "com.diffplug.spotless"
- id "net.ltgt.errorprone" apply false
- id "net.ltgt.nullaway" apply false
+ id("com.github.ben-manes.versions")
+ id("com.diffplug.spotless")
+ id("io.github.gradle-nexus.publish-plugin")
+ id("nebula.release")
}
release {
@@ -51,28 +44,6 @@ nexusPublishing {
description = 'OpenTelemetry instrumentations for Java'
-allprojects {
- plugins.withId('net.ltgt.nullaway') {
- dependencies {
- 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
- }
- }
- }
- }
- }
-}
-
spotless {
// this formatting is applied at the root level, as some of these files are not in a submodules
// and would be missed otherwise

MODIFY
buildSrc/build.gradle.kts
buildSrc/build.gradle.kts
@@ -51,6 +51,7 @@ dependencies {
// When updating, also update dependencyManagement/dependencyManagement.gradle.kts
implementation("net.bytebuddy:byte-buddy-gradle-plugin:1.11.2")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:2.0.1")
+ implementation("net.ltgt.gradle:gradle-nullaway-plugin:1.1.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.2")

ADD
buildSrc/src/main/kotlin/otel.nullaway-conventions.gradle.kts
+import net.ltgt.gradle.errorprone.CheckSeverity
+import net.ltgt.gradle.errorprone.errorprone
+import net.ltgt.gradle.nullaway.nullaway
+
+plugins {
+ id("net.ltgt.nullaway")
+
+ id("otel.errorprone-conventions")
+}
+
+dependencies {
+ 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.set(CheckSeverity.ERROR)
+ }
+ }
+ }
+}

MODIFY
instrumentation/armeria-1.3/library/build.gradle.kts
instrumentation/armeria-1.3/library/build.gradle.kts
plugins {
id("otel.library-instrumentation")
- id("net.ltgt.nullaway")
+ id("otel.nullaway-conventions")
}
dependencies {

MODIFY
instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts
instrumentation/lettuce/lettuce-5.1/library/build.gradle.kts
plugins {
id("otel.library-instrumentation")
- id("net.ltgt.nullaway")
+ id("otel.nullaway-conventions")
}
dependencies {

MODIFY
instrumentation/mongo/mongo-3.1/library/build.gradle.kts
instrumentation/mongo/mongo-3.1/library/build.gradle.kts
plugins {
id("otel.library-instrumentation")
- id("net.ltgt.nullaway")
+ id("otel.nullaway-conventions")
}
dependencies {

MODIFY
instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts
instrumentation/okhttp/okhttp-3.0/library/build.gradle.kts
plugins {
id("otel.library-instrumentation")
- id("net.ltgt.nullaway")
+ id("otel.nullaway-conventions")
}
dependencies {

MODIFY
settings.gradle
settings.gradle
@@ -4,7 +4,6 @@ pluginManagement {
id "com.github.jk1.dependency-license-report" version "1.16"
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
id "me.champeau.jmh" version "0.6.5"
- 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 "org.xbib.gradle.plugin.jflex" version "1.5.0"

Migrate nullaway config to plugin (#3462)