-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
108 lines (95 loc) · 3.28 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
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "me.champeau.gradle:jmh-gradle-plugin:0.5.2"
}
}
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: "me.champeau.gradle.jmh"
apply plugin: 'cpp'
defaultTasks 'build'
def jdkDir = System.getProperty('java.home')
model {
buildTypes {
debug
release
}
platforms {
x64 {
architecture "x86_64"
}
}
components {
nativetime(NativeLibrarySpec) {
binaries.all {
if (buildType == buildTypes.debug)
{
cppCompiler.args("-fPIC", "-O2", "-g", "-pedantic", "-Wall", "-Wextra", "-Wcast-align", "-Wcast-qual", "-Wctor-dtor-privacy", "-Wdisabled-optimization", "-Wformat=2",
"-Winit-self", "-Wlogical-op", "-Wmissing-declarations", "-Wmissing-include-dirs", "-Wnoexcept", /*"-Wold-style-cast",*/ "-Woverloaded-virtual", "-Wredundant-decls",
"-Wshadow", /*"-Wsign-conversion",*/ "-Wsign-promo", "-Wstrict-null-sentinel", "-Wstrict-overflow=5", "-Wswitch-default", "-Wundef", "-Werror", "-Wno-unused")
}
else if (buildTypes.release)
{
cppCompiler.args "-fPIC", "-O2"
}
}
sources {
cpp {
exportedHeaders {
srcDirs "src/nativetime/headers", "$jdkDir/include", "$jdkDir/include/linux"
}
}
}
}
}
}
def nativeLibPath = "$rootDir/build/libs/nativetime/shared/release"
jmh {
jmhVersion = '1.12'
jvmArgsAppend = ["-Djava.library.path=${nativeLibPath}".toString()]
fork = 10
warmupIterations = 20
iterations = 20
forceGC = false //default is false
includeTests = false
timeUnit = 'us'
profilers = ['gc']
resultFormat = 'JSON'
/*Supported profilers:
cl: Classloader profiling via standard MBeans
comp: JIT compiler profiling via standard MBeans
gc: GC profiling via standard MBeans
hs_cl: HotSpot (tm) classloader profiling via implementation-specific MBeans
hs_comp: HotSpot (tm) JIT compiler profiling via implementation-specific MBeans
hs_gc: HotSpot (tm) memory manager (GC) profiling via implementation-specific MBeans
hs_rt: HotSpot (tm) runtime profiling via implementation-specific MBeans
hs_thr: HotSpot (tm) threading subsystem via implementation-specific MBeans
stack: Simple and naive Java stack profiler
*/
}
tasks.jmh{
dependsOn ':nativetimeReleaseSharedLibrary'
}
tasks.withType(Test) {
dependsOn ':nativetimeReleaseSharedLibrary'
systemProperty "java.library.path", nativeLibPath
}
test {
useJUnitPlatform()
}
dependencies {
jmh 'org.openjdk.jmh:jmh-core:1.26'
jmh 'org.openjdk.jmh:jmh-generator-reflection:1.26'
jmh 'net.sf.jopt-simple:jopt-simple:4.6'
jmh 'org.apache.commons:commons-math3:3.2'
implementation 'net.java.dev.jna:jna:4.2.2'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.0"
}