-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
105 lines (85 loc) · 2.93 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
// https://xvik.github.io/gradle-mkdocs-plugin/latest/
plugins {
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
id 'com.diffplug.spotless' version '6.25.0'
id 'ru.vyarus.use-python' version '4.1.0'
id 'ru.vyarus.mkdocs' version '4.0.1'
id "maven-publish"
}
apply from: "gradle/release.gradle"
mkdocs {
sourcesDir = projectDir
strict = true
}
python {
minPythonVersion = '3.7'
// mkdocs requires 3.7.x
scope = VIRTUALENV
}
repositories {
mavenLocal()
mavenCentral()
}
subprojects { subproj ->
apply plugin: 'java-library'
apply plugin: 'com.diffplug.spotless'
repositories {
mavenLocal()
mavenCentral()
}
spotless {
java {
googleJavaFormat()
}
}
// https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_source_sets
sourceSets {
jmh {
java.srcDirs = ['src/jmh/java']
resources.srcDirs = ['src/jmh/resources']
compileClasspath += sourceSets.main.runtimeClasspath
}
}
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.JavaExec.html
task jmh(type: JavaExec, dependsOn: jmhClasses) {
mainClass.set("org.openjdk.jmh.Main")
classpath = sourceSets.jmh.compileClasspath + sourceSets.jmh.runtimeClasspath
// To enable the built-in stacktrace sampling profiler
//args = ['-prof', 'stack']
//args = ['-prof', 'gc']
// easier to use the oracle JDK because it has debug symbols available
// https://github.com/jvm-profiling-tools/async-profiler#installing-debug-symbols
// sdk use java 17.0.3-oracle
//args = ['-prof', 'async:output=flamegraph']
args = ['-prof', 'gc', '-rf', 'json']
//args = ['-prof', 'async:output=async-profiler.txt;alloc=2m']
}
// to make sure benchmarks always get compiled
classes.finalizedBy(jmhClasses)
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
compileJava {
// Make sure we can release JDK 11 code
options.release = 11
}
dependencies {
// https://docs.gradle.org/6.7.1/release-notes.html
compileOnlyApi 'org.jetbrains:annotations:26.0.1'
// Fix a dependency in log4jbenchmarks
jmhImplementation 'org.jetbrains:annotations:26.0.1'
jmhImplementation 'org.openjdk.jmh:jmh-core:1.37'
jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.3'
testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation 'org.awaitility:awaitility:4.2.2'
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
}