forked from osiegmar/JavaCsvBenchmarkSuite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
105 lines (86 loc) · 2.54 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
plugins {
id 'java'
id 'com.github.spotbugs' version '4.5.0' apply false
id 'me.champeau.gradle.jmh' version '0.5.2' apply false
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}
allprojects {
repositories {
mavenCentral()
}
}
dependencies {
implementation 'org.openjdk.jmh:jmh-core:1.25'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
}
test {
useJUnitPlatform()
}
allprojects {
apply plugin: 'pmd'
apply plugin: 'com.github.spotbugs'
pmd {
consoleOutput = true
ruleSets = []
ruleSetFiles = files("${project.rootDir}/config/pmd/config.xml")
}
tasks.matching {task -> task.name.startsWith('spotbugs')}.forEach {
it.reports {
html.enabled = true
xml.enabled = false
}
}
}
subprojects {
apply plugin: 'java'
apply plugin: 'me.champeau.gradle.jmh'
dependencies {
compileOnly rootProject
testImplementation rootProject
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
}
test {
useJUnitPlatform()
}
jmh {
warmupIterations = 2
iterations = 5
benchmarkMode = ['thrpt']
fork = 5
failOnError = true
operationsPerInvocation = 1
resultFormat = 'CSV'
}
project.afterEvaluate {
tasks.register("depsize") {
listConfigurationDependencies(project.name, project.buildDir, configurations.runtimeClasspath)
}
}
}
def listConfigurationDependencies(String projectName, File buildDir, Configuration configuration) {
def formatStr = "%,10.2f"
def size = configuration.collect { it.length() }.sum() / 1024
def reportFile = file("${buildDir}/tmp/deps.txt")
mkdir reportFile.parentFile
def out = new StringBuilder()
if (size) {
reportFile.write("$projectName,${Math.round(size)}\n")
out << 'Total dependencies size:'.padRight(64)
out << "${String.format(formatStr, size)} KiB\n\n"
configuration.sort { -it.length() }
.each {
out << "${it.name}".padRight(64)
out << "${String.format(formatStr, (it.length() / 1024))} KiB\n"
}
} else {
out << 'No dependencies found';
}
out << "------------------------------------------------------------------------------\n"
println(out)
}