plugins {
    id "java-library"
    id "maven-publish"

    id "me.champeau.gradle.japicmp"
    id "ru.vyarus.animalsniffer"
}

description = "gRPC: OkHttp"

evaluationDependsOn(project(':grpc-core').path)

dependencies {
    api project(':grpc-core')
    implementation libraries.okio,
            libraries.guava,
            libraries.perfmark.api
    // Make okhttp dependencies compile only
    compileOnly libraries.okhttp
    // Tests depend on base class defined by core module.
    testImplementation project(':grpc-core').sourceSets.test.output,
            project(':grpc-api').sourceSets.test.output,
            project(':grpc-testing'),
            libraries.netty.codec.http2,
            libraries.okhttp
    signature libraries.signature.java
    signature libraries.signature.android
}

project.sourceSets {
    main { java { srcDir "${projectDir}/third_party/okhttp/main/java" } }
    test { java { srcDir "${projectDir}/third_party/okhttp/test/java" } }
}

tasks.named("checkstyleMain").configure {
    exclude '**/io/grpc/okhttp/internal/**'
}

tasks.named("javadoc").configure {
    options.links 'http://square.github.io/okhttp/2.x/okhttp/'
    exclude 'io/grpc/okhttp/Internal*'
    exclude 'io/grpc/okhttp/internal/**'
}

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