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

Commit bbdc930

Browse files
committed
Version check for noAppIcon startup option.
1 parent 324f71a commit bbdc930

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.function.Function;
2222
import javax.annotation.Nonnull;
2323
import org.apache.commons.io.FilenameUtils;
24+
import org.apache.commons.lang.ArrayUtils;
2425
import org.kohsuke.stapler.DataBoundConstructor;
2526
import org.kohsuke.stapler.DataBoundSetter;
2627
import org.kohsuke.stapler.QueryParameter;
@@ -52,6 +53,7 @@ public class MatlabBuilder extends Builder implements SimpleBuildStep {
5253
private TestRunTypeList testRunTypeList;
5354
private String matlabRoot;
5455
private EnvVars env;
56+
private FilePath nodeSpecificMatlabRoot;
5557
private String nodeSpecificfileSeparator;
5658

5759
@DataBoundConstructor
@@ -476,6 +478,7 @@ public void perform(@Nonnull Run<?, ?> build, @Nonnull FilePath workspace,
476478
throws InterruptedException, IOException {
477479
//Set the environment variable specific to the this build
478480
setEnv(build.getEnvironment(listener));
481+
nodeSpecificMatlabRoot = new FilePath(launcher.getChannel(),getLocalMatlab());
479482
nodeSpecificfileSeparator = getNodeSpecificFileSeperator(launcher);
480483

481484
// Invoke MATLAB command and transfer output to standard
@@ -493,8 +496,7 @@ private synchronized int execMatlabCommand(FilePath workspace, Launcher launcher
493496
throws IOException, InterruptedException {
494497
ProcStarter matlabLauncher;
495498
try {
496-
FilePath nodeSpecificMatlabRoot = new FilePath(launcher.getChannel(),getLocalMatlab());
497-
MatlabReleaseInfo rel = new MatlabReleaseInfo(nodeSpecificMatlabRoot);
499+
MatlabReleaseInfo rel = new MatlabReleaseInfo(this.nodeSpecificMatlabRoot);
498500
matlabLauncher = launcher.launch().pwd(workspace).envs(this.env);
499501
if (rel.verLessThan(MatlabBuilderConstants.BASE_MATLAB_VERSION_BATCH_SUPPORT)) {
500502
ListenerLogDecorator outStream = new ListenerLogDecorator(listener);
@@ -539,7 +541,7 @@ public List<String> constructMatlabCommandWithBatch() {
539541
return matlabDefaultArgs;
540542
}
541543

542-
public List<String> constructDefaultMatlabCommand(boolean isLinuxLauncher) {
544+
public List<String> constructDefaultMatlabCommand(boolean isLinuxLauncher) throws MatlabVersionNotFoundException {
543545
final List<String> matlabDefaultArgs = new ArrayList<String>();
544546
Collections.addAll(matlabDefaultArgs, getPreRunnerSwitches());
545547
if (!isLinuxLauncher) {
@@ -554,10 +556,14 @@ public List<String> constructDefaultMatlabCommand(boolean isLinuxLauncher) {
554556
}
555557

556558

557-
private String[] getPreRunnerSwitches() {
559+
private String[] getPreRunnerSwitches() throws MatlabVersionNotFoundException {
558560
String[] preRunnerSwitches =
559561
{getLocalMatlab() + nodeSpecificfileSeparator + "bin" + nodeSpecificfileSeparator + "matlab", "-nosplash",
560-
"-nodesktop", "-noAppIcon"};
562+
"-nodesktop"};
563+
MatlabReleaseInfo rel = new MatlabReleaseInfo(this.nodeSpecificMatlabRoot);
564+
if(!rel.verLessThan(MatlabBuilderConstants.BASE_MATLAB_VERSION_NO_APP_ICON_SUPPORT)) {
565+
preRunnerSwitches = (String[]) ArrayUtils.add(preRunnerSwitches, "-noAppIcon");
566+
}
561567
return preRunnerSwitches;
562568
}
563569

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
public class MatlabBuilderConstants {
77
static final double BASE_MATLAB_VERSION_RUNTESTS_SUPPORT = 8.1;
8+
static final double BASE_MATLAB_VERSION_NO_APP_ICON_SUPPORT = 8.6;
89
static final double BASE_MATLAB_VERSION_BATCH_SUPPORT = 9.5;
910
static final double BASE_MATLAB_VERSION_COBERTURA_SUPPORT = 9.3;
1011
static final double BASE_MATLAB_VERSION_MODELCOVERAGE_SUPPORT = 9.5;

0 commit comments

Comments
 (0)