Skip to content

Upgrade Lombok plugin#1139

Merged
ob-stripe merged 1 commit intomasterfrom
ob-bump-lombok
Oct 22, 2020
Merged

Upgrade Lombok plugin#1139
ob-stripe merged 1 commit intomasterfrom
ob-bump-lombok

Conversation

@ob-stripe
Copy link
Contributor

@ob-stripe ob-stripe commented Oct 22, 2020

r? @richardm-stripe

Upgrade Lombok Gradle plugin, and bump Lombok to the latest version.

The official Gradle plugin for Lombok changed, so this was a bit of a tricky update, but it does simplify the Gradle configuration and I've verified that the generated sources and Javadoc artifacts are unchanged (save for some minor changes brought by the Lombok upgrade itself and unrelated to the plugin).

Comment on lines -86 to -110
import io.franzbecker.gradle.lombok.task.DelombokTask

task delombok(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok/main")
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
args(it, "-d", outputDir)
}
doFirst {
outputDir.deleteDir()
}
}

task delombokTest(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok/test")
outputs.dir(outputDir)
sourceSets.test.java.srcDirs.each {
inputs.dir(it)
args(it, "-d", outputDir)
}
doFirst {
outputDir.deleteDir()
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer necessary: the new plugins automatically creates these tasks for us.

Comment on lines -112 to -114
task delombokHelp(type: DelombokTask) {
args "--help"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This task was never particularly useful.

Comment on lines -117 to -118
dependsOn delombok
source = delombok.outputDir
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also no longer necessary, the plugin automatically does this.

javadoc {
dependsOn delombok
source = delombok.outputDir
failOnError = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default value so I removed it.

failOnError = true
task sourcesJar(type: Jar) {
classifier = "sources"
from delombok
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensure the sources JAR uses the delombok'd sources.

}

task makeJavadocsJar(type: Jar, dependsOn: makeJavadocs) {
task javadocJar(type: Jar, dependsOn: javadoc) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the default javadoc task is updated by the plugin to use the delombok'd sources, we simply need to reference it and no longer need the makeJavadocs task.

Copy link
Contributor

@richardm-stripe richardm-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I think some of your PR comments might be useful as inline code comments, too.

@ob-stripe ob-stripe merged commit e76d858 into master Oct 22, 2020
@ob-stripe ob-stripe deleted the ob-bump-lombok branch October 22, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants