-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
92 lines (77 loc) · 3.02 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
buildscript {
repositories {
maven {
// The google mirror is less flaky than mavenCentral()
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
}
dependencies {
// Assumes gradle 2.12 OR HIGHER. Use plugin version 0.7.5 with earlier gradle versions
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
}
}
repositories {
maven {
// The google mirror is less flaky than mavenCentral()
url "https://maven-central.storage-download.googleapis.com/repos/central/data/"
}
mavenLocal()
}
def grpcVersion = '1.16.0'
def nettyTcNativeVersion = '2.0.7.Final'
def protobufVersion = '3.5.1'
def protocVersion = '3.5.1-1'
group 'nl.toefel'
version '1.0-SNAPSHOT'
sourceCompatibility = 11
dependencies {
compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
compile "io.grpc:grpc-alts:${grpcVersion}"
compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
compile "com.google.api.grpc:proto-google-common-protos:1.12.0"
compileOnly "javax.annotation:javax.annotation-api:1.2"
// Used in HelloWorldServerTls
compile "io.grpc:grpc-netty:${grpcVersion}"
compile "io.netty:netty-tcnative-boringssl-static:${nettyTcNativeVersion}"
compile "com.google.protobuf:protobuf-java-util:${protobufVersion}"
testCompile "io.grpc:grpc-testing:${grpcVersion}"
testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-core:1.9.5"
}
protobuf {
// Protobuf will search for the protoc command on the systems path by default,
// but the next line pulls in a specific version of a precompiled protoc without
// requiring it in the system's search path
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
// Plugins for the protobuf compiler. This sections defines a plugin named 'grpc'
// which generates java code from the .proto files.
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
}
//The Protobuf plugin generates a task for each protoc run, which is for a sourceSet
// in a Java project, or a variant in an Android project. The task has configuration
// interfaces that allow you to control the type of outputs, the codegen plugins to use,
// and parameters. This section configures all tasks to include the grpc plugin.
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
// Inform IDEs like IntelliJ IDEA, Eclipse or NetBeans about the generated code. This
// adds the generated sources under build to your project as a 'sources root'.
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
}
// Generate IntelliJ IDEA's .idea & .iml project files
apply plugin: 'idea'
apply plugin: 'eclipse'