-
Notifications
You must be signed in to change notification settings - Fork 958
Expand file tree
/
Copy pathbuild.gradle
More file actions
105 lines (92 loc) · 3.06 KB
/
Copy pathbuild.gradle
File metadata and controls
105 lines (92 loc) · 3.06 KB
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
import org.apache.tools.ant.filters.*
buildscript { scriptHandler ->
apply from: rootProject.file('buildSrc/shared.gradle'), to: scriptHandler
}
plugins {
alias(libs.plugins.jmh)
id 'jacoco'
}
dependencies {
implementation libs.slf4j
implementation libs.slf4j.simple
implementation libs.jctools
implementation libs.asm
implementation libs.asm.util
jmh libs.jmh
jmh libs.jmh.annprocess
testImplementation platform(libs.junit)
testImplementation libs.junit.jupiter
}
jmh {
warmupIterations = 3
iterations = 5
fork = 2
threads = 1
timeUnit = 'ms'
def jmhIncludeProp = project.findProperty('jmhInclude')
includes = jmhIncludeProp ? [jmhIncludeProp] : ['.*BinaryProtocol.*']
benchmarkMode = ['avgt', 'thrpt']
}
processResources {
filter ReplaceTokens, tokens: [
"btrace.version": project.version,
"hash" : getGitCommit()
]
}
jacoco {
toolVersion = "0.8.15"
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
html.required = true
csv.required = false
}
// Focus on v2 protocol package
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, include: [
'**/io/btrace/core/comm/**/*.class'
])
}))
}
}
def testJavaVersion = project.findProperty('testJavaVersion')
if (testJavaVersion) {
// Gradle itself requires JVM 17+ to run, but this project still wants to verify
// wire protocol compatibility against older JDKs. Compile and run the test sources
// with the requested toolchain instead of the JVM hosting the Gradle daemon.
compileTestJava {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(testJavaVersion as int)
}
}
if ((testJavaVersion as int) < 17) {
// junit-jupiter 6.x requires JDK 17+ to resolve/compile against; downgrade to the
// last JDK 8-compatible release for pre-17 toolchain runs. The testImplementation
// platform(libs.junit) BOM above pins every org.junit.jupiter/org.junit.platform
// artifact (including transitive ones like junit-platform-commons) to 6.x, so a
// blanket eachDependency rule is needed rather than forcing individual coordinates.
def downgradeJunit5 = {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'org.junit.jupiter') {
details.useVersion '5.14.4'
} else if (details.requested.group == 'org.junit.platform') {
details.useVersion '1.14.4'
}
}
}
configurations.testCompileClasspath(downgradeJunit5)
configurations.testRuntimeClasspath(downgradeJunit5)
}
}
test {
useJUnitPlatform()
finalizedBy jacocoTestReport
if (testJavaVersion) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(testJavaVersion as int)
}
}
}