1 plugins { 2 id 'me.champeau.gradle.jmh' version '0.3.1' 3 } 4 5 apply plugin: 'idea' 6 7 description = 'Conscrypt: OpenJDK Benchmarks' 8 9 ext { 10 genDir = "${buildDir}/jmh-generated-classes" 11 jmhInclude = System.getProperty('jmh.include') 12 jmhWarmupIterations = System.getProperty('jmh.wi', '10') 13 jmhIterations = System.getProperty('jmh.i', '10') 14 jmhFork = System.getProperty('jmh.f', '1') 15 jmhJvmArgs = System.getProperty('jmh.jvmArgs', '-server -Xms2g -Xmx2g') 16 } 17 18 jmh { 19 jmhVersion = "$jmhVersion" 20 if (jmhInclude != null) { 21 setInclude(jmhInclude.toString()) 22 } 23 warmupIterations = "$jmhWarmupIterations".toInteger() 24 iterations = "$jmhIterations".toInteger(); 25 fork = "$jmhFork".toInteger() 26 jvmArgs = jmhJvmArgs.toString() 27 duplicateClassesStrategy = 'warn' 28 } 29 30 configurations { 31 // The JMH plugin by defaults depends on all of the generators for an old version of JMH. 32 // Need to remove all the generators that we're not explicitly overriding to eliminate the 33 // dependency on the old version of JMH. 34 jmh.exclude module:'jmh-generator-asm' 35 36 jmhGeneratorAnnprocess 37 } 38 39 sourceSets { 40 sourceSets { 41 main { 42 resources { 43 // This shouldn't be needed but seems to help IntelliJ locate 44 // META_INF/BenchmarkList. 45 srcDirs += genDir 46 } 47 } 48 } 49 } 50 51 dependencies { 52 compile project(':conscrypt-benchmark-base'), 53 libraries.junit 54 55 jmhGeneratorAnnprocess libraries.jmh_generator_annprocess 56 57 // Override the default JMH dependencies with the new versions. 58 jmh libraries.jmh_core, 59 libraries.jmh_generator_reflection, 60 libraries.jmh_generator_bytecode 61 } 62 63 // Running benchmarks in IntelliJ seems broken without this. 64 // See https://github.com/melix/jmh-gradle-plugin/issues/39 65 idea.module { 66 scopes.PROVIDED.plus += [ configurations.compile, configurations.jmh ]//, configurations.jmhGeneratorAnnprocess ] 67 } 68 69 // Don't include this artifact in the distribution. 70 tasks.install.enabled = false 71 tasks.uploadArchives.enabled = false; 72