plugins {
    id "java"
    id "maven-publish"
    id "com.google.protobuf"
    id "jacoco"
    id "ru.vyarus.animalsniffer"
}

description = "gRPC: RouteLookupService Loadbalancing plugin"

dependencies {
    implementation project(':grpc-core'),
            project(':grpc-protobuf'),
            project(':grpc-stub'),
            libraries.auto.value.annotations,
            libraries.guava
    annotationProcessor libraries.auto.value
    compileOnly libraries.javax.annotation
    testImplementation libraries.truth,
            project(':grpc-grpclb'),
            project(':grpc-testing'),
            project(':grpc-testing-proto'),
            testFixtures(project(':grpc-core'))
    signature libraries.signature.java
}

tasks.named("compileJava").configure {
    it.options.compilerArgs += [
            // only has AutoValue annotation processor
            "-Xlint:-processing",
    ]
    appendToProperty(
            it.options.errorprone.excludedPaths,
            ".*/build/generated/sources/annotationProcessor/java/.*",
            "|")
}

tasks.named("javadoc").configure {
    // Do not publish javadoc since currently there is no public API.
    failOnError false  // no public or protected classes found to document
    exclude 'io/grpc/lookup/v1/**'
    exclude 'io/grpc/rls/internal/**'
    exclude 'io/grpc/rls/Internal*'
}

tasks.named("jacocoTestReport").configure {
    classDirectories.from = sourceSets.main.output.collect {
        fileTree(dir: it, exclude: ['**/io/grpc/lookup/**'])
    }
}

configureProtoCompilation()
