Skip to content

Commit

Permalink
Rewrite lambda to an inner class to prevent from Gradle warning about…
Browse files Browse the repository at this point in the history
… execution optimizations.
  • Loading branch information
entlicher committed Dec 17, 2021
1 parent 72fc8f3 commit 488d706
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -25,6 +25,7 @@
import org.gradle.api.Project;
import org.gradle.api.tasks.JavaExec;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.process.CommandLineArgumentProvider;

/**
*
Expand All @@ -48,8 +49,14 @@ public void apply(Project project) {
}
p.getTasks().withType(JavaExec.class).configureEach(je -> {
if (p.hasProperty(RUN_SINGLE_JVM_ARGS)) {
je.getJvmArgumentProviders().add(() -> {
return asList(p.property(RUN_SINGLE_JVM_ARGS).toString().split(" "));
// Property jvmArgumentProviders should not be implemented as a lambda to allow execution optimizations.
// See https://docs.gradle.org/current/userguide/validation_problems.html#implementation_unknown
je.getJvmArgumentProviders().add(new CommandLineArgumentProvider() {
// Do not convert to lambda.
@Override
public Iterable<String> asArguments() {
return asList(p.property(RUN_SINGLE_JVM_ARGS).toString().split(" "));
}
});
}
je.setStandardInput(System.in);
Expand Down

0 comments on commit 488d706

Please sign in to comment.