Package io.github.cdklabs.projen
Class Task
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- io.github.cdklabs.projen.Task
-
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.96.0 (build 921e240)", date="2024-03-28T21:16:42.805Z") @Stability(Experimental) public class Task extends software.amazon.jsii.JsiiObject
(experimental) A task that can be performed on the project.Modeled as a series of shell commands and subtasks.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTask.Builder(experimental) A fluent builder forTask.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddCondition(@NotNull String... condition)(experimental) Add a command to execute which determines if the task should be skipped.voidbuiltin(String name)(experimental) Execute a builtin task.voidenv(String name, String value)(experimental) Adds an environment variable to this task.voidexec(String command)(experimental) Executes a shell command.voidexec(String command, TaskStepOptions options)(experimental) Executes a shell command.StringgetCondition()(experimental) A command to execute which determines if the task should be skipped.StringgetCwd()(experimental) Returns the working directory for this task.StringgetDescription()(experimental) Returns the description of this task.Map<String,String>getEnvVars()(experimental) Returns all environment variables in the task level.StringgetName()(experimental) Task name.List<TaskStep>getSteps()(experimental) Returns an immutable copy of all the step specifications of the task.voidlock()(experimental) Forbid additional changes to this task.voidprepend(String shell)Deprecated.useprependExec()voidprepend(String shell, TaskStepOptions options)Deprecated.useprependExec()voidprependExec(String shell)(experimental) Adds a command at the beginning of the task.voidprependExec(String shell, TaskStepOptions options)(experimental) Adds a command at the beginning of the task.voidprependSay(String message)(experimental) Says something at the beginning of the task.voidprependSay(String message, TaskStepOptions options)(experimental) Says something at the beginning of the task.voidprependSpawn(Task subtask)(experimental) Adds a spawn instruction at the beginning of the task.voidprependSpawn(Task subtask, TaskStepOptions options)(experimental) Adds a spawn instruction at the beginning of the task.voidremoveStep(Number index)voidreset()(experimental) Reset the task so it no longer has any commands.voidreset(String command)(experimental) Reset the task so it no longer has any commands.voidreset(String command, TaskStepOptions options)(experimental) Reset the task so it no longer has any commands.voidsay(String message)(experimental) Say something.voidsay(String message, TaskStepOptions options)(experimental) Say something.voidsetCwd(String value)(experimental) Returns the working directory for this task.voidsetDescription(String value)(experimental) Returns the description of this task.voidspawn(Task subtask)(experimental) Spawns a sub-task.voidspawn(Task subtask, TaskStepOptions options)(experimental) Spawns a sub-task.voidupdateStep(Number index, TaskStep step)-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Constructor Detail
-
Task
protected Task(software.amazon.jsii.JsiiObjectRef objRef)
-
Task
protected Task(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
-
Task
@Stability(Experimental) public Task(@NotNull String name, @Nullable TaskOptions props)- Parameters:
name- This parameter is required.props-
-
Task
@Stability(Experimental) public Task(@NotNull String name)- Parameters:
name- This parameter is required.
-
-
Method Detail
-
addCondition
@Stability(Experimental) public void addCondition(@NotNull @NotNull String... condition)(experimental) Add a command to execute which determines if the task should be skipped.If a condition already exists, the new condition will be appended with
&&delimiter.- Parameters:
condition- The command to execute. This parameter is required.- See Also:
- Task.condition
-
builtin
@Stability(Experimental) public void builtin(@NotNull String name)(experimental) Execute a builtin task.Builtin tasks are programs bundled as part of projen itself and used as helpers for various components.
In the future we should support built-in tasks from external modules.
- Parameters:
name- The name of the builtin task to execute (e.g.release/resolve-version). This parameter is required.
-
env
@Stability(Experimental) public void env(@NotNull String name, @NotNull String value)(experimental) Adds an environment variable to this task.- Parameters:
name- The name of the variable. This parameter is required.value- The value. This parameter is required.
-
exec
@Stability(Experimental) public void exec(@NotNull String command, @Nullable TaskStepOptions options)(experimental) Executes a shell command.- Parameters:
command- Shell command. This parameter is required.options- Options.
-
exec
@Stability(Experimental) public void exec(@NotNull String command)(experimental) Executes a shell command.- Parameters:
command- Shell command. This parameter is required.
-
lock
@Stability(Experimental) public void lock()
(experimental) Forbid additional changes to this task.
-
prepend
@Stability(Deprecated) @Deprecated public void prepend(@NotNull String shell, @Nullable TaskStepOptions options)
Deprecated.useprependExec()(deprecated) Adds a command at the beginning of the task.- Parameters:
shell- The command to add. This parameter is required.options-
-
prepend
@Stability(Deprecated) @Deprecated public void prepend(@NotNull String shell)
Deprecated.useprependExec()(deprecated) Adds a command at the beginning of the task.- Parameters:
shell- The command to add. This parameter is required.
-
prependExec
@Stability(Experimental) public void prependExec(@NotNull String shell, @Nullable TaskStepOptions options)(experimental) Adds a command at the beginning of the task.- Parameters:
shell- The command to add. This parameter is required.options-
-
prependExec
@Stability(Experimental) public void prependExec(@NotNull String shell)(experimental) Adds a command at the beginning of the task.- Parameters:
shell- The command to add. This parameter is required.
-
prependSay
@Stability(Experimental) public void prependSay(@NotNull String message, @Nullable TaskStepOptions options)(experimental) Says something at the beginning of the task.- Parameters:
message- Your message. This parameter is required.options-
-
prependSay
@Stability(Experimental) public void prependSay(@NotNull String message)(experimental) Says something at the beginning of the task.- Parameters:
message- Your message. This parameter is required.
-
prependSpawn
@Stability(Experimental) public void prependSpawn(@NotNull Task subtask, @Nullable TaskStepOptions options)(experimental) Adds a spawn instruction at the beginning of the task.- Parameters:
subtask- The subtask to execute. This parameter is required.options-
-
prependSpawn
@Stability(Experimental) public void prependSpawn(@NotNull Task subtask)(experimental) Adds a spawn instruction at the beginning of the task.- Parameters:
subtask- The subtask to execute. This parameter is required.
-
removeStep
@Stability(Experimental) public void removeStep(@NotNull Number index)- Parameters:
index- The index of the step to remove. This parameter is required.
-
reset
@Stability(Experimental) public void reset(@Nullable String command, @Nullable TaskStepOptions options)(experimental) Reset the task so it no longer has any commands.- Parameters:
command- the first command to add to the task after it was cleared.options-
-
reset
@Stability(Experimental) public void reset(@Nullable String command)(experimental) Reset the task so it no longer has any commands.- Parameters:
command- the first command to add to the task after it was cleared.
-
reset
@Stability(Experimental) public void reset()
(experimental) Reset the task so it no longer has any commands.
-
say
@Stability(Experimental) public void say(@NotNull String message, @Nullable TaskStepOptions options)(experimental) Say something.- Parameters:
message- Your message. This parameter is required.options- Options.
-
say
@Stability(Experimental) public void say(@NotNull String message)(experimental) Say something.- Parameters:
message- Your message. This parameter is required.
-
spawn
@Stability(Experimental) public void spawn(@NotNull Task subtask, @Nullable TaskStepOptions options)(experimental) Spawns a sub-task.- Parameters:
subtask- The subtask to execute. This parameter is required.options-
-
spawn
@Stability(Experimental) public void spawn(@NotNull Task subtask)(experimental) Spawns a sub-task.- Parameters:
subtask- The subtask to execute. This parameter is required.
-
updateStep
@Stability(Experimental) public void updateStep(@NotNull Number index, @NotNull TaskStep step)- Parameters:
index- The index of the step to edit. This parameter is required.step- The new step to replace the old one entirely, it is not merged with the old step. This parameter is required.
-
getEnvVars
@Stability(Experimental) @NotNull public Map<String,String> getEnvVars()
(experimental) Returns all environment variables in the task level.
-
getName
@Stability(Experimental) @NotNull public String getName()
(experimental) Task name.
-
getSteps
@Stability(Experimental) @NotNull public List<TaskStep> getSteps()
(experimental) Returns an immutable copy of all the step specifications of the task.
-
getCondition
@Stability(Experimental) @Nullable public String getCondition()
(experimental) A command to execute which determines if the task should be skipped.If it returns a zero exit code, the task will not be executed.
-
getCwd
@Stability(Experimental) @Nullable public String getCwd()
(experimental) Returns the working directory for this task.Sets the working directory for this task.
-
setCwd
@Stability(Experimental) public void setCwd(@Nullable String value)(experimental) Returns the working directory for this task.Sets the working directory for this task.
-
getDescription
@Stability(Experimental) @Nullable public String getDescription()
(experimental) Returns the description of this task.Sets the description of this task.
-
setDescription
@Stability(Experimental) public void setDescription(@Nullable String value)(experimental) Returns the description of this task.Sets the description of this task.
-
-