This repository has been archived by the owner on Feb 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
154 lines (132 loc) · 4.85 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
// legacy plugins config; necessary to accomodate Java 6
buildscript {
repositories {
jcenter()
}
dependencies {
if (JavaVersion.current().isJava7Compatible()) {
classpath 'com.netflix.nebula:nebula-publishing-plugin:2.0.0'
}
}
}
// modern plugins config
plugins {
id 'com.github.jruby-gradle.base' version '0.1.17'
// Adding the nebula-publishing plugin when using JDK6 causes the build to abort
//id 'nebula.nebula-publishing' version '2.0.0'
id 'com.jfrog.bintray' version '1.0'
}
// TIP use -PpublishRelease=true to active release behavior regardless of the version
status = project.hasProperty('publishRelease') && project.publishRelease.toBoolean() ?
'release' : ((version == 'unspecified' || version.endsWith('-SNAPSHOT')) ? 'snapshot' : 'release')
ext {
buildDateTime = new Date()
(buildDateOnly, buildTimeOnly) = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSSZ').format(buildDateTime).split(' ')
statusIsRelease = (status == 'release')
// jar versions
guavaVersion = '18.0'
jrubyVersion = '1.7.20'
junitVersion = '4.12'
assertjVersion = '2.3.0'
// gem versions
logstashGemVersion = project.hasProperty('logstashGemVersion') ? project.logstashGemVersion : '1.5.6'
}
allprojects {
group = 'org.yuzutech.logstash'
defaultTasks 'check'
}
subprojects {
// NOTE applying Java plugin changes the status; take steps to preserve value
def _status = status
apply plugin: 'java'
status = _status
// NOTE sourceCompatibility & targetCompatibility are set in gradle.properties to meet requirements of Gradle
// Must redefine here to work around a bug in the Eclipse plugin
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_6
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
// QUESTION can we switch to jcenter() only?
mavenCentral()
maven {
name 'rubygems-release'
url 'http://rubygems-proxy.torquebox.org/releases'
}
maven {
name 'rubygems-prerelease'
url 'http://rubygems-proxy.torquebox.org/prereleases'
}
}
}
// apply Java and JRuby stuff for all subprojects except the distribution
configure(subprojects.findAll { !it.name.endsWith('-distribution') }) {
dependencies {
testCompile "junit:junit:$junitVersion"
testCompile "org.assertj:assertj-core:$assertjVersion"
}
test {
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
}
else {
jvmArgs '-XX:MaxPermSize=256m', '-XX:-UseGCOverheadLimit'
}
testLogging {
// events 'passed', 'failed', 'skipped', 'standard_out', 'standard_error'
// events 'standard_out', 'standard_error'
afterSuite { desc, result ->
if (!desc.parent && logger.infoEnabled) {
logger.info "Test results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
}
}
}
}
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
// Oracle JDK8 likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourcesJar(type: Jar, dependsOn: classes, group: 'Release') {
description 'Assembles a jar archive containing the main source code.'
from sourceSets.main.allSource
classifier 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc, group: 'Release') {
description 'Assembles a jar archive containing the Javadoc API documentation for the main source code.'
from javadoc.destinationDir
classifier 'javadoc'
}
// jcenter & Maven Central requires sources & javadoc jars (even if empty), so give 'em what they want
artifacts {
archives sourcesJar, javadocJar
}
apply plugin: 'com.github.jruby-gradle.base'
jruby {
defaultRepositories = false
defaultVersion = jrubyVersion
// TODO I'd like to be able to customize the name of the gemInstallDir
}
// QUESTION is this the right place to insert this task dependency in the lifecycle?
// IMPORTANT The TMP or TEMP environment variable must be set for the gem install command to work on Windows
processResources.dependsOn jrubyPrepareGems
apply from: rootProject.file('gradle/eclipse.gradle')
if (JavaVersion.current().isJava7Compatible()) {
apply from: rootProject.file('gradle/publish.gradle')
}
}
subprojects {
if (JavaVersion.current().isJava7Compatible()) {
apply from: rootProject.file('gradle/sign.gradle')
apply from: rootProject.file('gradle/deploy.gradle')
}
}
// disable bintrayUpload on root project to prevent build from failing
// NOTE seems to only get added when we use the modern plugin syntax
if (tasks.findByName(':bintrayUpload')) {
bintrayUpload.enabled = false
}