Skip to content

Commit

Permalink
fix(tasks): all script property must be not-null and commands not…
Browse files Browse the repository at this point in the history
…-empty (#81)
  • Loading branch information
loicmathieu authored Oct 20, 2023
1 parent 96ec91a commit b7e8dcf
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.experimental.SuperBuilder;

import java.util.List;
import javax.validation.constraints.NotEmpty;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -64,6 +65,7 @@ public class Commands extends AbstractExecScript {
title = "The commands to run"
)
@PluginProperty(dynamic = true)
@NotEmpty
protected List<String> commands;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotNull;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -51,6 +52,7 @@ public class Script extends AbstractExecScript {
title = "The inline script content. This property is intended for the script file's content as a (multiline) string, not a path to a file. To run a command from a file such as `bash myscript.sh` or `python myscript.py`, use the `Commands` task instead."
)
@PluginProperty(dynamic = true)
@NotNull
protected String script;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.experimental.SuperBuilder;

import java.util.List;
import javax.validation.constraints.NotEmpty;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -64,6 +65,7 @@ public class Commands extends AbstractExecScript {
title = "The commands to run"
)
@PluginProperty(dynamic = true)
@NotEmpty
protected List<String> commands;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotNull;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -118,6 +119,7 @@ public class Script extends AbstractExecScript {
title = "The inline script content. This property is intended for the script file's content as a (multiline) string, not a path to a file. To run a command from a file such as `bash myscript.sh` or `python myscript.py`, use the `Commands` task instead."
)
@PluginProperty(dynamic = true)
@NotNull
protected String script;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public class Commands extends AbstractExecScript {
title = "The commands to run"
)
@PluginProperty(dynamic = true)
@NotNull
@NotEmpty
protected List<String> commands;

Expand All @@ -73,7 +72,6 @@ public class Commands extends AbstractExecScript {
title = "Which interpreter to use"
)
@PluginProperty
@NotNull
@NotEmpty
protected List<String> interpreter = List.of("/bin/sh", "-c");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ public class Script extends AbstractExecScript {
title = "The inline script content. This property is intended for the script file's content as a (multiline) string, not a path to a file. To run a command from a file such as `bash myscript.sh` or `python myscript.py`, use the `Commands` task instead."
)
@PluginProperty(dynamic = true)
@NotNull
protected String script;

@Builder.Default
@Schema(
title = "Which interpreter to use"
)
@PluginProperty
@NotNull
@NotEmpty
protected List<String> interpreter = List.of("pwsh", "-NoProfile", "-NonInteractive", "-Command");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ public class Commands extends AbstractExecScript {
title = "The commands to run"
)
@PluginProperty(dynamic = true)
@NotNull
@NotEmpty
protected List<String> commands;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.NotNull;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -110,6 +111,7 @@ public class Script extends AbstractExecScript {
title = "The inline script content. This property is intended for the script file's content as a (multiline) string, not a path to a file. To run a command from a file such as `bash myscript.sh` or `python myscript.py`, use the `Commands` task instead."
)
@PluginProperty(dynamic = true)
@NotNull
protected String script;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public class Commands extends AbstractExecScript {
title = "The commands to run"
)
@PluginProperty(dynamic = true)
@NotNull
@NotEmpty
protected List<String> commands;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.List;
import javax.validation.constraints.NotNull;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -98,6 +99,7 @@ public class Script extends AbstractExecScript {
title = "The inline script content. This property is intended for the script file's content as a (multiline) string, not a path to a file. To run a command from a file such as `bash myscript.sh` or `python myscript.py`, use the `Commands` task instead."
)
@PluginProperty(dynamic = true)
@NotNull
protected String script;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public class Commands extends AbstractExecScript {
title = "The commands to run"
)
@PluginProperty(dynamic = true)
@NotNull
@NotEmpty
protected List<String> commands;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.experimental.SuperBuilder;

import java.util.List;
import javax.validation.constraints.NotNull;

@SuperBuilder
@ToString
Expand Down Expand Up @@ -65,6 +66,7 @@ public class Script extends AbstractExecScript {
title = "The inline script content. This property is intended for the script file's content as a (multiline) string, not a path to a file. To run a command from a file such as `bash myscript.sh` or `python myscript.py`, use the `Commands` task instead."
)
@PluginProperty(dynamic = true)
@NotNull
protected String script;

@Override
Expand Down

0 comments on commit b7e8dcf

Please sign in to comment.