-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
88 lines (75 loc) · 2.43 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
group 'example.bidrectional.grpc'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
apply plugin: "com.google.osdetector"
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "io.grpc:grpc-netty:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'org.eclipse.jetty.http2', name: 'http2-client', version: '9.4.7.v20170914'
compile group: 'org.eclipse.jetty.http2', name: 'http2-http-client-transport', version: '9.4.7.v20170914'
compile group: 'org.mortbay.jetty.alpn', name: 'alpn-boot', version: '8.1.11.v20170118'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
def tcnative_classifier = osdetector.classifier
// Fedora variants use a different soname for OpenSSL than other linux distributions
// (see http://netty.io/wiki/forked-tomcat-native.html).
if (osdetector.os == "linux" && osdetector.release.isLike("fedora")) {
tcnative_classifier += "-fedora"
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
}
}
sourceSets {
main {
proto {
srcDirs 'src/main/proto'
}
java {
// include self written and generated code
srcDirs "$projectDir/src/gen/main/java", "$projectDir/src/gen/main/grpc"
}
}
// remove the test configuration - at least in your example you don't have a special test proto file
}
protobuf {
generatedFilesBaseDir = "$projectDir/src/gen"
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {
// To generate deprecated interfaces and static bindService method,
// turn the enable_deprecated option to true below:
option 'enable_deprecated=false'
}
}
}
}
task runServer(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "GrpcExampleServer"
}
task runHeartbeat(type: JavaExec) {
classpath sourceSets.main.runtimeClasspath
main = "HeartbeatCheckHttp2"
}