Class Task.Builder

  • All Implemented Interfaces:
    software.amazon.jsii.Builder<Task>
    Enclosing class:
    Task

    @Stability(Experimental)
    public static final class Task.Builder
    extends Object
    implements software.amazon.jsii.Builder<Task>
    (experimental) A fluent builder for Task.
    • Method Detail

      • create

        @Stability(Experimental)
        public static Task.Builder create​(String name)
        Parameters:
        name - This parameter is required.
        Returns:
        a new instance of Task.Builder.
      • condition

        @Stability(Experimental)
        public Task.Builder condition​(String condition)
        (experimental) A shell command which determines if the this task should be executed.

        If the program exits with a zero exit code, steps will be executed. A non-zero code means that task will be skipped.

        Parameters:
        condition - A shell command which determines if the this task should be executed. This parameter is required.
        Returns:
        this
      • cwd

        @Stability(Experimental)
        public Task.Builder cwd​(String cwd)
        (experimental) The working directory for all steps in this task (unless overridden by the step).

        Default: - process.cwd()

        Parameters:
        cwd - The working directory for all steps in this task (unless overridden by the step). This parameter is required.
        Returns:
        this
      • description

        @Stability(Experimental)
        public Task.Builder description​(String description)
        (experimental) The description of this build command.

        Default: - the task name

        Parameters:
        description - The description of this build command. This parameter is required.
        Returns:
        this
      • env

        @Stability(Experimental)
        public Task.Builder env​(Map<String,​String> env)
        (experimental) Defines environment variables for the execution of this task.

        Values in this map will be evaluated in a shell, so you can do stuff like $(echo "foo").

        Default: {}

        Parameters:
        env - Defines environment variables for the execution of this task. This parameter is required.
        Returns:
        this
      • requiredEnv

        @Stability(Experimental)
        public Task.Builder requiredEnv​(List<String> requiredEnv)
        (experimental) A set of environment variables that must be defined in order to execute this task.

        Task execution will fail if one of these is not defined.

        Parameters:
        requiredEnv - A set of environment variables that must be defined in order to execute this task. This parameter is required.
        Returns:
        this
      • args

        @Stability(Experimental)
        public Task.Builder args​(List<String> args)
        (experimental) Should the provided exec shell command receive fixed args.

        Default: - no arguments are passed to the step

        Parameters:
        args - Should the provided exec shell command receive fixed args. This parameter is required.
        Returns:
        this
        See Also:
        TaskStepOptions.args
      • exec

        @Stability(Experimental)
        public Task.Builder exec​(String exec)
        (experimental) Shell command to execute as the first command of the task.

        Default: - add steps using `task.exec(command)` or `task.spawn(subtask)`

        Parameters:
        exec - Shell command to execute as the first command of the task. This parameter is required.
        Returns:
        this
      • receiveArgs

        @Stability(Experimental)
        public Task.Builder receiveArgs​(Boolean receiveArgs)
        (experimental) Should the provided exec shell command receive args passed to the task.

        Default: false

        Parameters:
        receiveArgs - Should the provided exec shell command receive args passed to the task. This parameter is required.
        Returns:
        this
        See Also:
        TaskStepOptions.receiveArgs
      • steps

        @Stability(Experimental)
        public Task.Builder steps​(List<? extends TaskStep> steps)
        (experimental) List of task steps to run.

        Parameters:
        steps - List of task steps to run. This parameter is required.
        Returns:
        this
      • build

        @Stability(Experimental)
        public Task build()
        Specified by:
        build in interface software.amazon.jsii.Builder<Task>
        Returns:
        a newly built instance of Task.