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