Skip to content

Commit f694920

Browse files
committed
Rework the lombok gradle task to use CLI
This allows us to also specify the BuildConfig directory. Without this, it is not included in the sources and an annoying warning pops up every time.
1 parent 82b327a commit f694920

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

library/build.gradle

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,27 @@ dependencies {
2828
testImplementation deps.privateConstructor
2929
}
3030

31-
task delombok(dependsOn: compileJava) {
31+
task delombok(type: JavaExec, dependsOn: compileJava) {
32+
def buildConfigInputDir = "$buildDir/gen/buildconfig/src/main"
33+
3234
ext.outputDir = 'build/delombok'
35+
outputs.dir(outputDir)
36+
inputs.dir(buildConfigInputDir)
37+
38+
args += "delombok"
3339

34-
doLast {
35-
ant.taskdef(name: 'delombok', classname: 'lombok.delombok.ant.Tasks$Delombok',
36-
classpath: configurations.compileOnly.asPath)
40+
sourceSets.main.java.srcDirs.each {
41+
inputs.dir(it)
3742

38-
ant.delombok(encoding: 'UTF-8', from: 'src/main/java', to: ext.outputDir,
39-
classpath: configurations.compileClasspath.asPath)
43+
args += it
4044
}
45+
46+
args += buildConfigInputDir
47+
args += "--target=$outputDir"
48+
args += "--classpath=$configurations.compileClasspath.asPath"
49+
50+
classpath configurations.compileOnly.asPath
51+
main = "lombok.launch.Main"
4152
}
4253

4354
buildConfig {

0 commit comments

Comments
 (0)