-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
189 lines (163 loc) · 4.97 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
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
}
plugins {
id "java"
id "java-library"
id "checkstyle"
id "jacoco"
id "signing"
id "maven-publish"
id "de.marcphilipp.nexus-publish" version "0.3.0"
id "io.codearte.nexus-staging" version "0.30.0"
id "idea"
}
repositories {
mavenLocal()
// Before LaunchDarkly release artifacts get synced to Maven Central they are here along with snapshots:
maven { url "https://oss.sonatype.org/content/groups/public/" }
mavenCentral()
}
configurations.all {
// check for updates every build for dependencies with: 'changing: true'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
apply from: 'build-shared.gradle'
checkstyle {
toolVersion = "9.3"
configFile file("${project.rootDir}/checkstyle.xml")
}
compileJava {
classpath = configurations.privateImplementation
}
// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
javadoc {
classpath = configurations.privateImplementation // see build-shared.gradle
// Force the Javadoc build to fail if there are any Javadoc warnings. See: https://discuss.gradle.org/t/javadoc-fail-on-warning/18141/3
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
// for information about the -Xwerror option.
options.addBooleanOption('Xwerror')
}
artifacts {
archives jar, sourcesJar, javadocJar
}
test {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
showStandardStreams = true
exceptionFormat = 'full'
}
}
jacocoTestReport { // code coverage report
reports {
xml.enabled
csv.enabled true
html.enabled true
}
}
jacocoTestCoverageVerification {
// See notes in CONTRIBUTING.md on code coverage. Unfortunately we can't configure line-by-line code
// coverage overrides within the source code itself, because Jacoco operates on bytecode.
violationRules { rules ->
def knownMissedLinesForMethods = [
// The key for each of these items is the complete method signature minus the "com.launchdarkly.logging." prefix.
]
knownMissedLinesForMethods.each { partialSignature, maxMissedLines ->
if (maxMissedLines > 0) { // < 0 means skip entire method
rules.rule {
element = "METHOD"
includes = [ "com.launchdarkly.logging." + partialSignature ]
limit {
counter = "LINE"
value = "MISSEDCOUNT"
maximum = maxMissedLines
}
}
}
}
// General rule that we should expect 100% test coverage; exclude any methods that have overrides above
rule {
element = "METHOD"
limit {
counter = "LINE"
value = "MISSEDCOUNT"
maximum = 0
}
excludes = knownMissedLinesForMethods.collect { partialSignature, maxMissedLines ->
"com.launchdarkly.logging." + partialSignature
}
}
}
}
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
nexusStaging {
packageGroup = "com.launchdarkly"
numberOfRetries = 40 // we've seen extremely long delays in closing repositories
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = 'com.launchdarkly'
artifactId = 'launchdarkly-logging'
artifact sourcesJar
artifact javadocJar
pom {
name = 'launchdarkly-logging'
description = 'LaunchDarkly Logging API for Java'
url = 'https://github.com/launchdarkly/java-logging'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'LaunchDarkly'
email = 'team@launchdarkly.com'
}
}
scm {
connection = 'scm:git:git://github.com/launchdarkly/java-logging.git'
developerConnection = 'scm:git:ssh:git@github.com:launchdarkly/java-logging.git'
url = 'https://github.com/launchdarkly/java-logging'
}
}
}
}
repositories {
mavenLocal()
}
}
nexusPublishing {
clientTimeout = java.time.Duration.ofMinutes(2) // we've seen extremely long delays in creating repositories
repositories {
sonatype {
username = ossrhUsername
password = ossrhPassword
}
}
}
signing {
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { !"1".equals(project.findProperty("LD_SKIP_SIGNING")) } // so we can build jars for testing in CI
}