forked from secure-device-onboard/rendezvous-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·160 lines (134 loc) · 4.94 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
// Copyright 2019 Intel Corporation
// SPDX-License-Identifier: Apache 2.0
repositories {
mavenCentral()
}
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'org.springframework.boot'
apply from: "$rootDir/config/checkstyle.gradle"
version = System.getProperty('version') ?: '1.8'
jar{
archivesBaseName = 'rendezvous-service'
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.6.RELEASE")
}
}
compileJava {
options.compilerArgs << "-Werror"
}
processResources {
filesMatching('application.yml') {
expand(project.properties)
}
}
task checkForJava8 {
if(JavaVersion.current() != JavaVersion.VERSION_1_8){
throw new GradleException("Java 8 is required to run this build")
}
}
configurations {
all {
exclude module: "spring-boot-starter-tomcat"
exclude module: "xml-apis"
exclude group: "org.eclipse.jetty.websocket"
exclude group: "commons-logging"
}
}
dependencies {
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-rest', version:'2.2.6.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-jetty', version:'2.2.6.RELEASE'
compile group: 'org.springframework', name: 'spring-aspects', version:'5.2.5.RELEASE'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version:'1.64'
compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version:'1.64'
compile group: 'io.jsonwebtoken', name: 'jjwt', version:'0.9.1'
compile group: 'redis.clients', name: 'jedis', version:'3.2.0'
compile group: 'com.google.guava', name: 'guava', version:'28.2-jre'
compile group: 'net.logstash.logback', name: 'logstash-logback-encoder', version: '6.3'
//Protecode jackson-databind, manually jackson updated
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.10.3'
compileOnly group: 'org.projectlombok', name: 'lombok', version:'1.18.12'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version:'1.18.12'
testCompile group: 'org.testng', name: 'testng', version:'7.1.0'
testCompile group: 'org.powermock', name: 'powermock-api-mockito2', version:'2.0.7'
testCompile group: 'org.powermock', name: 'powermock-module-testng', version:'2.0.7'
}
// Unit tests configuration
test {
useTestNG()
testLogging {
exceptionFormat 'full'
events 'FAILED'
}
afterTest { test, result ->
if(result.resultType.equals(TestResult.ResultType.SUCCESS)) {
float testExecutionTime = (result.endTime - result.startTime) / 1000.0 // in secs
logger.lifecycle(String.format("%s.%s [%.3f sec] PASSED",
test.className,
test.name,
testExecutionTime))
}
}
afterSuite { suite, result ->
if(!suite.parent) {
float suiteExecutionTime = (result.endTime - result.startTime) / 1000.0 // in secs
logger.quiet("")
logger.quiet(String.format("TEST SUITE TIME: %.3f sec", suiteExecutionTime))
if(result.failedTestCount == 0) {
logger.quiet("")
logger.quiet(String.format("%d tests completed, %d failed, %d skipped",
result.successfulTestCount,
result.failedTestCount,
result.skippedTestCount))
logger.quiet("")
}
}
}
}
// Jacoco configuration
jacoco {
toolVersion = "0.8.5"
}
task jacocoReportRendezvous(type: JacocoReport) {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
executionData = files(jacocoTestReport.executionData)
reports {
html.enabled = true
html.setDestination(file("${project.rootDir}/build/jacocoReport"))
xml.enabled = true
xml.setDestination(file("${project.rootDir}/build/jacocoReport/CoverageJacoco.xml"))
csv.enabled = true
csv.setDestination(file("${project.rootDir}/build/jacocoReport/CoverageJacoco.csv"))
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it,
exclude: ['org/sdo/rendezvous/development/**'])
})
}
}
task copyDockerDependencies(type: Copy){
mkdir "${project.rootDir}/demo/certs"
from ("${project.rootDir}"){
include "certs/*.jks"
}
into "${project.rootDir}/demo/certs"
from "${project.rootDir}/build/libs"
into "${project.rootDir}/demo"
}
task cleanDockerFiles(type: Delete) {
delete "${project.rootDir}/demo/certs"
delete fileTree("${project.rootDir}/demo/") {
include '**/*.jar'
}
}
clean.dependsOn cleanDockerFiles
build.dependsOn copyDockerDependencies
build.dependsOn checkForJava8