Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DelombokTask and InstallLombokTask under Gradle 6.4 #77

Merged
merged 1 commit into from
May 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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