-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
208 lines (184 loc) · 5.23 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
plugins {
id "com.jfrog.bintray" version "1.8.4"
id "com.github.ben-manes.versions" version "0.22.0"
}
apply plugin: "maven-publish"
apply plugin: "com.jfrog.bintray"
group = "com.obsidiandynamics.socketx"
version = "0.9.0-SNAPSHOT"
def envUser = "BINTRAY_USER"
def envKey = "BINTRAY_KEY"
task bintrayCredentialsCheck {
doLast {
if (System.getenv(envUser) == null) {
throw new GradleException("No Bintray username specified; set with 'export ${envUser}=<username>'")
}
if (System.getenv(envKey) == null) {
throw new GradleException("No Bintray key specified; set with 'export ${envKey}=<key>'")
}
}
}
allprojects {
apply plugin: "java"
apply plugin: "jacoco"
apply plugin: "maven-publish"
apply plugin: "com.jfrog.bintray"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
ext {
fulcrumVersion = "0.34.0"
indigoVersion = "1.15.0"
yconfVersion = "0.19.0"
}
dependencies {
testCompile "com.obsidiandynamics.indigo:indigo-assurance:${indigoVersion}"
testCompile "com.obsidiandynamics.fulcrum:fulcrum-assert:${fulcrumVersion}"
testCompile "com.obsidiandynamics.fulcrum:fulcrum-junit:${fulcrumVersion}"
testCompile "org.mockito:mockito-core:3.0.0"
testCompile "org.hamcrest:hamcrest-library:2.1"
testRuntime "org.slf4j:slf4j-log4j12:1.7.25"
testRuntime "log4j:log4j:1.2.17"
}
compileTestJava {
options.compilerArgs += "-proc:none"
options.compilerArgs += "-Xlint:unchecked"
options.compilerArgs += "-Xlint:deprecation"
}
jacoco {
toolVersion = "0.8.4"
}
javadoc {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
options.addStringOption("quiet", "-html5")
}
}
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
reports {
html.enabled true
xml.enabled true
csv.enabled false
}
}
// invoke this task when ready to publish to Bintray
bintrayUpload {
dependsOn ":bintrayCredentialsCheck"
dependsOn "jar"
dependsOn "sourcesJar"
dependsOn "javadocJar"
dependsOn "generatePomFileForMavenJavaPublication"
}
}
subprojects {
dependencies {
testCompile project(":").sourceSets.test.output
}
}
task jacocoMerge(type: JacocoMerge) {
mustRunAfter = allprojects.test
executionData = files(allprojects.jacocoTestReport.executionData)
doFirst {
executionData = files(files(allprojects.jacocoTestReport.executionData).findAll { it.exists() })
}
}
task jacocoRootReport(type: JacocoReport) {
dependsOn jacocoMerge
mustRunAfter = allprojects.test
additionalSourceDirs.from = files(allprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(allprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(allprojects.sourceSets.main.output)
executionData jacocoMerge.destinationFile
reports {
html.enabled true
xml.enabled true
csv.enabled false
}
onlyIf = {
true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ["sample/**"])
})
}
}
def packageName = "socketx-core"
dependencies {
compile "org.slf4j:slf4j-api:1.7.25"
compile "com.obsidiandynamics.yconf:yconf-core:${yconfVersion}"
compile "com.obsidiandynamics.fulcrum:fulcrum-await:${fulcrumVersion}"
compile "com.obsidiandynamics.fulcrum:fulcrum-shell:${fulcrumVersion}"
compile "javax.servlet:javax.servlet-api:4.0.1"
testCompile "com.obsidiandynamics.yconf:yconf-snakeyaml:${yconfVersion}"
}
jar {
baseName packageName
finalizedBy jacocoRootReport
}
task javadocJar(type: Jar, dependsOn: javadoc) {
baseName packageName
classifier = "javadoc"
from "$buildDir/docs/javadoc"
}
task sourcesJar(type: Jar) {
baseName packageName
from sourceSets.main.allSource
classifier = "sources"
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId project(":").group
artifactId packageName
version project(":").version
from components.java
artifact sourcesJar
artifact javadocJar
}
}
repositories {
maven {
url "${project(":").projectDir}/../repo"
}
}
}
def packageDesc = "Library for building high-performance WebSocket applications"
def repoName = "socketx"
bintray {
user = System.getenv(envUser)
key = System.getenv(envKey)
publications = ["mavenJava"]
pkg {
repo = "${repoName}"
name = packageName
userOrg = "obsidiandynamics"
desc = packageDesc
websiteUrl = "https://github.com/obsidiandynamics/${repoName}"
licenses = ["BSD New"]
vcsUrl = "https://github.com/obsidiandynamics/${repoName}"
issueTrackerUrl = "https://github.com/obsidiandynamics/${repoName}/issues"
publicDownloadNumbers = true
githubRepo = "obsidiandynamics/${repoName}"
override = true
publish = true
version {
name = project(":").version
desc = packageDesc
released = new Date()
vcsTag = project(":").version
}
}
}