-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
189 lines (151 loc) · 6.32 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
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
plugins {
id "org.jetbrains.kotlin.jvm" version "1.3.50"
id "antlr"
}
group "com.github.28Smiles"
version "0.5.0-pre-release"
repositories {
jcenter()
mavenCentral()
}
dependencies {
antlr "org.antlr:antlr4:4.7.1"
compile "org.antlr:antlr4-runtime:4.7.1"
compile group: "com.google.guava", name: "guava", version: "28.2-jre"
compile group: "joda-time", name: "joda-time", version: "2.10.5"
compile group: "org.postgresql", name: "postgresql", version: "42.2.6"
compile group: "com.github.jasync-sql", name: "jasync-common", version: "1.0.14"
compile group: "org.ow2.asm", name: "asm", version: "7.3.1"
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: "1.3.50"
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: "1.3.50"
compile group: "com.fasterxml.jackson.core", name: "jackson-core", version: "2.9.9"
compile group: "com.fasterxml.jackson.module", name: "jackson-module-kotlin", version: "2.9.9"
testCompile group: "org.apache.commons", name: "commons-lang3", version: "3.9"
testCompile group: "ru.yandex.qatools.embed", name: "postgresql-embedded", version: "2.10"
testCompile group: "io.github.cdimascio", name: "java-dotenv", version: "5.1.0"
testCompile group: "com.github.jasync-sql", name: "jasync-postgresql", version: "1.0.14"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-api", version: "5.5.1"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-engine", version: "5.5.1"
testCompile group: "org.junit.jupiter", name: "junit-jupiter-params", version: "5.5.1"
testCompile group: "org.junit.vintage", name: "junit-vintage-engine", version: "5.5.1"
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
}
}
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
compileKotlin.dependsOn generateGrammarSource
if ("true" == System.getenv("DEPLOYER")) {
apply plugin: "maven"
apply plugin: "signing"
task sourcesJar(type: Jar) {
classifier = "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar) {
dependsOn javadoc
classifier = "javadoc"
from javadoc.destinationDir
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
signing {
useGpgCmd()
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
def username = project.hasProperty("mavenUser") ? mavenUser : "Unknown user"
def password = project.hasProperty("mavenPassword") ? mavenPassword : "Unknown password"
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: username, password: password)
}
jar {
from "$rootDir/LICENSE.txt"
}
pom.project {
name project.name
description project.description
url "https://github.com/28Smiles/jasync-sql-extensions/"
scm {
connection "scm:[email protected]:28Smiles/jasync-sql-extensions.git"
developerConnection "scm:[email protected]:28Smiles/jasync-sql-extensions.git"
url "https://github.com/28Smiles/jasync-sql-extensions/"
}
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution "repo"
}
}
developers {
developer {
id "28Smiles"
name "Leon Camus"
url "https://github.com/28Smiles"
}
}
}
}
}
}
}
apply plugin: "jacoco"
jacoco {
toolVersion = "0.8.2"
}
task jacoco(dependsOn: [test, jacocoTestReport, jacocoTestCoverageVerification])
jacocoTestReport {
reports {
html.enabled = true
xml.enabled = true
}
doLast {
def report = file("${jacoco.reportsDir}/test/jacocoTestReport.xml")
def parser = new XmlParser()
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false)
parser.setFeature("http://apache.org/xml/features/disallow-doctype-decl", false)
def results = parser.parse(report)
def formTuple = {
def covered = it."@covered" as Double
def missed = it."@missed" as Double
return new Tuple2<Double, Double>(covered, missed)
}
def percentage = {
def (Double covered, Double missed) = it
((covered / (covered + missed)) * 100).round(2)
}
def counters = results.counter
def metrics = [:]
metrics << [
"instruction": formTuple(counters.find { (it."@type" == "INSTRUCTION") }),
"branch" : formTuple(counters.find { (it."@type" == "BRANCH") }),
"line" : formTuple(counters.find { (it."@type" == "LINE") }),
"complexity" : formTuple(counters.find { (it."@type" == "COMPLEXITY") }),
"method" : formTuple(counters.find { (it."@type" == "METHOD") }),
"class" : formTuple(counters.find { (it."@type" == "CLASS") })
]
// remember metrics for later, see build.gradle of nabla (root build.gradle)
project.ext.jacocoMetrics = metrics
logger.quiet("------------------ Code Coverage for " + project + " -----------------------")
logger.quiet("HTML Report: ${[jacoco.reportsDir, "test", "html", "index.html"].join(File.separator)}")
metrics.each {
def metric = it.key as String
logger.quiet("- ${metric} coverage rate is: ${percentage(it.value)}%")
}
logger.quiet("---------------------------------------------------------------")
}
}