Skip to content

Commit

Permalink
Fix javadoc task after error-prone upgrade (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
robert3005 authored and iamdanfox committed Aug 2, 2018
1 parent 964a4b6 commit d9957e6
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.palantir.baseline.plugins
import net.ltgt.gradle.errorprone.ErrorPronePlugin
import org.gradle.api.Project
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test

class BaselineErrorProne extends AbstractBaselinePlugin {
Expand All @@ -32,18 +33,26 @@ class BaselineErrorProne extends AbstractBaselinePlugin {
errorprone "com.palantir.baseline:baseline-error-prone:${extractVersionString()}"
}

def errorProneConf = project.getConfigurations().getByName("errorprone")
project.afterEvaluate { p ->
p.tasks.withType(JavaCompile) {
options.compilerArgs += [
"-Xbootclasspath/p:${project.getConfigurations().getByName("errorprone").getAsPath()}",
"-Xbootclasspath/p:${errorProneConf.getAsPath()}",
"-XepDisableWarningsInGeneratedCode",
"-Xep:EqualsHashCode:ERROR",
"-Xep:EqualsIncompatibleType:ERROR",
]
}

p.tasks.withType(Test) {
jvmArgs "-Xbootclasspath/p:${project.getConfigurations().getByName("errorprone").getAsPath()}"
jvmArgs "-Xbootclasspath/p:${errorProneConf.getAsPath()}"
}

p.tasks.withType(Javadoc) {
// Add error-prone to bootstrap classpath of javadoc task.
// Since there's no way of appending to the classpath we need to explicitly add current bootstrap classpath.
options.bootClasspath.addAll(errorProneConf.resolve())
options.bootClasspath.addAll(System.properties["sun.boot.class.path"].split(File.pathSeparator).collect{new File(it)})
}
}
}
Expand Down

0 comments on commit d9957e6

Please sign in to comment.