plugins { id 'me.champeau.gradle.jmh' version '0.3.1' } apply plugin: 'idea' description = 'Conscrypt: JMH on OpenJDK Benchmarks' evaluationDependsOn(':conscrypt-openjdk') ext { preferredNativeConfiguration = project(':conscrypt-openjdk').preferredNativeConfiguration preferredNativeFileDir = project(':conscrypt-openjdk').preferredNativeFileDir genDir = "${buildDir}/jmh-generated-classes" jmhInclude = System.getProperty('jmh.include') jmhWarmupIterations = System.getProperty('jmh.wi', '10') jmhIterations = System.getProperty('jmh.i', '10') jmhFork = System.getProperty('jmh.f', '1') jmhJvm = System.getProperty('jmh.jvm') jmhJvmArgs = System.getProperty('jmh.jvmArgs', '-server -Xms2g -Xmx2g') } // We're not distributing this, so it's safe to use newer language features. sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 jmh { jmhVersion = "$jmhVersion" if (jmhInclude != null) { setInclude(jmhInclude.toString()) } warmupIterations = "$jmhWarmupIterations".toInteger() iterations = "$jmhIterations".toInteger(); fork = "$jmhFork".toInteger() jvmArgs = jmhJvmArgs.toString() if (jmhJvm != null) { jvm = jmhJvm } duplicateClassesStrategy = 'warn' } configurations { // The JMH plugin by defaults depends on all of the generators for an old version of JMH. // Need to remove all the generators that we're not explicitly overriding to eliminate the // dependency on the old version of JMH. jmh.exclude module:'jmh-generator-asm' jmhGeneratorAnnprocess } sourceSets { sourceSets { main { resources { // This shouldn't be needed but seems to help IntelliJ locate // META_INF/BenchmarkList. srcDirs += genDir // This shouldn't be needed but seems to help IntelliJ locate the native artifact. srcDirs += preferredNativeFileDir } } } } dependencies { compile project(':conscrypt-openjdk'), project(':conscrypt-benchmark-base'), // Add the preferred native openjdk configuration for this platform. project(path: ':conscrypt-openjdk', configuration: "$preferredNativeConfiguration"), libraries.junit, libraries.netty_handler, libraries.netty_tcnative jmhGeneratorAnnprocess libraries.jmh_generator_annprocess // Override the default JMH dependencies with the new versions. jmh libraries.jmh_core, libraries.jmh_generator_reflection, libraries.jmh_generator_bytecode } // Running benchmarks in IntelliJ seems broken without this. // See https://github.com/melix/jmh-gradle-plugin/issues/39 idea.module { scopes.PROVIDED.plus += [ configurations.compile, configurations.jmh ] } // Don't include this artifact in the distribution. tasks.install.enabled = false tasks.uploadArchives.enabled = false;