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

Commit a178b63

Browse files
committed
Using descriptor id instead displaynam.
1 parent f238628 commit a178b63

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class MatlabBuilder extends Builder implements SimpleBuildStep {
5959
"Builder.matlab.runner.target.file.name";
6060
private static final String MATLAB_RUNNER_RESOURCE =
6161
"com/mathworks/ci/MatlabBuilder/runMatlabTests.m";
62+
private static final String AUTOMATIC_OPTION = "RunTestsAutomaticallyOption";
6263

6364

6465
@DataBoundConstructor
@@ -408,11 +409,10 @@ private synchronized int execMatlabCommand(Run<?, ?> build, FilePath workspace,
408409
TaskListener listener, boolean isLinuxLauncher)
409410
throws IOException, InterruptedException {
410411
setEnv(build.getEnvironment(listener));
411-
final String testRunMode = this.getTestRunTypeList().getDescriptor().getDisplayName();
412+
final String testRunMode = this.getTestRunTypeList().getDescriptor().getId();
412413

413414
// Copy MATLAB scratch file into the workspace only if Automatic option is selected.
414-
if (!testRunMode.equalsIgnoreCase(
415-
Message.getValue("builder.matlab.customcommandoption.display.name"))) {
415+
if (testRunMode.contains(AUTOMATIC_OPTION)) {
416416
copyMatlabScratchFileInWorkspace(MATLAB_RUNNER_RESOURCE, MATLAB_RUNNER_TARGET_FILE,
417417
workspace, getClass().getClassLoader());
418418
}
@@ -434,11 +434,10 @@ private synchronized int execMatlabCommand(Run<?, ?> build, FilePath workspace,
434434
}
435435

436436
public List<String> constructMatlabCommandWithBatch() {
437-
final String testRunMode = this.getTestRunTypeList().getDescriptor().getDisplayName();
437+
final String testRunMode = this.getTestRunTypeList().getDescriptor().getId();
438438
final String runCommand;
439439
final List<String> matlabDefaultArgs;
440-
if (!testRunMode.equalsIgnoreCase(
441-
Message.getValue("builder.matlab.customcommandoption.display.name"))) {
440+
if (testRunMode.contains(AUTOMATIC_OPTION)) {
442441
String matlabFunctionName =
443442
FilenameUtils.removeExtension(Message.getValue(MATLAB_RUNNER_TARGET_FILE));
444443
runCommand = "exit(" + matlabFunctionName + "("
@@ -486,9 +485,8 @@ private String[] getPostRunnerSwitches() {
486485

487486
private String[] getRunnerSwitch() {
488487
final String runCommand;
489-
final String testRunMode = this.getTestRunTypeList().getDescriptor().getDisplayName();
490-
if (!testRunMode.equalsIgnoreCase(
491-
Message.getValue("builder.matlab.customcommandoption.display.name"))) {
488+
final String testRunMode = this.getTestRunTypeList().getDescriptor().getId();
489+
if (testRunMode.contains(AUTOMATIC_OPTION)) {
492490
String matlabFunctionName =
493491
FilenameUtils.removeExtension(Message.getValue(MATLAB_RUNNER_TARGET_FILE));
494492
runCommand = "try,exit(" + matlabFunctionName + "("

0 commit comments

Comments
 (0)