-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
115 lines (100 loc) · 3.56 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
plugins {
id "com.google.protobuf" version "0.8.10"
id "net.ltgt.apt-eclipse" version "0.21"
id "com.github.johnrengelman.shadow" version "5.2.0"
id 'com.google.cloud.tools.jib' version "2.4.0"
id "application"
}
version "0.1"
group "casa.account.v1"
repositories {
mavenCentral()
maven { url "https://jcenter.bintray.com" }
}
configurations {
// for dependencies that are needed for development only
developmentOnly
}
dependencies {
annotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
annotationProcessor "io.micronaut:micronaut-inject-java"
annotationProcessor "io.micronaut:micronaut-validation"
implementation platform("io.micronaut:micronaut-bom:$micronautVersion")
implementation "io.micronaut.grpc:micronaut-grpc-runtime"
implementation "io.micronaut:micronaut-inject"
implementation "io.micronaut:micronaut-validation"
implementation "io.micronaut:micronaut-runtime"
implementation "javax.annotation:javax.annotation-api"
// driver for Cassandra
implementation "com.datastax.oss:java-driver-core:4.6.1"
implementation "com.datastax.oss:java-driver-mapper-processor:4.6.1"
// health and reflections gRPC services
implementation "io.grpc:grpc-services:1.26.0"
// use log4j2 which supports JSON output and opencensus integration
runtimeOnly "org.apache.logging.log4j:log4j-core:2.12.1"
runtimeOnly "org.apache.logging.log4j:log4j-api:2.12.1"
runtimeOnly "org.apache.logging.log4j:log4j-slf4j-impl:2.12.1"
runtimeOnly "io.opencensus:opencensus-contrib-log-correlation-log4j2:0.26.0"
testAnnotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
testImplementation platform("io.micronaut:micronaut-bom:$micronautVersion")
testImplementation "org.junit.jupiter:junit-jupiter-api"
testImplementation "io.micronaut.test:micronaut-test-junit5"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
// opencensus-api is already used in grpc-core library
// just need to add implementation here.
// no instrumentation needed.
implementation "io.opencensus:opencensus-impl:0.24.0"
implementation "io.opencensus:opencensus-exporter-trace-jaeger:0.24.0"
implementation "io.opencensus:opencensus-exporter-trace-stackdriver:0.24.0"
}
test.classpath += configurations.developmentOnly
mainClassName = "casa.account.v1.Application"
ext {
protocVersion = "3.5.1"
grpcVersion = "1.18.0"
}
jib {
from {
image = 'gcr.io/distroless/java:11'
}
container {
jvmFlags = [
'-Xms256m',
'-Xmx512m',
'-Dlog4j2.contextDataInjector=io.opencensus.contrib.logcorrelation.log4j2.OpenCensusTraceContextDataInjector'
]
}
}
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
}
protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
// use JUnit 5 platform
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}
shadowJar {
mergeServiceFiles()
}
tasks.withType(JavaExec) {
classpath += configurations.developmentOnly
jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
}