diff --git a/README.md b/README.md index 9b72300..b1a1083 100644 --- a/README.md +++ b/README.md @@ -61,32 +61,10 @@ When using Lombok in teams with no automated Eclipse provisioning this is quite This plugin adds a task called `installLombok` to your Gradle build that uses the dependency that has already been added to the compile-only scope, verifies its integrity using SHA-256 and finally invokes the main class of the JAR. This greatly simplifies the installation process for each developer and makes sure that the same version is used across the team. ## Delombok support -The plugin offers basic support for delomboking. The `DelombokTask` is a simple `JavaExec` task that calls `delombok` on Lombok's main class and simplifies the setup of such a task in the build process: - import io.franzbecker.gradle.lombok.task.DelombokTask - - task delombok(type: DelombokTask, dependsOn: compileJava) { - ext.outputDir = file("$buildDir/delombok") - outputs.dir(outputDir) - sourceSets.main.java.srcDirs.each { - inputs.dir(it) - args(it, "-d", outputDir) - } - doFirst { - outputDir.deleteDir() - } - } - - task delombokHelp(type: DelombokTask) { - args "--help" - } - -The class path for the `DelombokTask` includes, by default, the dependencies of the `compile` and `lombok` configurations only. +The plugin offers basic support for delomboking. The `DelombokTask` is a simple `JavaExec` task that calls `delombok` on Lombok's main class and simplifies the setup of such a task in the build process. It is not a ready to use task. -Note that if you want to generate JavaDoc you need to configure the `javadoc` task accordingly. For example: +Examples can be found at: - javadoc { - dependsOn delombok - source = delombok.outputDir - failOnError = false - } +[examples/delombok-gradle-groovy/build.gradle](examples/delombok-gradle-groovy/build.gradle) and
+[examples/delombok-gradle-kotlin/build.gradle.kts](examples/delombok-gradle-kotlin/build.gradle.kts) diff --git a/examples/README.md b/examples/README.md index eb1fd2f..ac0c1ac 100644 --- a/examples/README.md +++ b/examples/README.md @@ -19,3 +19,13 @@ Run it with: ./gradlew :delombok-gradle-groovy:javadoc And open up [Greeting.html](delombok-gradle-groovy/build/docs/javadoc/com/example/Greeting.html) in your browser. + +## delombok-gradle-kotlin + +Demonstrates how the delombok task can be used to generate JavaDoc with Kotlin as the Gradle script language. + +Run it with: + + ./gradlew :delombok-gradle-kotlin:javadoc + +And open up [Greeting.html](delombok-gradle-kotlin/build/docs/javadoc/com/example/Greeting.html) in your browser. diff --git a/examples/delombok-gradle-kotlin/build.gradle.kts b/examples/delombok-gradle-kotlin/build.gradle.kts new file mode 100644 index 0000000..4a5e7db --- /dev/null +++ b/examples/delombok-gradle-kotlin/build.gradle.kts @@ -0,0 +1,26 @@ +import io.franzbecker.gradle.lombok.task.DelombokTask + +tasks { + + val delombok by registering(DelombokTask::class) + delombok { + dependsOn(compileJava) + val outputDir by extra { file("$buildDir/delombok") } + outputs.dir(outputDir) + sourceSets.getByName("main").java.srcDirs.forEach { + inputs.dir(it) + args(it, "-d", outputDir) + } + doFirst { + outputDir.delete() + } + } + + javadoc { + dependsOn(delombok) + val outputDir: File by delombok.get().extra + source = fileTree(outputDir) + isFailOnError = false + } + +} diff --git a/examples/delombok-gradle-kotlin/src/main/java/com/example/Greeting.java b/examples/delombok-gradle-kotlin/src/main/java/com/example/Greeting.java new file mode 100644 index 0000000..adf069a --- /dev/null +++ b/examples/delombok-gradle-kotlin/src/main/java/com/example/Greeting.java @@ -0,0 +1,9 @@ +package com.example; + +import lombok.Data; + +@Data +public class Greeting { + + private String message; +} diff --git a/examples/settings.gradle b/examples/settings.gradle index 58987d3..d4e15b1 100644 --- a/examples/settings.gradle +++ b/examples/settings.gradle @@ -5,3 +5,4 @@ rootProject.name = 'examples' include 'hello-world' include 'delombok-gradle-groovy' +include 'delombok-gradle-kotlin'