Slackbot
06/13/2023, 10:17 AMVampire
06/13/2023, 10:26 AMgradleProperty produced provider that has no value as you set the Gradle property for bugpatterns, but not the one for nullaway?Matan Sabag
06/13/2023, 12:50 PMVampire
06/13/2023, 1:32 PMcreateCastedProvider does.
But you use project.getProviders().gradleProperty in what you showed to get the value of a project property.
The requested project properties for getEnableBugpatterns and getEnableNullAway are most probably different I assume.
So if you change everything to getEnableBugpatterns and it works while with getEnableNullAway it fails with empty provider, my assumption is, that the project property for the former is set while the one for the latter is not.Matan Sabag
06/13/2023, 3:14 PMif inside the Callable in the following code evaluates to false. This is surprising as I saw in @melix blog post that this is possible for conditional addition of dependencies :
private void addDependencyProvider(
Project project, String configuration, Property<Boolean> property, String dependency) {
project
.getDependencies()
.addProvider(
configuration,
project.provider(
(Callable<Object>)
() -> {
if (property.get()) {
return dependency;
} else {
return null;
}
}));
}melix
06/13/2023, 3:15 PMnull may or may not work. So nowadays, I'm using addAllLater and systematically return a list of dependencies, which can be empty.melix
06/13/2023, 3:16 PMConfiguration instead of DependencyHandler)Matan Sabag
06/13/2023, 3:18 PM