-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
128 lines (111 loc) · 3.81 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
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
sourceCompatibility = 11
compileJava {
sourceCompatibility = 11
targetCompatibility = 11
}
def version = '1.0.3'
def title = 'JMeterInfluxDBListener'
jar {
manifest {
attributes 'Implementation-Title': title,
'Implementation-Version': version
}
}
repositories {
maven{
url "https://repo.maven.apache.org/maven2"
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
}
dependencies {
compileOnly group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.4'
compileOnly group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.4'
compile group: 'org.influxdb', name: 'influxdb-java', version: '2.4'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.11'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
compile group: 'com.google.guava', name: 'guava', version: '30.0-jre'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.0'
testImplementation group: 'org.junit.jupiter', name:'junit-jupiter', version:'5.7.0'
testRuntime group: 'org.junit.jupiter', name:'junit-jupiter-engine', version :'5.7.0'
testCompile group: "com.github.tomakehurst",name :"wiremock-jre8", version:"2.27.2"
testCompile group: 'org.apache.jmeter', name: 'ApacheJMeter_core', version: '5.4'
testCompile group: 'org.apache.jmeter', name: 'ApacheJMeter_components', version: '5.4'
}
test {
testLogging {
showStandardStreams = true
exceptionFormat = 'full'
events = ["failed", "skipped"]
}
useJUnitPlatform()
finalizedBy jacocoTestReport
afterSuite { desc, result ->
if (!desc.parent) {
println "\nTest result: ${result.resultType}"
println "Test summary: ${result.testCount} tests, " +
"${result.successfulTestCount} succeeded, " +
"${result.failedTestCount} failed, " +
"${result.skippedTestCount} skipped"
}
}
}
jacocoTestReport {
dependsOn test
reports {
xml.enabled = true
html.enabled = true
}
}
//create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': title,
'Implementation-Version': version
}
baseName = project.name + '-plugin'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
task copyTask(type: Copy) {
from 'build/libs/.'
into './'
}
task copyCodeCoverage(type: Copy){
from 'build/reports/jacoco/test/.'
into './'
}
task copyTaskToJmeterDebug(type: Copy){
def jmeterPath = System.env.JMETER_HOME
def fileLibDebugPath = jmeterPath + "/lib/ext/" + "jmeter-backend-listener-plugin" + ".jar"
boolean fileSuccessfullyDeleted = new File(fileLibDebugPath).delete()
println "Clean old lib successfully: " + fileSuccessfullyDeleted
from 'build/libs/.'
into jmeterPath + "/lib/ext/"
}
task packageDistribution(type: Zip) {
archiveFileName = "toilatester-jmeter-plugin.zip"
destinationDirectory = file("$buildDir/../")
from "$buildDir/libs"
}
task releasePlugin{
dependsOn 'clean'
dependsOn 'fatJar'
dependsOn 'copyTask'
dependsOn 'packageDistribution'
tasks.findByName('fatJar').mustRunAfter 'clean'
tasks.findByName('copyTask').mustRunAfter 'fatJar'
tasks.findByName('packageDistribution').mustRunAfter 'fatJar'
}
task releaseHotDebug{
dependsOn 'fatJar'
dependsOn 'copyTaskToJmeterDebug'
tasks.findByName('fatJar').mustRunAfter 'clean'
tasks.findByName('copyTaskToJmeterDebug').mustRunAfter 'fatJar'
}