Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 8521007

Browse files
update to make tasks options for runMATLABBuild step (#236)
1 parent bad5f1b commit 8521007

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/main/java/com/mathworks/ci/RunMatlabBuildStep.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,19 @@ public class RunMatlabBuildStep extends Step {
2626
private String tasks;
2727

2828
@DataBoundConstructor
29-
public RunMatlabBuildStep(String tasks) {
30-
this.tasks = tasks;
29+
public RunMatlabBuildStep() {
30+
3131
}
3232

3333
public String getTasks() {
3434
return Util.fixNull(tasks);
3535
}
3636

37+
@DataBoundSetter
38+
public void setTasks(String tasks) {
39+
this.tasks = tasks;
40+
}
41+
3742
@Override
3843
public StepExecution start(StepContext context) throws Exception {
3944
return new MatlabBuildStepExecution(context, getTasks());

src/test/java/com/mathworks/ci/RunMatlabBuildStepTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ public void verifyPipelineOnSlave() throws Exception {
8787
j.assertBuildStatusSuccess(build);
8888
}
8989

90+
/*
91+
* Verify build runs with default tasks if no tasks are specified
92+
*/
93+
@Test
94+
public void verifyRunsWithDefaultTasks() throws Exception {
95+
project.setDefinition(
96+
new CpsFlowDefinition("node { runMATLABBuild() }", true));
97+
98+
WorkflowRun build = project.scheduleBuild2(0).get();
99+
j.assertLogContains("buildtool", build);
100+
}
101+
90102
/*
91103
* Verify appropriate task is invoked as in pipeline script
92104
*/

src/test/java/com/mathworks/ci/RunMatlabBuildStepTester.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
public class RunMatlabBuildStepTester extends RunMatlabBuildStep {
2222
@DataBoundConstructor
23-
public RunMatlabBuildStepTester(String tasks) {
24-
super(tasks);
23+
public RunMatlabBuildStepTester() {
24+
2525
}
26-
26+
2727
@Override
2828
public StepExecution start(StepContext context) throws Exception {
2929
return new TestStepExecution(context,this.getTasks());

0 commit comments

Comments
 (0)