@Incubating public interface FlowProviders
providers
so they can be used as inputs
to dataflow actions
.Modifier and Type | Method | Description |
---|---|---|
Provider<RequestedTasksResult> |
getRequestedTasksResult() |
Returns a
provider for the summary of the result of executing the
requested tasks . |
Provider<RequestedTasksResult> getRequestedTasksResult()
provider
for the summary of the result of executing the
requested tasks
.
The returned provider's value
becomes available after all requested tasks
have completed - successfully or otherwise - or after a configuration phase failure prevents the execution
of the requested tasks.
IMPORTANT: trying to access the provider's value before the requested tasks have finished will result in an error.
/** * A settings plugin that plays an appropriate sound at the end of a build. */ class SoundFeedbackPlugin implements Plugin<Settings> { private final FlowScope flowScope; private final FlowProviders flowProviders; @Inject SoundFeedbackPlugin(FlowScope flowScope, FlowProviders flowProviders) { this.flowScope = flowScope; this.flowProviders = flowProviders; } @Override public void apply(Settings target) { final File soundsDir = new File(target.getSettingsDir(), "sounds"); flowScope.always(FFPlay.class, spec -> spec.getParameters().getMediaFile().fileProvider( flowProviders.getRequestedTasksResult().map(result -> new File( soundsDir, result.getFailure().isPresent() ? "sad-trombone.mp3" : "tada.mp3" ) ) ) ); } }
FlowAction
,
FlowScope