apply plugin: 'java'
apply plugin: 'com.google.protobuf'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.1'
    }
}

sourceSets {
    src {
        main {
            java {
                srcDirs 'build/generated/source/proto/main/grpc'
                srcDirs 'build/generated/source/proto/main/java'
            }
        }
    }
}

group 'net.grpc.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'io.grpc:grpc-netty:1.49.2'
    implementation "io.grpc:grpc-protobuf:1.49.2"
    implementation "io.grpc:grpc-stub:1.49.2"
    implementation "javax.annotation:javax.annotation-api:1.3.2"
}

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.21.6'
    }

    plugins {
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:1.49.2"
        }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }
}
