group 'com.delta.netty'
version '1.0-SNAPSHOT'
//加入grpc插件
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
//源编译和目标编译
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
    // maven库
    def cn = "http://maven.aliyun.com/nexus/content/groups/public/"
    def abroad = "http://central.maven.org/maven2/"
    // 先从url中下载jar若没有找到，则在artifactUrls中寻找
    maven {
        url cn
        artifactUrls abroad
    }
}

dependencies {
    compile group: 'io.netty', name: 'netty-all', version: '4.1.41.Final'
    //protobuf用到的库
    compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.9.2'
    compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.9.2'
    //thrift的库
    compile group: 'org.apache.thrift', name: 'libthrift', version: '0.12.0'
    //grpc用到的库
    compile 'io.grpc:grpc-netty-shaded:1.20.0'
    compile 'io.grpc:grpc-protobuf:1.20.0'
    compile 'io.grpc:grpc-stub:1.20.0'
}

/**
 *以下都是grpc所使用到的gradle插件
 */
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
    }
}

protobuf {
    protoc {
        artifact = "com.google.protobuf:protoc:3.7.1"
    }
    plugins {
        grpc {
            artifact = 'io.grpc:protoc-gen-grpc-java:1.20.0'
        }
    }
    generateProtoTasks {
        all()*.plugins {
            grpc {}
        }
    }
}

