sourceSets {
    jmh {
        java.srcDirs = ['src/jmh/java']
        resources.srcDirs = ['src/jmh/resources']
        compileClasspath += sourceSets.main.runtimeClasspath
    }
}

dependencies {
    jmhImplementation 'org.openjdk.jmh:jmh-core:1.32'
    jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.32'
}

task jmh(type: JavaExec, group: 'jmh', dependsOn: jmhClasses) {
    mainClass.set('org.openjdk.jmh.Main')
    classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
    project.file('build/reports/jmh').mkdirs()
    args '-rf', 'json'
    args '-rff', project.file('build/reports/jmh/result.json')
}

classes.finalizedBy(jmhClasses)
