Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit e60c2a8

Browse files
authored
Merge pull request #486 from cloudant/jenkins-spotbugs
Jenkins spotbugs
2 parents e774f83 + 6ae4a15 commit e60c2a8

7 files changed

Lines changed: 18 additions & 32 deletions

File tree

Jenkinsfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ stage('QA') {
5757

5858
// Standard builds do Findbugs and test against Cloudant
5959
def axes = [
60-
Findbugs:
60+
Spotbugs:
6161
{
6262
node {
6363
unstash name: 'built'
64-
// findBugs
64+
// Spotbugs
6565
try {
66-
sh './gradlew -Dfindbugs.xml.report=true findbugsMain'
66+
sh './gradlew -Dspotbugs.xml.report=true spotbugsMain'
6767
} finally {
68-
step([$class: 'FindBugsPublisher', pattern: '**/build/reports/findbugs/*.xml'])
68+
recordIssues enabledForFailure: true, tool: spotBugs(pattern: '**/build/reports/spotbugs/*.xml')
6969
}
7070
}
7171
},

build.gradle

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
* and limitations under the License.
1313
*/
1414

15+
plugins {
16+
id "com.github.spotbugs" version "2.0.0" apply false
17+
}
18+
1519
subprojects {
1620
apply plugin: 'java'
1721
apply plugin: 'maven'
@@ -175,24 +179,24 @@ subprojects {
175179
}
176180

177181
// Findbugs
178-
apply plugin: 'findbugs'
179-
findbugs {
180-
toolVersion = "3.0.1"
182+
apply plugin: 'com.github.spotbugs'
183+
spotbugs {
184+
toolVersion = "3.1.12"
181185
// Report only high severity bugs for now
182186
reportLevel = "low"
183187
// The code base is pretty small so use max effort
184188
effort = "max"
185189
// We don't want to run findbugs on the test code yet
186190
sourceSets = [sourceSets.main]
187191
// Exclude a couple of known bugs until we get the chance to fix them
188-
if (file("findbugs_excludes.xml").exists()) {
189-
excludeFilter = file("findbugs_excludes.xml")
192+
if (file("spotbugs_excludes.xml").exists()) {
193+
excludeFilter = file("spotbugs_excludes.xml")
190194
}
191195
}
192196

193-
tasks.withType(FindBugs) {
197+
tasks.withType(com.github.spotbugs.SpotBugsTask) {
194198
// Currently only one report type can be used toggle which with a property
195-
boolean generateXML = Boolean.getBoolean("findbugs.xml.report")
199+
boolean generateXML = Boolean.getBoolean("spotbugs.xml.report")
196200
reports {
197201
xml.enabled = generateXML
198202
html.enabled = !generateXML

cloudant-client/build.gradle

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,10 @@
1212
* and limitations under the License.
1313
*/
1414

15-
// Additional configurations for javadoc
16-
configurations {
17-
linkableJavadoc {
18-
transitive false
19-
}
20-
}
21-
2215
dependencies {
2316
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
2417
compile group: 'commons-codec', name: 'commons-codec', version: '1.6'
2518
compile project(':cloudant-http')
26-
linkableJavadoc project(':cloudant-http')
2719
//test dependencies
2820
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
2921
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
@@ -37,25 +29,15 @@ javadoc {
3729
options.overview = "overview.html"
3830
include("**/lightcouch/*Exception.java",
3931
"**/client/api/**")
32+
// Resolve the links to the cloudant-http project javadoc
33+
options.linksOffline("http://static.javadoc.io/com.cloudant/cloudant-http/${project.version}","${project.rootProject.rootDir}/cloudant-http/build/docs/javadoc");
4034
}
4135

4236
javadocJar {
4337
// Include the logging.properties example
4438
from rootProject.rootDir.path + '/logging.properties'
4539
}
4640

47-
gradle.projectsEvaluated {
48-
javadoc {
49-
// Add the offline link options for the client API pointing to javadoc.io using the resolved
50-
// java-cloudant version. Use the package-list from the javadoc zip file.
51-
configurations.linkableJavadoc.each {
52-
String moduleName = configurations.linkableJavadoc.resolvedConfiguration.firstLevelModuleDependencies.first().moduleName;
53-
String moduleVers = configurations.linkableJavadoc.resolvedConfiguration.firstLevelModuleDependencies.first().moduleVersion;
54-
options.linksOffline("http://static.javadoc.io/com.cloudant/$moduleName/$moduleVers","../$moduleName/build/docs/javadoc");
55-
}
56-
}
57-
}
58-
5941
// we need Java 1.8 features for JUnit 5 features, but our production code is 1.6
6042
compileTestJava {
6143
sourceCompatibility = 1.8

gradle/wrapper/gradle-wrapper.jar

84 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)