-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
140 lines (123 loc) · 3.88 KB
/
build.gradle.kts
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
import java.lang.Runtime.getRuntime
import java.nio.file.Files
import java.nio.file.Paths
import java.util.stream.IntStream
import kotlin.math.max
import kotlin.math.min
plugins {
java
}
group = "org.example"
version = "1.0-SNAPSHOT"
repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
val v_jqwik = "1.7.1"
val v_assertj = "3.23.1"//"3.21.0"
val v_jmh = "1.35"
tasks.compileJava {
options.compilerArgs.addAll(
listOf(
"-parameters",
// "--add-modules=jdk.incubator.vector"
)
)
}
tasks.compileTestJava {
options.compilerArgs.addAll(
listOf(
"-parameters",
// "--add-exports=java.base/sun.net.util=ALL-UNNAMED",
// "--add-exports=java.management/sun.management=ALL-UNNAMED",
// "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED",
// "--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED",
// "--add-modules=jdk.incubator.vector"
)
)
}
var memTotal = Integer.MAX_VALUE
val memPerFork = 6
if( System.getProperty("os.name").decapitalize() == "linux" )
{
val pattern = "(?ui)\\s*MemAvailable\\s*:\\s*(?<kiloBytes>\\d+)\\s*kB\\s*".toRegex().toPattern()
val memKiloBytes = Files.lines( Paths.get("/proc/meminfo") ).flatMapToInt{
line ->
val m = pattern.matcher(line)
if( m.matches() ) IntStream.of( m.group("kiloBytes").toInt() )
else IntStream.empty()
}.findFirst()
if( memKiloBytes.isPresent() )
memTotal = memKiloBytes.asInt / (1024*1024)
}
tasks.test {
useJUnitPlatform {
includeEngines(
"assertj-core",
"jqwik"
)
}
enableAssertions = true
maxHeapSize = "${memPerFork}g"
maxParallelForks = max( 1, min(memTotal/memPerFork, getRuntime().availableProcessors()) )
jvmArgs = listOf(
"-ea",
// "--illegal-access=permit",
// "--add-modules=jdk.incubator.vector",
// "-Xdisablejavadump",
// "-Xdump:none",
)
include(
"**/*Properties.class",
"**/*Test.class",
"**/*Tests.class"
)
}
tasks.register<JavaExec>("benchmarkMerge") {
dependsOn(tasks.compileTestJava)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("com.github.jaaa.merge.BenchmarkMerge")
jvmArgs = listOf("-ea")
}
tasks.register<JavaExec>("benchmarkSort") {
dependsOn(tasks.compileTestJava)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("com.github.jaaa.sort.BenchmarkSort")
jvmArgs = listOf("-ea")
}
tasks.register<JavaExec>("benchmarkGcdInt") {
dependsOn(tasks.compileTestJava)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("com.github.jaaa.util.IMathBenchmark_gcd_int")
jvmArgs = listOf("-ea")
}
tasks.register<JavaExec>("benchmarkGcdLong") {
dependsOn(tasks.compileTestJava)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("com.github.jaaa.util.IMathBenchmark_gcd_long")
jvmArgs = listOf("-ea")
}
tasks.register<JavaExec>("benchmarkBiPartition") {
dependsOn(tasks.compileTestJava)
classpath = sourceSets.test.get().runtimeClasspath
mainClass.set("com.github.jaaa.partition.BenchmarkBiPartition")
jvmArgs = listOf("-ea")
}
dependencies {
implementation("org.apache.commons:commons-math3:3.6.1")
testImplementation("com.github.haifengl:smile-core:3.0.0")
testImplementation("org.bytedeco:openblas:0.3.19-1.5.7:linux-x86_64")
testImplementation("org.bytedeco:arpack-ng:3.8.0-1.5.7:linux-x86_64")
testImplementation("net.jqwik:jqwik:$v_jqwik")
testImplementation("net.jqwik:jqwik-engine:$v_jqwik")
testImplementation("org.assertj:assertj-core:$v_assertj")
testImplementation("org.apache.commons:commons-math3:3.6.1")
testImplementation("org.openjdk.jmh:jmh-core:$v_jmh")
testImplementation("org.jparsec:jparsec:3.1")
testImplementation("org.json:json:20220924")
testAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:$v_jmh")
}