1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import org.elasticsearch.gradle.internal.info.BuildParams
- /*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
- apply plugin: 'elasticsearch.java'
- apply plugin: 'application'
- mainClassName = 'org.openjdk.jmh.Main'
- tasks.named("assemble").configure { enabled = false }
- archivesBaseName = 'elasticsearch-benchmarks'
- tasks.named("test").configure { enabled = false }
- configurations {
- expression
- painless
- }
- dependencies {
- api(project(":server")) {
- // JMH ships with the conflicting version 4.6. This prevents us from using jopt-simple in benchmarks (which should be ok) but allows
- // us to invoke the JMH uberjar as usual.
- exclude group: 'net.sf.jopt-simple', module: 'jopt-simple'
- }
- expression(project(path: ':modules:lang-expression', configuration: 'zip'))
- painless(project(path: ':modules:lang-painless', configuration: 'zip'))
- api "org.openjdk.jmh:jmh-core:$versions.jmh"
- annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
- // Dependencies of JMH
- runtimeOnly 'net.sf.jopt-simple:jopt-simple:4.6'
- runtimeOnly 'org.apache.commons:commons-math3:3.2'
- }
- // enable the JMH's BenchmarkProcessor to generate the final benchmark classes
- // needs to be added separately otherwise Gradle will quote it and javac will fail
- tasks.named("compileJava").configure {
- options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])
- }
- tasks.register('copyExpression', Copy) {
- dependsOn configurations.expression
- from { configurations.expression.collect { zipTree(it) } }
- into "${buildDir}/plugins/expression"
- }
- tasks.register("copyPainless", Copy) {
- dependsOn configurations.painless
- from { configurations.painless.collect { zipTree(it) } }
- into "${buildDir}/plugins/painless"
- }
- tasks.named("run").configure {
- executable = "${BuildParams.runtimeJavaHome}/bin/java"
- jvmArgs << "-Dplugins.dir=${buildDir}/plugins" << "-Dtests.index=${buildDir}/index"
- dependsOn "copyExpression", "copyPainless"
- }
- spotless {
- java {
- // IDEs can sometimes run annotation processors that leave files in
- // here, causing Spotless to complain. Even though this path ought not
- // to exist, exclude it anyway in order to avoid spurious failures.
- targetExclude 'src/main/generated/**/*.java'
- }
- }
|