Package org.gradle.api.flow
Interface FlowAction<P extends FlowParameters>
-
- Type Parameters:
P- Parameter type for the dataflow action. Should beFlowParameters.Noneif the action does not have parameters.
@Incubating public interface FlowAction<P extends FlowParameters>
A dataflow action.A parameterized and isolated piece of work that becomes eligible for execution within a
dataflow scopeas soon as all of its inputparametersbecome available.Implementations can benefit from constructor injection of services using the
@Injectannotation. Currently, only a small subset of services is supported:ArchiveOperationsprovides means to operate on archives such as ZIP or TAR files.ExecOperationsprovides means to execute external processes.FileSystemOperationsprovides means to operate on the file system.
/** * Plays a given {@link Parameters#getMediaFile() media file} using {@code ffplay}. */ class FFPlay implements FlowAction<FFPlay.Parameters> { interface Parameters extends FlowParameters { @Input Property<File> getMediaFile(); } private final ExecOperations execOperations; @Inject FFPlay(ExecOperations execOperations) { this.execOperations = execOperations; } @Override public void execute(Parameters parameters) throws Exception { execOperations.exec(spec -> { spec.commandLine( "ffplay", "-nodisp", "-autoexit", "-hide_banner", "-loglevel", "quiet", parameters.getMediaFile().get().getAbsolutePath() ); spec.setIgnoreExitValue(true); }); } }- Since:
- 8.1
- See Also:
FlowScope,FlowProviders
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecute(P parameters)
-
-
-
Method Detail
-
execute
void execute(P parameters) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-