forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
122 lines (102 loc) · 3.62 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.yaml:snakeyaml:1.17'
}
}
plugins {
id "de.undercouch.download" version "3.2.0"
}
apply plugin: 'de.undercouch.download'
import de.undercouch.gradle.tasks.download.Download
import de.undercouch.gradle.tasks.download.Verify
import org.yaml.snakeyaml.Yaml
allprojects {
group = 'org.logstash'
apply plugin: 'java'
apply plugin: 'idea'
project.sourceCompatibility = JavaVersion.VERSION_1_8
project.targetCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile).all {
def env = System.getenv()
boolean ci = env['CI']
//don't lint when running CI builds
if(!ci){
options.compilerArgs.add("-Xlint:all")
}
}
clean {
delete "${projectDir}/out/"
}
//https://stackoverflow.com/questions/3963708/gradle-how-to-display-test-results-in-the-console-in-real-time
tasks.withType(Test) {
testLogging {
// set options for log level LIFECYCLE
events "passed", "skipped", "failed", "standardOut"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat "full"
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
}
// fetch version from Logstash's master versions.yml file
def versionMap = (Map) (new Yaml()).load(new File("${projectDir}/versions.yml").text)
String jRubyURL
String jRubyVersion
String jRubySha1
Boolean doChecksum
if (versionMap["jruby-runtime-override"]) {
jRubyVersion = versionMap["jruby-runtime-override"]["version"]
jRubyURL = versionMap["jruby-runtime-override"]["url"]
doChecksum = false
} else {
jRubyVersion = versionMap["jruby"]["version"]
jRubySha1 = versionMap["jruby"]["sha1"]
jRubyURL = "http://jruby.org.s3.amazonaws.com/downloads/${jRubyVersion}/jruby-bin-${jRubyVersion}.tar.gz"
doChecksum = true
}
// Tasks
task bootstrap {}
task downloadJRuby(type: Download) {
description "Download JRuby artifact from this specific URL: ${jRubyURL}"
src jRubyURL
onlyIfNewer true
dest new File("${projectDir}/vendor/_", "jruby-bin-${jRubyVersion}.tar.gz")
}
task verifyFile(dependsOn: downloadJRuby, type: Verify) {
description "Verify the SHA1 of the download JRuby artifact"
src new File("${projectDir}/vendor/_/jruby-bin-${jRubyVersion}.tar.gz")
algorithm 'SHA-1'
checksum jRubySha1
}
task downloadAndInstallJRuby(dependsOn: verifyFile, type: Copy) {
description "Install JRuby in the vendor directory"
from tarTree(downloadJRuby.dest)
eachFile { f ->
f.path = f.path.replaceFirst("^jruby-${jRubyVersion}", '')
}
exclude "**/stdlib/rdoc/**"
includeEmptyDirs = false
into "${projectDir}/vendor/jruby"
}
// If you are running a JRuby snapshot we will skip the integrity check.
verifyFile.onlyIf { doChecksum }
bootstrap.dependsOn downloadAndInstallJRuby