-
Notifications
You must be signed in to change notification settings - Fork 14
/
build.gradle
132 lines (114 loc) · 3.7 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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'org.sonatype.gradle.plugins.scan' version '2.7.0'
id "base"
id "jacoco"
id "java"
}
repositories {
mavenCentral()
}
subprojects{
apply plugin: 'java'
apply plugin: 'jacoco'
repositories {
mavenCentral()
}
jar {
enabled = false
}
nexusIQScan {
username = project.hasProperty('nexusIQ.username') ? project.property('nexusIQ.username') : 'admin'
password = project.hasProperty('nexusIQ.password') ? project.property('nexusIQ.password'): "admin123"
serverUrl = project.hasProperty('nexusIQ.serverUrl') ? project.property("nexusIQ.serverUrl") : "http://localhost:8070"
applicationId = project.hasProperty('nexusIQ.applicationId') ? project.property("nexusIQ.applicationId") : "success_metrics"
stage = project.hasProperty('nexusIQ.stage') ? project.property("nexusIQ.stage") : "build"
allConfigurations = true
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
jacocoTestReport {
reports {
xml.required = true
csv.required = true
}
dependsOn test // tests are required to run before generating the report
}
}
def applicationname = "nexusiq-successmetrics-${version}"
def releasedir = "${applicationname}/${applicationname}"
def viewMetricsDir = "${releasedir}/view-metrics"
def getMetricsDir = "${releasedir}/get-metrics"
task packageViewFiles (type: Copy) {
dependsOn ':view-metrics:bootJar', ':assemble'
from('view-metrics/build/libs') {
include "view-metrics-${version}.jar"
}
from('view-metrics/releasefiles') {
include '**'
filter(ReplaceTokens, tokens: [APPVER: project.version])
}
into "${viewMetricsDir}"
}
task packageGetFiles (type: Copy) {
dependsOn ':get-metrics:bootJar', ':assemble'
from('get-metrics/build/libs') {
include "get-metrics-${version}.jar"
}
from('get-metrics/releasefiles') {
include '**'
filter(ReplaceTokens, tokens: [APPVER: project.version])
}
into "${getMetricsDir}"
}
task packageViewMetricsConfig (type: Copy) {
from('view-metrics/src/main/resources'){
include "application.properties"
}
into "${viewMetricsDir}/config"
}
task packageGetMetricsConfig (type: Copy) {
from('get-metrics/src/main/resources'){
include "application.properties"
}
into "${getMetricsDir}/config"
}
task release (type: Zip) {
dependsOn ':packageViewFiles', ':packageViewMetricsConfig', ':packageGetFiles', ':packageGetMetricsConfig'
from "${applicationname}"
archiveFileName = "${applicationname}.zip"
destinationDirectory = (file(projectDir))
}
clean.doFirst {
delete "${applicationname}"
delete "${applicationname}.zip"
}
release.doFirst {
mkdir "${releasedir}/iqmetrics"
mkdir "${releasedir}/datafiles"
}
task codeCoverageReport (type: JacocoReport) {
dependsOn(':get-metrics:jacocoTestReport', ':view-metrics:jacocoTestReport')
// If a subproject applies the 'jacoco' plugin, add the result it to the report
subprojects { subproject ->
subproject.plugins.withType(JacocoPlugin).configureEach {
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).configureEach { testTask ->
sourceSets subproject.sourceSets.main
executionData(testTask)
}
subproject.tasks.matching({ t -> t.extensions.findByType(JacocoTaskExtension) }).forEach {
rootProject.tasks.codeCoverageReport.dependsOn(it)
}
}
}
// enable the different report types (html, xml, csv)
reports {
xml.required = true
html.required = true
csv.required = true
}
}