@@ -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