forked from LMAX-Exchange/disruptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
201 lines (166 loc) · 5.16 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
/*
* Copyright 2011 LMAX Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply plugin: 'java'
apply plugin: 'osgi'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'eclipse' // Only used so the Eclipse STS Gradle plugin can see the 'perf' source set dependencies. :-(
apply plugin: 'checkstyle'
apply plugin: 'idea'
defaultTasks 'build'
group = 'com.lmax'
version = new Version(major: 3, minor: 4, revision: 0)
ext {
fullName = 'Disruptor Framework'
fullDescription = 'Disruptor - Concurrent Programming Framework'
teamName = 'LMAX Disruptor Development Team'
siteUrl = 'http://lmax-exchange.github.com/disruptor'
sourceUrl = '[email protected]:LMAX-Exchange/disruptor.git'
javaCompilerExecutable = System.env['JAVA_HOME'] ? System.env['JAVA_HOME'] + '/bin/javac' : 'javac'
if (!project.hasProperty('sonatypeUrl')) sonatypeUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
if (!project.hasProperty('sonatypeUsername')) sonatypeUsername = ''
if (!project.hasProperty('sonatypePassword')) sonatypePassword = ''
}
sourceSets {
perf.java.srcDir file('src/perftest/java')
java9.java.srcDir file('src/main/java9')
}
eclipse.classpath.plusConfigurations += [ sourceSets.perf.compileClasspath ]
repositories {
mavenCentral()
}
dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:8.2'
testCompile 'junit:junit:4.12'
perfCompile 'org.hdrhistogram:HdrHistogram:1.2.1'
}
idea.module {
testSourceDirs += sourceSets.perf.allSource.srcDirs
scopes.TEST.plus += [ configurations.perfCompile ]
}
compileJava {
// Suppress warnings about using Unsafe and sun.misc
options.compilerArgs << '-XDignore.symbol.file'
options.fork = true
options.debug = true
options.forkOptions.executable = javaCompilerExecutable
options.warnings = false
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
compileJava9Java {
sourceCompatibility = 1.9
targetCompatibility = 1.9
}
tasks.withType(Test) {
maxParallelForks = Runtime.runtime.availableProcessors() / 2
}
compilePerfJava {
classpath += sourceSets.main.runtimeClasspath
classpath += sourceSets.test.runtimeClasspath
}
javadoc {
title = 'Disruptor'
options.addStringOption('XDignore.symbol.file', '-quiet')
options.author = true
options.bottom = "<i>Copyright © 2011 - ${Calendar.instance[Calendar.YEAR]} LMAX Ltd. All Rights Reserved.</i>"
options.use = true
options.version = true
options.showFromPublic()
}
jar {
manifest.attributes(
'Built-By': System.properties['user.name'],
'Bundle-Name': fullName,
'Bundle-Vendor': teamName,
'Bundle-Description': fullDescription,
'Bundle-DocURL': siteUrl,
'Multi-Release': true
)
metaInf.into("versions/9", {
from(compileJava9Java.destinationDir)
include('**/*.class')
})
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
def projectPom = {
name = fullName
description = fullDescription
url = siteUrl
scm {
url = "scm:$sourceUrl"
connection = "scm:$sourceUrl"
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'team'
name = teamName
email = '[email protected]'
}
}
}
install {
repositories.mavenInstaller.pom.project(projectPom)
}
signing {
required { gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
uploadArchives {
repositories.mavenDeployer {
beforeDeployment { deployment -> signing.signPom(deployment) }
repository(url: sonatypeUrl) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project(projectPom)
}
}
build.dependsOn perfClasses
task perfJar(type: Jar) {
baseName = project.name + '-perf'
from { configurations.perfCompile.collect { it.isDirectory() ? it : zipTree(it) } }
from sourceSets.perf.output
from sourceSets.test.output
with jar
}
task wrapper(type: Wrapper) {
gradleVersion = '4.2'
}
class Version {
int major, minor = 0, revision = 0
boolean snapshot
String stage
String toString() {
"$major.$minor.$revision${stage ? '.' + stage : ''}${snapshot ? '-SNAPSHOT' : ''}"
}
}