/*
 * Copyright 2016-2020 Andres Almiray
 *
 * This file is part of Java Trove Examples
 *
 * Java Trove Examples is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Java Trove Examples is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Java Trove Examples. If not, see <http://www.gnu.org/licenses/>.
 */

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.11'
    }
}

apply plugin: 'com.google.protobuf'

dependencies {
    api "io.grpc:grpc-netty:${grpcVersion}"
    api "io.grpc:grpc-protobuf:${grpcVersion}"
    api "io.grpc:grpc-stub:${grpcVersion}"
    api("com.google.protobuf:protobuf-java-util:${protobufVersion}") {
        exclude group: 'com.google.guava', module: 'guava'
    }

    api "org.slf4j:slf4j-api:$slf4jVersion"
    api "com.google.guava:guava:$guavaVersion"
    api("com.google.inject:guice:$guiceVersion") {
        exclude group: 'org.sonatype.sisu.inject', module: 'cglib'
    }
    api 'ru.vyarus:guice-ext-annotations:1.3.0'
    api "javax.annotation:javax.annotation-api:$annotationVersion"

    runtimeOnly "org.slf4j:slf4j-simple:$slf4jVersion"
}

idea {
    module {
        generatedSourceDirs += file("${buildDir}/generated/main/java")
        generatedSourceDirs += file("${buildDir}/generated/main/grpc")
    }
}

protobuf {
    generatedFilesBaseDir = file("${buildDir}/generated")

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