/
build.gradle
160 lines (134 loc) · 6.3 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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.gradle.util.VersionNumber
plugins { id 'java' }
group 'org.apache.geode-benchmark'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
def outputDir = project.hasProperty('outputDir') ? project.findProperty('outputDir') : new File(project.buildDir, "benchmarks_" + getDate()).getAbsolutePath()
def geodeVersion = project.hasProperty('geodeVersion') ? project.findProperty('geodeVersion') : '1.+'
def getDate() {
new Date().format('yyyyMMddHHmmss')
}
repositories {
/*
This is used in CI to benchmark various new/old versions of Geode.
Also useful in dev where you can clone geode and publishToMavenLocal
*/
mavenLocal()
// fall back to mavenCentral, which has lots of released versions of Geode
mavenCentral()
}
dependencies {
implementation(group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: project.'junit-jupiter-engine.version')
implementation(group: 'org.junit-pioneer', name: 'junit-pioneer', version: project.'junit-pioneer.version')
implementation(group: 'org.slf4j', name: 'slf4j-simple', version: project.'slf4j-simple.version')
implementation(project(':harness'))
implementation(group: 'org.apache.geode', name: 'geode-core', version: geodeVersion)
if (VersionNumber.parse(geodeVersion) >= VersionNumber.parse("1.11.0")) {
runtime(group: 'org.apache.geode', name: 'geode-log4j', version: geodeVersion)
} else {
runtime(group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.3')
}
// Required for missing dependency on geode-core.
runtime(group: 'org.eclipse.jetty', name: 'jetty-webapp', version: '9.4.12.v20180830')
testImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter-params', version:project.'junit-jupiter-engine.version')
testImplementation(group: 'org.mockito', name: 'mockito-all', version: project.'mockito-all.version')
testImplementation(group: 'org.assertj', name: 'assertj-core', version: project.'assertj-core.version')
}
compileJava {
options.compilerArgs << '-Xlint:unchecked' << "-Werror"
options.deprecation = true
}
test{
afterTest { desc, result ->
logger.quiet "Executing test ${desc.className}.${desc.name} with result: ${result.resultType}"
}
useJUnitPlatform()
systemProperty 'org.slf4j.simpleLogger.showDateTime', 'true'
systemProperty 'org.slf4j.simpleLogger.dateTimeFormat', 'yyyy-MM-dd HH:mm:ss.SSS'
systemProperty 'org.slf4j.simpleLogger.showThreadNam', 'false'
systemProperty 'org.slf4j.simpleLogger.showShortLogName', 'true'
}
task benchmark(type: Test) {
if (project.hasProperty('testJVM') && !testJVM.trim().isEmpty()) {
executable = "${testJVM}/bin/java"
}
outputs.upToDateWhen { false }
testClassesDirs = project.sourceSets.main.output.classesDirs
classpath = project.sourceSets.main.runtimeClasspath
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
showStandardStreams = true
}
exclude "**/NoopBenchmark.class"
exclude "**/P2pPartitionedPutLongBenchmark.class"
forkEvery 1
failFast = true
systemProperty 'org.slf4j.simpleLogger.showDateTime', 'true'
systemProperty 'org.slf4j.simpleLogger.dateTimeFormat', 'yyyy-MM-dd HH:mm:ss.SSS'
systemProperty 'org.slf4j.simpleLogger.showThreadName', 'false'
systemProperty 'org.slf4j.simpleLogger.showShortLogName', 'true'
systemProperty 'TEST_HOSTS', project.findProperty('hosts')
systemProperty 'TEST_METADATA', project.findProperty('metadata')
systemProperty 'OUTPUT_DIR', outputDir
//Set all project properties starting with "benchmark." as system properties in the test
//JVM
project.properties.findAll {
it.key.startsWith("benchmark.")
}.each {
systemProperty(it.getKey(), it.getValue())
}
//------------------------------------------------------------
//Legacy properties - these properties were added before the benchmark.
//prefix convention. They will be passed on to the JVM for now to not break
//CI or peoples scripts. Remove these soon!
//------------------------------------------------------------
if (project.hasProperty('withGc')) {
systemProperty 'benchmark.withGc', project.findProperty('withGc')
}
if (project.hasProperty('withHeap')) {
systemProperty 'benchmark.withHeap', project.findProperty('withHeap')
}
if (project.hasProperty('withThreads')) {
systemProperty 'benchmark.withThreads', project.findProperty('withThreads')
}
if (project.hasProperty('withWarmup')) {
systemProperty 'benchmark.withWarmup', project.findProperty('withWarmup')
}
if (project.hasProperty('withDuration')) {
systemProperty 'benchmark.withDuration', project.findProperty('withDuration')
}
systemProperty 'benchmark.withSsl', project.hasProperty('withSsl')
systemProperty 'benchmark.withSslProtocols', project.findProperty('withSslProtocols')
systemProperty 'benchmark.withSslCiphers', project.findProperty('withSslCiphers')
if (project.hasProperty('withSniProxy')) {
systemProperty 'benchmark.withSniProxy', project.findProperty('withSniProxy')
}
systemProperty 'benchmark.withSniProxyImage', project.findProperty('withSniProxyImage')
if (project.hasProperty('withRouter')) {
systemProperty 'benchmark.withRouter', project.findProperty('withRouter')
}
systemProperty 'benchmark.withRouterImage', project.findProperty('withRouterImage')
systemProperty 'benchmark.withSecurityManager', project.hasProperty('withSecurityManager')
doFirst {
if(!project.hasProperty('hosts')) {
throw new GradleException("You must set the hosts property to a comma separated list of hosts. Eg ./gradlew benchmark -Phosts=localhost,localhost,localhost")
}
}
}