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

Commit 25b3608

Browse files
committed
Fixed path issue on Mac OS
1 parent 83f4547 commit 25b3608

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher
191191

192192
String nodeSpecificMatlab = getNodeSpecificMatlab(Computer.currentComputer(), listener) + getNodeSpecificExecutable(launcher);
193193
FilePath matlabExecutablePath = new FilePath(launcher.getChannel(), nodeSpecificMatlab);
194-
194+
listener.getLogger().println("**The path which is trying to uppend is **" + matlabExecutablePath.getRemote ());
195195
if (!matlabExecutablePath.exists()) {
196196
throw new MatlabNotFoundError(Message.getValue("matlab.not.found.error"));
197197
}

src/main/java/com/mathworks/ci/tools/MatlabInstaller.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ public void setProducts (String products) {
7878
public FilePath performInstallation (ToolInstallation tool, Node node, TaskListener log)
7979
throws IOException, InterruptedException {
8080
FilePath supportingExecutable = preferredLocation (tool, node);
81-
FilePath expectedPath = new FilePath (supportingExecutable, this.getVersion ());
81+
String[] systemProperties = getSystemProperties(node);
82+
FilePath expectedPath;
83+
if(systemProperties[0].toLowerCase ().contains ("os x")) {
84+
expectedPath = new FilePath (supportingExecutable, this.getVersion ()+".app");
85+
} else {
86+
expectedPath = new FilePath (supportingExecutable, this.getVersion ());
87+
}
8288
MatlabInstallable installable;
8389
try {
84-
installable = (MatlabInstallable) getInstallable (node);
90+
installable = (MatlabInstallable) getInstallable (systemProperties);
8591
} catch (Exception e) {
8692
throw new InstallationFailedException (e.getMessage ());
8793
}
@@ -191,15 +197,9 @@ private void addMatlabProductsToArgs (ArgumentListBuilder args)
191197
}
192198
}
193199

194-
@SuppressFBWarnings(value = {"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"},
195-
justification =
196-
"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: Its false positive scenario for sport bug which is fixed in later versions "
197-
+ "https://github.com/spotbugs/spotbugs/issues/1843")
198-
public Installable getInstallable (Node node) throws IOException, InterruptedException {
200+
public Installable getInstallable (String[] systemProperties) throws IOException {
199201
// Gather properties for the node to install on
200-
String[] properties = node.getChannel ()
201-
.call (new GetSystemProperties ("os.name", "os.arch", "os.version"));
202-
return getInstallCandidate (properties[0], properties[1]);
202+
return getInstallCandidate (systemProperties[0], systemProperties[1]);
203203
}
204204

205205
public MatlabInstallable getInstallCandidate (String osName, String architecture)
@@ -224,6 +224,16 @@ public String getPlatform (String os, String architecture) throws InstallationFa
224224
}
225225
}
226226

227+
@SuppressFBWarnings(value = {"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"},
228+
justification =
229+
"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: Its false positive scenario for sport bug which is fixed in later versions "
230+
+ "https://github.com/spotbugs/spotbugs/issues/1843")
231+
private String[] getSystemProperties(Node node) throws IOException, InterruptedException {
232+
String[] properties = node.getChannel ()
233+
.call (new GetSystemProperties ("os.name", "os.arch", "os.version"));
234+
return properties;
235+
}
236+
227237
@Extension
228238
public static final class DescriptorImpl extends ToolInstallerDescriptor<MatlabInstaller> {
229239

0 commit comments

Comments
 (0)