diff --git a/api/build.gradle b/api/build.gradle index 7c399d243c..5b50e3da7f 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "me.champeau.gradle.jmh" +} + description = 'gRPC: API' dependencies { diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle index 2bfac4672b..f5e284031d 100644 --- a/benchmarks/build.gradle +++ b/benchmarks/build.gradle @@ -2,6 +2,7 @@ plugins { id "application" id "com.google.protobuf" + id "me.champeau.gradle.jmh" } description = "grpc Benchmarks" diff --git a/build.gradle b/build.gradle index 83fc1cb996..7fc0360ee1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,6 @@ plugins { id "com.google.osdetector" apply false id "me.champeau.gradle.japicmp" apply false - id "me.champeau.gradle.jmh" apply false id "net.ltgt.errorprone" apply false id "ru.vyarus.animalsniffer" apply false } @@ -17,7 +16,6 @@ subprojects { apply plugin: "signing" apply plugin: "jacoco" - apply plugin: "me.champeau.gradle.jmh" apply plugin: "com.google.osdetector" // The plugin only has an effect if a signature is specified apply plugin: "ru.vyarus.animalsniffer" @@ -53,11 +51,7 @@ subprojects { mavenLocal() } - [ - compileJava, - compileTestJava, - compileJmhJava - ].each() { + tasks.withType(JavaCompile) { it.options.compilerArgs += [ "-Xlint:all", "-Xlint:-options", @@ -160,11 +154,7 @@ subprojects { } } - [ - compileJava, - compileTestJava, - compileJmhJava - ].each() { + tasks.withType(JavaCompile) { // Protobuf-generated code produces some warnings. // https://github.com/google/protobuf/issues/2718 it.options.compilerArgs += [ @@ -253,9 +243,6 @@ subprojects { // Configuration for modules that use Jetty ALPN agent alpnagent libraries.jetty_alpn_agent - - jmh 'org.openjdk.jmh:jmh-core:1.19', - 'org.openjdk.jmh:jmh-generator-bytecode:1.19' } // Disable JavaDoc doclint on Java 8. It's annoying. @@ -295,20 +282,26 @@ subprojects { source = fileTree(dir: "src/test", include: "**/*.java") } - // invoke jmh on a single benchmark class like so: - // ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh - jmh { - warmupIterations = 10 - iterations = 10 - fork = 1 - // None of our benchmarks need the tests, and we have pseudo-circular - // dependencies that break when including them. (context's testCompile - // depends on core; core's testCompile depends on testing) - includeTests = false - if (project.hasProperty('jmhIncludeSingleClass')) { - include = [ - project.property('jmhIncludeSingleClass') - ] + plugins.withId("me.champeau.gradle.jmh") { + dependencies { + jmh 'org.openjdk.jmh:jmh-core:1.19', + 'org.openjdk.jmh:jmh-generator-bytecode:1.19' + } + // invoke jmh on a single benchmark class like so: + // ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh + jmh { + warmupIterations = 10 + iterations = 10 + fork = 1 + // None of our benchmarks need the tests, and we have pseudo-circular + // dependencies that break when including them. (context's testCompile + // depends on core; core's testCompile depends on testing) + includeTests = false + if (project.hasProperty('jmhIncludeSingleClass')) { + include = [ + project.property('jmhIncludeSingleClass') + ] + } } } diff --git a/context/build.gradle b/context/build.gradle index 1513cbcb88..e504f5de57 100644 --- a/context/build.gradle +++ b/context/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "me.champeau.gradle.jmh" +} + description = 'gRPC: Context' dependencies { diff --git a/core/build.gradle b/core/build.gradle index 4202f88116..ce215d1f88 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "me.champeau.gradle.jmh" +} + description = 'gRPC: Core' dependencies { diff --git a/netty/build.gradle b/netty/build.gradle index 6b5954cd94..8afe46da18 100644 --- a/netty/build.gradle +++ b/netty/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "me.champeau.gradle.jmh" +} + description = "gRPC: Netty" dependencies { compile project(':grpc-core'),