forked from Warchant/iroha-pure-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proto.gradle
64 lines (55 loc) · 1.57 KB
/
proto.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
ext {
grpcVersion = '1.12.0'
protobufVersion = '3.5.1'
}
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile "com.google.protobuf:protobuf-java:${protobufVersion}"
compile "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-core:${grpcVersion}"
compile "io.grpc:grpc-java-api-checker:1.1.0"
// netty for desktop
compile "io.grpc:grpc-netty:${grpcVersion}"
// okhttp for android
// compile "io.grpc:grpc-okhttp:${grpcVersion}"
}
protobuf {
generatedFilesBaseDir = "$buildDir/generated"
// Configure the protoc executable
protoc {
// Download from repositories
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all().each { task ->
task.builtins {
// Generates Python code in the output folder:
java { }
}
task.plugins {
grpc {}
}
}
}
}
clean {
delete protobuf.generatedFilesBaseDir
}
idea {
module {
// proto files and generated Java files are automatically added as
// source dirs.
// If you have additional sources, add them here:
sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/java")
sourceDirs += file("${protobuf.generatedFilesBaseDir}/main/grpc")
}
}