-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle
84 lines (60 loc) · 1.71 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
import java.util.regex.Matcher
apply plugin: 'application'
apply plugin: 'distribution'
version = '1.4'
dependencies {
compile group: 'commons-cli', name: 'commons-cli', version: '1.3.1'
compile group: 'commons-codec', name: 'commons-codec', version: '1.10'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
compile group: 'org.json', name: 'json', version: '20160212'
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.7'
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
repositories {
jcenter()
}
run {
mainClassName = 'com.liferay.jenkins.tools.JenkinsTools'
if (project.hasProperty('execArgs')) {
args(execArgs.split());
}
}
test {
testLogging {
events 'passed', 'skipped', 'failed'
exceptionFormat 'full'
showStandardStreams = true
}
}
task formatSource {
for (File sourceFile : sourceSets.main.allSource) {
boolean fileChanged = false
List<String> lines = sourceFile.readLines()
for (int i = 0; i < lines.size(); i++) {
String line = lines.get(i)
Matcher blankLineMatcher = line =~ /\s+$/
if (blankLineMatcher.find()) {
lines.set(i, blankLineMatcher.replaceFirst(""))
fileChanged = true
println "${sourceFile}(${i})"
}
}
String lastLine = lines.get(lines.size()-1)
while (lastLine.isEmpty()) {
lines.remove(lines.size()-1)
lastLine = lines.get(lines.size()-1)
fileChanged = true
println "Line ending ${sourceFile}"
}
if (fileChanged) {
sourceFile.delete()
for (String line : lines) {
sourceFile << "${line}\n"
}
}
}
}