1- buildscript {
2- repositories {
3- mavenCentral()
4- jcenter()
5- maven {
6- url " https://plugins.gradle.org/m2/"
7- }
8- mavenLocal()
9- }
10- dependencies {
11- classpath ' ru.vyarus:gradle-animalsniffer-plugin:1.5.0'
12- classpath ' net.ltgt.gradle:gradle-errorprone-plugin:1.1.1'
13- classpath ' com.github.ben-manes:gradle-versions-plugin:0.20.0'
14- classpath " gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
15- classpath ' org.jfrog.buildinfo:build-info-extractor-gradle:4.9.8'
16- classpath " gradle.plugin.io.morethan.jmhreport:gradle-jmh-report:0.9.0"
17- }
1+ plugins {
2+ id " com.github.sherter.google-java-format" apply false
3+ id " com.jfrog.artifactory" apply false
4+ id " me.champeau.gradle.jmh" apply false
5+ id " net.ltgt.errorprone" apply false
6+ id " ru.vyarus.animalsniffer" apply false
7+ id " io.morethan.jmhreport" apply false
188}
199
20- // Display the version report using: ./gradlew dependencyUpdates
21- // Also see https://github.com/ben-manes/gradle-versions-plugin.
22- apply plugin : ' com.github.ben-manes.versions'
23-
2410subprojects {
2511 apply plugin : ' checkstyle'
2612 apply plugin : ' eclipse'
@@ -30,26 +16,24 @@ subprojects {
3016 apply plugin : ' signing'
3117 apply plugin : ' jacoco'
3218 apply plugin : ' maven-publish'
33- // The plugin only has an effect if a signature is specified
34- apply plugin : ' ru.vyarus.animalsniffer'
19+
3520 apply plugin : ' com.github.sherter.google-java-format'
3621 apply plugin : ' net.ltgt.errorprone'
37- apply plugin : ' com.jfrog.artifactory'
38- apply plugin : ' io.morethan.jmhreport'
39- apply from : " $rootDir /jmh.gradle"
22+ apply plugin : " com.jfrog.artifactory"
4023
4124 group = " io.opentelemetry"
4225 version = " 0.3.0-SNAPSHOT" // CURRENT_VERSION
4326
44- sourceCompatibility = 1.7
45- targetCompatibility = 1.7
46-
4727 repositories {
4828 mavenCentral()
29+ jcenter()
4930 mavenLocal()
5031 }
5132
52- [compileJava, compileTestJava, compileJmhJava]. each() {
33+ sourceCompatibility = 1.7
34+ targetCompatibility = 1.7
35+
36+ tasks. withType(JavaCompile ) {
5337 // We suppress the "try" warning because it disallows managing an auto-closeable with
5438 // try-with-resources without referencing the auto-closeable within the try block.
5539 // We suppress the "processing" warning as suggested in
@@ -184,8 +168,10 @@ subprojects {
184168 configProperties[" rootDir" ] = rootDir
185169 }
186170
171+ jacoco { toolVersion = " 0.8.2" }
172+
187173 googleJavaFormat {
188- toolVersion ' 1.7'
174+ toolVersion = ' 1.7'
189175 }
190176
191177 afterEvaluate { // Allow subproject to add more source sets.
@@ -239,12 +225,38 @@ subprojects {
239225 maxHeapSize = ' 1500m'
240226 }
241227
242- jmhReport {
243- jmhResultPath = project. file(" ${ project.buildDir} /results/results.json" )
244- jmhReportOutput = project. file(" ${ project.buildDir} /results" )
245- }
228+ plugins. withId(" me.champeau.gradle.jmh" ) {
229+ dependencies {
230+ jmh ' org.openjdk.jmh:jmh-core:1.19' ,
231+ ' org.openjdk.jmh:jmh-generator-bytecode:1.19'
232+ }
246233
247- tasks. jmhRun. finalizedBy tasks. jmhReport
234+ // invoke jmh on a single benchmark class like so:
235+ // ./gradlew -PjmhIncludeSingleClass=StatsTraceContextBenchmark clean :grpc-core:jmh
236+ jmh {
237+ warmupIterations = 5
238+ iterations = 10
239+ fork = 1
240+ failOnError = true
241+ resultFormat = ' JSON'
242+ // None of our benchmarks need the tests, and we have pseudo-circular
243+ // dependencies that break when including them. (context's testCompile
244+ // depends on core; core's testCompile depends on testing)
245+ includeTests = false
246+ if (project. hasProperty(' jmhIncludeSingleClass' )) {
247+ include = [
248+ project. property(' jmhIncludeSingleClass' )
249+ ]
250+ }
251+ }
252+
253+ jmhReport {
254+ jmhResultPath = project. file(" ${ project.buildDir} /reports/jmh/results.json" )
255+ jmhReportOutput = project. file(" ${ project.buildDir} /reports/jmh" )
256+ }
257+
258+ tasks. jmh. finalizedBy tasks. jmhReport
259+ }
248260
249261 apply from : " ${ rootProject.projectDir} /gradle/publish.gradle"
250262
0 commit comments