-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.bak
144 lines (115 loc) · 3.48 KB
/
build.gradle.bak
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
plugins {
id "org.springframework.boot" version "2.2.5.RELEASE" apply false
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'io.qameta.allure' version '2.7.0'
}
group 'jacocomultimodulesample'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
ext {
springBootVersion = "2.2.5.RELEASE"
allureVersion = "2.7.0"
}
apply plugin: "idea"
apply plugin: 'java-library'
apply plugin: 'jacoco'
def allureResultDirName = "allure-results"
allprojects {
apply plugin: "idea"
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'io.qameta.allure'
apply plugin: 'maven'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
jcenter()
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
jacoco {
toolVersion = "0.8.5"
}
/******* ALLURE ***************/
allure {
autoconfigure = true
version = "$allureVersion" // Latest Allure Version
reportDir = file("$projectDir/build/allure-report")
resultsDir = file("$projectDir/build/$allureResultDirName")
useJUnit5 {
version = "$allureVersion"
}
}
}
/******* JACOCO ***************/
def allTestCoverageFile = "$buildDir/jacoco/allTestCoverage.exec" //merging jacoco
task jacocoMergeTest(type: JacocoMerge) {
destinationFile = file(allTestCoverageFile)
executionData = project.fileTree(dir: '.', include:'**/build/jacoco/test.exec')
}
task jacocoMerge(dependsOn: ['jacocoMergeTest','jacocoRootReport']) {
// used to run the other merge tasks
}
task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
sourceDirectories.from = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(subprojects.sourceSets.main.output)
executionData.from = files(subprojects.jacocoTestReport.executionData).filter { f -> f.exists() }
reports {
xml.enabled = true
csv.enabled = false
html.enabled = true
}
onlyIf{
true
}
}
/***** merge allure ****/
task allureMerge(type: Copy) {
into "$buildDir/$allureResultDirName"
from subprojects.collect { "${it.buildDir}/$allureResultDirName" }
}
subprojects {
apply plugin: "io.spring.dependency-management"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}
test {
ignoreFailures false
// Fail the 'test' task on the first test failure
failFast = false
useJUnitPlatform()
systemProperty 'allure.results.directory', "${projectDir}/build/allure-results"
// listen to events in the test execution lifecycle
beforeTest { descriptor ->
logger.lifecycle("Running test: " + descriptor)
}
}
jacocoTestReport {
afterEvaluate {
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: '*Test.java')
})
}
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
}
test.finalizedBy(project.tasks.jacocoMerge, project.tasks.allureMerge)