xref: /aosp_15_r20/external/grpc-grpc-java/benchmarks/build.gradle (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1*e07d83d3SAndroid Build Coastguard Workerplugins {
2*e07d83d3SAndroid Build Coastguard Worker    id "application"
3*e07d83d3SAndroid Build Coastguard Worker    id "java"
4*e07d83d3SAndroid Build Coastguard Worker    id "maven-publish"
5*e07d83d3SAndroid Build Coastguard Worker
6*e07d83d3SAndroid Build Coastguard Worker    id "com.google.protobuf"
7*e07d83d3SAndroid Build Coastguard Worker    id "me.champeau.jmh"
8*e07d83d3SAndroid Build Coastguard Worker    id "ru.vyarus.animalsniffer"
9*e07d83d3SAndroid Build Coastguard Worker}
10*e07d83d3SAndroid Build Coastguard Worker
11*e07d83d3SAndroid Build Coastguard Workerdescription = "grpc Benchmarks"
12*e07d83d3SAndroid Build Coastguard Worker
13*e07d83d3SAndroid Build Coastguard Workertasks.named("jmh").configure {
14*e07d83d3SAndroid Build Coastguard Worker    jvmArgs = ["-server", "-Xms2g", "-Xmx2g"]
15*e07d83d3SAndroid Build Coastguard Worker}
16*e07d83d3SAndroid Build Coastguard Worker
17*e07d83d3SAndroid Build Coastguard Workerconfigurations {
18*e07d83d3SAndroid Build Coastguard Worker    alpnagent
19*e07d83d3SAndroid Build Coastguard Worker}
20*e07d83d3SAndroid Build Coastguard Worker
21*e07d83d3SAndroid Build Coastguard Workerdependencies {
22*e07d83d3SAndroid Build Coastguard Worker    implementation project(':grpc-core'),
23*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-netty'),
24*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-okhttp'),
25*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-stub'),
26*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-protobuf'),
27*e07d83d3SAndroid Build Coastguard Worker            project(':grpc-testing'),
28*e07d83d3SAndroid Build Coastguard Worker            project(path: ':grpc-xds', configuration: 'shadow'),
29*e07d83d3SAndroid Build Coastguard Worker            libraries.hdrhistogram,
30*e07d83d3SAndroid Build Coastguard Worker            libraries.netty.tcnative,
31*e07d83d3SAndroid Build Coastguard Worker            libraries.netty.tcnative.classes,
32*e07d83d3SAndroid Build Coastguard Worker            libraries.commons.math3
33*e07d83d3SAndroid Build Coastguard Worker    implementation (libraries.netty.transport.epoll) {
34*e07d83d3SAndroid Build Coastguard Worker        artifact {
35*e07d83d3SAndroid Build Coastguard Worker            classifier = "linux-x86_64"
36*e07d83d3SAndroid Build Coastguard Worker        }
37*e07d83d3SAndroid Build Coastguard Worker    }
38*e07d83d3SAndroid Build Coastguard Worker    compileOnly libraries.javax.annotation
39*e07d83d3SAndroid Build Coastguard Worker    alpnagent libraries.jetty.alpn.agent
40*e07d83d3SAndroid Build Coastguard Worker
41*e07d83d3SAndroid Build Coastguard Worker    testImplementation libraries.junit,
42*e07d83d3SAndroid Build Coastguard Worker            libraries.mockito.core
43*e07d83d3SAndroid Build Coastguard Worker
44*e07d83d3SAndroid Build Coastguard Worker    signature libraries.signature.java
45*e07d83d3SAndroid Build Coastguard Worker}
46*e07d83d3SAndroid Build Coastguard Worker
47*e07d83d3SAndroid Build Coastguard Workerimport net.ltgt.gradle.errorprone.CheckSeverity
48*e07d83d3SAndroid Build Coastguard Worker
49*e07d83d3SAndroid Build Coastguard Workertasks.named("compileJava").configure {
50*e07d83d3SAndroid Build Coastguard Worker    // The Control.Void protobuf clashes
51*e07d83d3SAndroid Build Coastguard Worker    options.errorprone.check("JavaLangClash", CheckSeverity.OFF)
52*e07d83d3SAndroid Build Coastguard Worker}
53*e07d83d3SAndroid Build Coastguard Worker
54*e07d83d3SAndroid Build Coastguard WorkerconfigureProtoCompilation()
55*e07d83d3SAndroid Build Coastguard Worker
56*e07d83d3SAndroid Build Coastguard Workerdef vmArgs = [
57*e07d83d3SAndroid Build Coastguard Worker    "-server",
58*e07d83d3SAndroid Build Coastguard Worker    "-Xms2g",
59*e07d83d3SAndroid Build Coastguard Worker    "-Xmx2g",
60*e07d83d3SAndroid Build Coastguard Worker    "-XX:+PrintGCDetails"
61*e07d83d3SAndroid Build Coastguard Worker]
62*e07d83d3SAndroid Build Coastguard Worker
63*e07d83d3SAndroid Build Coastguard Workertasks.named("startScripts").configure {
64*e07d83d3SAndroid Build Coastguard Worker    enabled = false
65*e07d83d3SAndroid Build Coastguard Worker}
66*e07d83d3SAndroid Build Coastguard Worker
67*e07d83d3SAndroid Build Coastguard Workertasks.named("run").configure {
68*e07d83d3SAndroid Build Coastguard Worker    enabled = false
69*e07d83d3SAndroid Build Coastguard Worker}
70*e07d83d3SAndroid Build Coastguard Worker
71*e07d83d3SAndroid Build Coastguard Workerdef qps_client = tasks.register("qps_client", CreateStartScripts) {
72*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.benchmarks.qps.AsyncClient"
73*e07d83d3SAndroid Build Coastguard Worker    applicationName = "qps_client"
74*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = vmArgs
75*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
76*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
77*e07d83d3SAndroid Build Coastguard Worker}
78*e07d83d3SAndroid Build Coastguard Worker
79*e07d83d3SAndroid Build Coastguard Workerdef openloop_client = tasks.register("openloop_client", CreateStartScripts) {
80*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.benchmarks.qps.OpenLoopClient"
81*e07d83d3SAndroid Build Coastguard Worker    applicationName = "openloop_client"
82*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = vmArgs
83*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
84*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
85*e07d83d3SAndroid Build Coastguard Worker}
86*e07d83d3SAndroid Build Coastguard Worker
87*e07d83d3SAndroid Build Coastguard Workerdef qps_server = tasks.register("qps_server", CreateStartScripts) {
88*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.benchmarks.qps.AsyncServer"
89*e07d83d3SAndroid Build Coastguard Worker    applicationName = "qps_server"
90*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
91*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
92*e07d83d3SAndroid Build Coastguard Worker}
93*e07d83d3SAndroid Build Coastguard Worker
94*e07d83d3SAndroid Build Coastguard Workerdef benchmark_worker = tasks.register("benchmark_worker", CreateStartScripts) {
95*e07d83d3SAndroid Build Coastguard Worker    mainClass = "io.grpc.benchmarks.driver.LoadWorker"
96*e07d83d3SAndroid Build Coastguard Worker    applicationName = "benchmark_worker"
97*e07d83d3SAndroid Build Coastguard Worker    defaultJvmOpts = vmArgs
98*e07d83d3SAndroid Build Coastguard Worker    outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
99*e07d83d3SAndroid Build Coastguard Worker    classpath = startScripts.classpath
100*e07d83d3SAndroid Build Coastguard Worker}
101*e07d83d3SAndroid Build Coastguard Worker
102*e07d83d3SAndroid Build Coastguard WorkerapplicationDistribution.into("bin") {
103*e07d83d3SAndroid Build Coastguard Worker    from(qps_client)
104*e07d83d3SAndroid Build Coastguard Worker    from(openloop_client)
105*e07d83d3SAndroid Build Coastguard Worker    from(qps_server)
106*e07d83d3SAndroid Build Coastguard Worker    from(benchmark_worker)
107*e07d83d3SAndroid Build Coastguard Worker    fileMode = 0755
108*e07d83d3SAndroid Build Coastguard Worker}
109*e07d83d3SAndroid Build Coastguard Worker
110*e07d83d3SAndroid Build Coastguard Workerpublishing {
111*e07d83d3SAndroid Build Coastguard Worker    publications {
112*e07d83d3SAndroid Build Coastguard Worker        maven(MavenPublication) {
113*e07d83d3SAndroid Build Coastguard Worker            artifact distZip
114*e07d83d3SAndroid Build Coastguard Worker            artifact distTar
115*e07d83d3SAndroid Build Coastguard Worker        }
116*e07d83d3SAndroid Build Coastguard Worker    }
117*e07d83d3SAndroid Build Coastguard Worker}
118