-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
96 lines (84 loc) Β· 2.61 KB
/
build.gradle
File metadata and controls
96 lines (84 loc) Β· 2.61 KB
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
plugins {
id("org.sonarqube") version("4.2.1.3168")
id("jacoco")
}
dependencies {
implementation(project(":mvc"))
implementation(project(":jdbc"))
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.13.1")
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
}
tasks.named("test") {
useJUnitPlatform()
finalizedBy jacocoTestReport
}
jacoco {
toolVersion = project.getProperty("jacocoVersion")
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
csv.required = false
html.required = true
xml.destination file("${buildDir}/jacoco/index.xml")
csv.destination file("${buildDir}/jacoco/index.csv")
html.destination file("${buildDir}/jacoco/index.html")
}
afterEvaluate {
classDirectories.setFrom(
files(classDirectories.files.collect {
fileTree(dir: it, excludes: [])
})
)
}
finalizedBy("jacocoTestCoverageVerification")
}
jacocoTestCoverageVerification {
violationRules {
rule {
enabled = true
element = "CLASS"
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = 0.50
}
}
}
}
sonarqube {
properties {
property("sonar.host.url", System.getenv("SONAR_QUBE_SERVER_URL"))
property("sonar.login", System.getenv("SONAR_QUBE_TOKEN"))
property("sonar.sources", "src/main/java")
property("sonar.tests", "src/test/java")
property("sonar.language", "java")
property("sonar.projectKey", System.getenv("SONAR_PROJECT_KEY"))
property("sonar.projectName", System.getenv("SONAR_PROJECT_NAME"))
property("sonar.java.source", 17)
property("sonar.sourceEncoding", "UTF-8")
property("sonar.java.binaries", "${buildDir}/classes")
property("sonar.test.inclusions", "")
property("sonar.exclusions", "")
property("sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/jacoco/index.xml")
}
}
task downloadYml {
doLast {
def url = new URL(System.getenv("YML_URL"))
def connection = url.openConnection()
def file = new File(projectDir, "./src/main/resources/application.yml")
if (!file.parentFile.exists()) {
file.parentFile.mkdirs()
}
connection.inputStream.withStream { inputStream ->
file.withOutputStream { outputStream ->
inputStream.transferTo(outputStream)
}
}
}
}
tasks.named("downloadYml") {
dependsOn compileJava
}