/
build.gradle.kts
131 lines (113 loc) · 3.98 KB
/
build.gradle.kts
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import com.google.protobuf.gradle.* // ktlint-disable no-wildcard-imports
import net.ltgt.gradle.errorprone.CheckSeverity
import net.ltgt.gradle.errorprone.errorprone
buildscript {
dependencies {
classpath("com.google.guava:guava:28.1-jre")
}
}
plugins {
idea
eclipse
java
id("com.google.protobuf") version "0.8.10"
id("net.ltgt.errorprone") version "0.8.1"
// id("com.google.cloud.artifactregistry.gradle-plugin") version "2.1.0"
}
repositories {
maven {
url = uri("file://${rootProject.projectDir}/libs/maven")
}
mavenCentral()
google()
// maven("artifactregistry://us-maven.pkg.dev/retail-common-services-249016/spez-maven-repo")
}
dependencies {
implementation(project(":common"))
implementation(Config.Libs.typesafe_config)
implementation(Config.Libs.slf4j)
implementation(Config.Libs.guava)
implementation(Config.Libs.pubsub)
// custom spannerclient implementation
implementation("com.google.spannerclient:spannerclient:0.1.9")
// BOM needed for cloud-spanner
implementation(platform("com.google.cloud:libraries-bom:25.3.0"))
implementation("com.google.cloud:google-cloud-spanner")
// AutoValue
compileOnly("com.google.auto.value:auto-value-annotations:1.6.2")
annotationProcessor("com.google.auto.value:auto-value:1.6.2")
// Avro
implementation("org.apache.avro:avro:1.8.2")
implementation("io.netty:netty-buffer:4.1.33.Final")
// Protobuf
protobuf(files("src/main/protos"))
// Static Analysis
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
annotationProcessor("com.uber.nullaway:nullaway:0.7.5")
errorprone("com.google.errorprone:error_prone_core:2.3.3")
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
// OpenCensus core
compile("io.opencensus:opencensus-api:0.28.3")
compile("io.opencensus:opencensus-contrib-exemplar-util:0.28.3")
runtime("io.opencensus:opencensus-impl:0.28.3")
// Junit and friends
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.6.2")
testImplementation("org.junit.platform:junit-platform-engine:1.6.2")
testImplementation("org.mockito:mockito-core:3.5.2")
testImplementation("org.mockito:mockito-inline:3.5.2")
testImplementation("org.mockito:mockito-junit-jupiter:3.5.2")
testImplementation("org.assertj:assertj-core:3.16.1")
testImplementation("com.google.cloud:google-cloud-spanner:2.0.2")
testImplementation("com.google.guava:guava-testlib:28.0-jre")
testImplementation(Config.Libs.logback_classic)
testImplementation(Config.Libs.logback_core)
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
environment["GOOGLE_APPLICATION_CREDENTIALS"] = System.getenv("GOOGLE_APPLICATION_CREDENTIALS")
environment["GOOGLE_CLOUD_PROJECT"] = System.getenv("GOOGLE_CLOUD_PROJECT")
//systemProperties["gcp.credentials.file"] = project.properties["gcp.credentials.file"]
}
// ErrorProne
tasks.withType<JavaCompile>().configureEach {
options.compilerArgs.add("-Xlint:unchecked")
options.isDeprecation = true
options.errorprone.excludedPaths.set(".*/gen/.*")
options.errorprone.disableWarningsInGeneratedCode.set(true)
if (!name.toLowerCase().contains("test")) {
options.errorprone {
check("NullAway", CheckSeverity.ERROR)
option("NullAway:AnnotatedPackages", "com.uber")
}
}
}
// Protobuf
protobuf {
protoc {
// The artifact spec for the Protobuf Compiler
artifact = "com.google.protobuf:protoc:3.9.1"
}
plugins {
// Optional: an artifact spec for a protoc plugin, with "grpc" as
// the identifier, which can be referred to in the "plugins"
// container of the "generateProtoTasks" closure.
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:1.22.1"
}
}
generateProtoTasks {
ofSourceSet("main").forEach {
it.plugins {
// Apply the "grpc" plugin whose spec is defined above, without options.
id("grpc")
}
}
}
generatedFilesBaseDir = "$projectDir/gen"
}
tasks.register("cleanProtos").configure {
delete("$projectDir/gen")
}