plugins {
    id "com.google.protobuf"
}

description = 'OpenTelemetry Examples for gRPC'
ext.moduleName = "io.opentelemetry.examples.grpc"

dependencies {
    implementation "io.opentelemetry:opentelemetry-api"
    implementation "io.opentelemetry:opentelemetry-sdk"
    implementation "io.opentelemetry:opentelemetry-exporter-logging"

    //alpha module
    implementation "io.opentelemetry:opentelemetry-semconv"

    implementation "io.grpc:grpc-protobuf"
    implementation "io.grpc:grpc-stub"
    implementation "io.grpc:grpc-netty-shaded"

    if (JavaVersion.current().isJava9Compatible()) {
        // Workaround for @javax.annotation.Generated
        // see: https://github.com/grpc/grpc-java/issues/3633
        compileOnly "javax.annotation:javax.annotation-api:1.3.2"
    }
}

protobuf {
    protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
    plugins {
        grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
    }
    generateProtoTasks {
        all()*.plugins { grpc {} }
    }
}

// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code.
sourceSets {
    main {
        java {
            srcDirs 'build/generated/source/proto/main/grpc'
            srcDirs 'build/generated/source/proto/main/java'
        }
    }
}
