Skip to content

Commit

Permalink
Merge pull request #77 from chadlwilson/gradle-64
Browse files Browse the repository at this point in the history
Fix `DelombokTask` and `InstallLombokTask` under Gradle 6.4
  • Loading branch information
franzbecker authored May 10, 2020
2 parents 27f2811 + a6800b7 commit 9596c62
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package io.franzbecker.gradle.lombok.task

import io.franzbecker.gradle.lombok.LombokPlugin

import io.franzbecker.gradle.lombok.LombokPluginExtension
import org.gradle.api.Task
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.JavaExec
Expand All @@ -21,14 +22,14 @@ class DelombokTask extends JavaExec {
}

@Override
void exec() {
// Retrieve extension and configuration
def extension = project.extensions.findByType(LombokPluginExtension)
def compile = project.configurations.getByName(compileConfigurationName)
Task configure(Closure closure) {
setMain(project.extensions.findByType(LombokPluginExtension).main)
return super.configure(closure)
}

// Configure JavaExec
setMain(extension.main)
classpath(compile)
@Override
void exec() {
classpath(project.configurations.getByName(compileConfigurationName))
super.exec()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.franzbecker.gradle.lombok.task
import io.franzbecker.gradle.lombok.LombokPlugin
import io.franzbecker.gradle.lombok.LombokPluginExtension
import org.gradle.api.Task
import org.gradle.api.tasks.JavaExec

/**
Expand All @@ -11,16 +12,16 @@ class InstallLombokTask extends JavaExec {
static final String NAME = "installLombok"

@Override
void exec() {
// Retrieve extension and configuration
def extension = project.extensions.findByType(LombokPluginExtension)
def configuration = project.configurations.getByName(LombokPlugin.LOMBOK_CONFIGURATION_NAME)
Task configure(Closure closure) {
setMain(project.extensions.findByType(LombokPluginExtension).main)
return super.configure(closure)
}

@Override
void exec() {
// Configure JavaExec
setMain(extension.main)
setIgnoreExitValue(true)
setClasspath(configuration)

setClasspath(project.configurations.getByName(LombokPlugin.LOMBOK_CONFIGURATION_NAME))
super.exec()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CompatibilityIntegrationTest extends AbstractIntegrationTest {
'4.2.1' || 'build/classes/java'
'4.7' || 'build/classes/java'
'5.4' || 'build/classes/java'
'6.4' || 'build/classes/java'
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class DelombokTaskSpec extends AbstractJavaExecTaskSpec {
def expectedClasspath = project.configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME)

when: "task executes"
task.configure {}
task.exec()

then: "Delombok main is called"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class InstallLombokTaskSpec extends AbstractJavaExecTaskSpec {
def expectedClasspath = project.configurations.getByName(LombokPlugin.LOMBOK_CONFIGURATION_NAME)

when:
task.configure {}
task.exec()

then:
Expand Down

0 comments on commit 9596c62

Please sign in to comment.