logstash/logstash-core/benchmarks/build.gradle
Rob Bavey b2da4449a5
Use task avoidance API in gradle scripts (#11914) (#11943)
* Use task avoidance API in gradle scripts

This commit uses the task avoidance api (tasks.register vs task.create/
task DSL), as recommended since Gradle 5.1

This should reduce the execution of unnecessary tasks in build jobs, and
hopefully improve build resiliency and execution time.
2020-05-29 11:52:01 -04:00

97 lines
2.5 KiB
Groovy

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.yaml.snakeyaml.Yaml
// fetch version from Logstash's master versions.yml file
def versionMap = (Map) (new Yaml()).load(new File("$projectDir/../../versions.yml").text)
description = """Logstash Core Java Benchmarks"""
version = versionMap['logstash-core']
String jrubyVersion = versionMap['jruby']['version']
repositories {
mavenCentral()
jcenter()
}
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'org.yaml:snakeyaml:1.17'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
}
}
test.enabled = false
jar {
manifest {
attributes "Main-Class": "org.openjdk.jmh.Main"
}
}
ext {
jmh = 1.22
}
dependencies {
implementation project(':logstash-core')
implementation "org.openjdk.jmh:jmh-core:$jmh"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$jmh"
implementation 'com.google.guava:guava:24.1.1-jre'
implementation 'commons-io:commons-io:2.5'
runtimeOnly 'joda-time:joda-time:2.8.2'
api "org.jruby:jruby-core:$jrubyVersion"
}
javadoc {
enabled = false
}
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
archiveBaseName = 'logstash-core-benchmarks-all'
archiveClassifier = null
archiveVersion = ''
}
tasks.register("jmh", JavaExec) {
dependsOn=[':logstash-core-benchmarks:clean', ':logstash-core-benchmarks:shadowJar']
main = "-jar"
def include = project.properties.get('include', '')
doFirst {
args = [
"-Djava.io.tmpdir=${buildDir.absolutePath}",
"-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75",
"-XX:+UseCMSInitiatingOccupancyOnly", "-XX:+DisableExplicitGC",
"-XX:+HeapDumpOnOutOfMemoryError", "-Xms2g", "-Xmx2g",
shadowJar.archivePath,
include
]
}
}