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

Commit aa291d8

Browse files
committed
Fixed 374
1 parent a2ac30e commit aa291d8

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public String getMatlabRootFolder() {
5151
public String getMatlabInstallationHome(Computer cmp, TaskListener listener, EnvVars env)
5252
throws IOException, InterruptedException {
5353
return Utilities.getNodeSpecificHome(this.matlabInstallationName,
54-
cmp.getNode(), listener, env);
54+
cmp.getNode(), listener, env).getRemote ();
5555
}
5656

5757
public String getMatlabInstallationName() {

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,28 @@ public static void addMatlabToEnvPathFromAxis(Computer cmp, TaskListener listene
4141
return;
4242
}
4343

44+
FilePath matlabRoot = getNodeSpecificHome(name,
45+
cmp.getNode(), listener, env);
46+
47+
if(matlabRoot != null && matlabRoot.getParent().exists()){
48+
env.put("PATH+matlab_batch", matlabRoot.getParent().getRemote());
49+
}
50+
4451
String matlabExecutablePath = getNodeSpecificHome(name,
45-
cmp.getNode(), listener, env) + ((Boolean.TRUE.equals(cmp.isUnix()))?"/bin" : "\\bin");
52+
cmp.getNode(), listener, env).getRemote () + ((Boolean.TRUE.equals(cmp.isUnix()))?"/bin" : "\\bin");
4653
env.put("PATH+matlabroot", matlabExecutablePath);
4754

55+
4856
// Specify which MATLAB was added to path.
4957
listener.getLogger().println("\n" + String.format(Message.getValue("matlab.added.to.path.from"), matlabExecutablePath) + "\n");
5058
}
5159

52-
public static String getNodeSpecificHome(String instName,Node node, TaskListener listener, EnvVars env)
60+
public static FilePath getNodeSpecificHome(String instName,Node node, TaskListener listener, EnvVars env)
5361
throws IOException, InterruptedException {
5462
MatlabInstallation inst = MatlabInstallation.getInstallation(instName);
5563
if (inst == null || node == null) {
5664
// Following will error out in BuildWrapper
57-
return "";
65+
throw new MatlabNotFoundError("MATLAB installations could not be found");
5866
}
5967

6068
// get installation for node and environment.
@@ -66,6 +74,6 @@ public static String getNodeSpecificHome(String instName,Node node, TaskListener
6674
throw new MatlabNotFoundError(String.format(Message.getValue("matlab.not.found.error.for.node"), instName, Objects
6775
.requireNonNull(node).getDisplayName()));
6876
}
69-
return matlabExecutablePath.getRemote();
77+
return matlabExecutablePath;
7078
}
7179
}

0 commit comments

Comments
 (0)