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

Don't use lambda to provider compiler arguments #1755

Merged
merged 1 commit into from
May 6, 2021
Merged
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
Expand Up @@ -24,6 +24,7 @@
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.SourceSetContainer;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.process.CommandLineArgumentProvider;

public final class BaselineImmutables implements Plugin<Project> {

Expand All @@ -36,12 +37,16 @@ public void apply(Project project) {
.get()
.getOptions()
.getCompilerArgumentProviders()
.add(() -> {
if (hasImmutablesProcessor(project, sourceSet)) {
return Collections.singletonList("-Aimmutables.gradle.incremental");
}
// Use an anonymous class because tasks with lambda inputs cannot be cached
.add(new CommandLineArgumentProvider() {
@Override
public Iterable<String> asArguments() {
if (hasImmutablesProcessor(project, sourceSet)) {
return Collections.singletonList("-Aimmutables.gradle.incremental");
}

return Collections.emptyList();
return Collections.emptyList();
}
});
});
});
Expand Down