-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
239 lines (212 loc) · 5.17 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
// clean --refresh-dependencies build
// -PReleaseBuild
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:[2,)"
classpath "com.moowork.gradle:gradle-node-plugin:[1,)"
//classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:[1,)"
}
}
plugins {
id "org.sonarqube" version "2.6"
id 'java'
id 'maven'
// id "com.github.spotbugs" version "4.6.0"
id 'eclipse'
id 'idea'
// id 'checkstyle'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.8.4'
}
// MAJOR VERSION - Manually set
//----------------------
group = "de.uniks"
ext{
majorNumber = 4
}
//----------------------
apply from: 'gradle/tasks.gradle'
apply from: 'gradle/mavencentral.gradle'
//apply from: 'gradle/artifactory.gradle'
repositories {
jcenter()
mavenCentral()
maven {
url "https://repo.eclipse.org/content/groups/releases/"
}
}
test {
// enable TestNG support (default is JUnit)
useJUnit {
dependencies {
implementation(group: 'junit', name: 'junit', version: '[4,)')
//testCompile group: 'org.xerial', name: 'sqlite-jdbc', version: '[3,)'
}
}
//we want display the following test events
testLogging {
events "FAILED", "SKIPPED"
exceptionFormat "short"
showStackTraces true
showStandardStreams true
showCauses true
}
reports.junitXml {
enabled true
destination new File("${buildDir}/reports/")
}
}
def execute(String... args) {
try {
if(args.length == 1) {
args = args[0].split(" ")
}
ByteArrayOutputStream stdOutput = new ByteArrayOutputStream()
exec{
commandLine args
standardOutput = stdOutput
}
stdOutput.toString()
}catch(Exception e) {
}
"";
}
def copyFile(String source, String dest) {
InputStream is = null;
OutputStream os = null;
try {
if(new File(source).exists() == false) {
return;
}
is = new FileInputStream(new File(source));
os = new FileOutputStream(new File(dest));
byte[] buffer = new byte[1024];
int length;
while ((length = is.read(buffer)) > 0) {
os.write(buffer, 0, length);
}
} finally {
if(is != null) {
is.close();
}
if(os != null) {
os.close();
}
}
}
def unzip(String src, String dest) {
byte[] buffer = new byte[1024];
java.util.zip.ZipInputStream zis = new java.util.zip.ZipInputStream(new FileInputStream(src));
java.util.zip.ZipEntry zipEntry = zis.getNextEntry();
while(zipEntry != null) {
String fileName = zipEntry.getName()
if(zipEntry.isDirectory() == false) {
File newFile = new File(dest+"/" + fileName)
if(newFile.getParentFile().exists() == false) {
newFile.getParentFile().mkdirs()
}
FileOutputStream fos = new FileOutputStream(newFile)
int len
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close()
}
zipEntry = zis.getNextEntry();
}
zis.closeEntry();
zis.close();
}
def delete(File file) {
if(file.isDirectory()) {
File[] contents = file.listFiles();
if (contents != null) {
for (File f : contents) {
deleteDir(f);
}
}
}
file.delete();
}
if(JavaVersion.current() != JavaVersion.VERSION_1_8){
println "JavaVersion: " + JavaVersion.current() + " (1.9)"
sourceCompatibility = 1.9
targetCompatibility = 1.9
} else {
println "JavaVersion: " + JavaVersion.current() + " (1.8)"
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
idea {
project {
// jdkName = '1.7'
// languageLevel = '1.7'
}
}
artifacts {
archives buildCoreJar16, buildCoreJar17, buildCoreJar18, buildCoreJar19, buildSourceJar, buildSourceJar18, buildMinCoreJar, buildJavadoc, buildGitJar
}
wrapper {
gradleVersion = '6.6.1'
}
jacoco.toolVersion = "0.8.+"
jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
executionData(files("${buildDir}/jacoco/test.exec"))
reports {
xml {
enabled = true
//Following value is a file
destination = new File("${buildDir}/test-results/jacoco.xml")
//build/reports/jacoco/test/jacocoTestReport.xml
}
csv{
destination = new File("${buildDir}/jacoco/report.csv")
enabled = true
}
html {
enabled = true
//Following value is a folder
destination = new File("${buildDir}/jacoco/html")
}
}
afterEvaluate {
classDirectories.from = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/javafx/**'])
})
}
}
if (project.hasProperty('branch')) {
new ProcessBuilder("git", "checkout", findProperty('branch')).start()
}
tasks.withType(Checkstyle) {
reports {
xml.enabled false
html.enabled true
}
}
test.finalizedBy jacocoTestReport
defaultTasks 'test', 'jacocoTestReport', 'buildJavadoc', 'buildGitJar'
tasks.withType(Checkstyle) {
configFile = new File("src/test/resources/de/uniks/networkparser/test/sun_checks.xml")
reports {
xml.enabled true
xml.destination = new File("build/checkStyle.xml")
html.enabled true
html.destination = new File("build/checkStyle.html")
}
showViolations = false
ignoreFailures = true
}
task npm(type:JavaExec) {
errorOutput = System.err
main = "de.uniks.networkparser.ext.DiagramEditor"
args 'NPM'
classpath = (sourceSets.main.compileClasspath + sourceSets.main.output + files('build/classes/main18') )
}