-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
205 lines (172 loc) · 6.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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
Applies core Gradle plugins, which are ones built into Gradle itself.
*/
plugins {
// Java for compile and unit test of Java source files. Read more at:
// https://docs.gradle.org/current/userguide/java_plugin.html
id 'java'
// Application for creating an executable JVM application. Read more at:
// https://docs.gradle.org/current/userguide/application_plugin.html
id 'application'
// Checkstyle for style checks and reports on Java source files. Read more at:
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
id 'checkstyle'
// JaCoCo for coverage metrics and reports of Java source files. Read more at:
// https://docs.gradle.org/current/userguide/jacoco_plugin.html
id 'jacoco'
// SpotBugs for static analysis to look for bugs in Java code. Read more at:
// https://plugins.gradle.org/plugin/com.github.spotbugs
id "com.github.spotbugs" version "5.0.6"
// Gradle Shadow creating fat/uber JARs with support for package relocation. Read more at:
// https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow
id "com.github.johnrengelman.shadow" version "7.1.2"
}
version = '1.0'
sourceCompatibility = 1.8
buildDir = 'build'
mainClassName = 'com.aws.iot.edgeconnectorforkvs.EdgeConnectorForKVSService'
tasks.withType(JavaCompile).configureEach {
//options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
options.fork = true
options.incremental = true
}
tasks.withType(Test).configureEach {
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
}
/*
Configures the JUnit5
*/
test {
useJUnitPlatform()
finalizedBy jacocoTestReport // report is always generated after tests run
}
/*
Configures the CheckStyle
*/
checkstyle {
sourceSets = [sourceSets.main]
ignoreFailures = true
}
/*
Configures the SpotBugs
*/
spotbugs {
excludeFilter = file("config/spotbugs/exclude.xml")
ignoreFailures = false
}
spotbugsTest {
ignoreFailures = false
}
import com.github.spotbugs.snom.SpotBugsTask
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
/*
Configures the JaCoCo
*/
check.dependsOn jacocoTestCoverageVerification
jacocoTestReport {
dependsOn test
}
def excludedPackages = [
"*/model/**",
"*/EdgeConnectorForKVSService.java"
]
jacocoTestCoverageVerification {
violationRules {
afterEvaluate {
getClassDirectories().setFrom(classDirectories.files.collect {
fileTree(dir: it, exclude: excludedPackages)
})
}
rule {
limit {
counter = 'LINE'
value = 'COVEREDRATIO'
minimum = 0.80
}
}
rule {
limit {
counter = 'BRANCH'
value = 'COVEREDRATIO'
minimum = 0.80
}
}
}
}
/*
Configures the Gradle Shadow.
*/
shadowJar {
archiveBaseName.set('EdgeConnectorForKVS')
archiveClassifier.set('super')
archiveVersion.set('1.0')
// This was originally set as 'output', causing artifact copying to fail
destinationDirectory.fileValue(file('build/libs'))
zip64 true
// exclude licenses from dependencies
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/io.netty.versions.properties'
// exclude poms from dependencies
exclude 'META-INF/maven/**'
// exclude OSGI from dependencies
exclude 'OSGI-INF/**'
// Exclude any signed jars or else fat jar will not be executable
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
}
/*
Configures the dependencies.
*/
repositories {
mavenCentral()
}
dependencies {
// Lombok
implementation group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
testImplementation group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: '1.18.22'
// AWS Greengrass Stream Manager
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.12.3'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.12.3'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-cbor', version: '2.12.3'
implementation group: 'javax.validation', name: 'validation-api', version: '1.0.0.GA'
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Compile
implementation group: 'com.amazonaws', name: 'amazon-kinesis-video-streams-parser-library', version: '1.2.4'
implementation group: 'com.amazonaws', name: 'aws-java-sdk-greengrassv2', version: '1.12.186'
implementation group: 'net.java.dev.jna', name: 'jna', version: '5.11.0'
implementation group: 'net.java.dev.jna', name: 'jna-platform', version: '5.11.0'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.2'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.2'
implementation group: 'org.freedesktop.gstreamer', name: 'gst1-java-core', version: '1.4.0'
implementation group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.2'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36'
implementation group: 'software.amazon.awssdk', name: 'greengrassv2', version: '2.17.157'
implementation group: 'software.amazon.awssdk', name: 'iotsitewise', version: '2.17.157'
implementation group: 'software.amazon.awssdk', name: 'secretsmanager', version: '2.17.157'
implementation group: 'software.amazon.awssdk.crt', name: 'aws-crt', version: '0.16.0'
implementation group: 'software.amazon.awssdk.iotdevicesdk', name: 'aws-iot-device-sdk', version: '1.7.1'
// Test
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.8.2'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.8.2'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.4.0'
testImplementation group: 'org.mockito', name: 'mockito-inline', version: '4.4.0'
testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '4.4.0'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.36'
testImplementation group: 'uk.org.webcompere', name: 'system-stubs-jupiter', version: '2.0.1'
}
// generate an uber jar
task release(dependsOn: [build, shadowJar])