@@ -102,19 +102,19 @@ public FilePath performInstallation (ToolInstallation tool, Node node, TaskListe
102102 return expectedPath ;
103103 }
104104
105- private int installUsingMpm (Node node , FilePath expectedPath , TaskListener log , FilePath installedProducts )
105+ private int installUsingMpm (Node node , FilePath destination , TaskListener log , FilePath installedProducts )
106106 throws IOException , InterruptedException {
107107
108108 Launcher matlabInstaller = node .createLauncher (log );
109109 ProcStarter installerProc = matlabInstaller .launch ();
110110
111111 ArgumentListBuilder args = new ArgumentListBuilder ();
112- args .add (expectedPath .getRemote () + getNodeSpecificMPMExecutor (node ));
112+ args .add (destination .getRemote () + getNodeSpecificMPMExecutor (node ));
113113 args .add ("install" );
114114 appendReleaseToArguments (args , log );
115- args .add ("--destination=" + expectedPath .getRemote ());
115+ args .add ("--destination=" + destination .getRemote ());
116116 addMatlabProductsToArgs (args , installedProducts );
117- installerProc .pwd (expectedPath ).cmds (args ).stdout (log );
117+ installerProc .pwd (destination ).cmds (args ).stdout (log );
118118 int result ;
119119 try {
120120 result = installerProc .join ();
@@ -179,28 +179,29 @@ private void updateProductList (FilePath installedProducts)
179179 }
180180
181181 private void appendReleaseToArguments (ArgumentListBuilder args , TaskListener log ) {
182- try {
183- String trimmedRelease = this .getVersion ().trim ();
184- String actualRelease = trimmedRelease ;
185-
186- if (trimmedRelease .equalsIgnoreCase ("latest" ) || trimmedRelease .equalsIgnoreCase (
187- "latest-including-prerelease" )) {
188- String releaseInfoUrl =
189- Message .getValue ("matlab.release.info.url" ) + trimmedRelease ;
190- String releaseVersion = IOUtils .toString (new URL (releaseInfoUrl ),
182+ String trimmedRelease = this .getVersion ().trim ();
183+ String actualRelease = trimmedRelease ;
184+
185+ if (trimmedRelease .equalsIgnoreCase ("latest" ) || trimmedRelease .equalsIgnoreCase (
186+ "latest-including-prerelease" )) {
187+ String releaseInfoUrl =
188+ Message .getValue ("matlab.release.info.url" ) + trimmedRelease ;
189+ String releaseVersion = null ;
190+ try {
191+ releaseVersion = IOUtils .toString (new URL (releaseInfoUrl ),
191192 StandardCharsets .UTF_8 ).trim ();
193+ } catch (IOException e ) {
194+ log .getLogger ().println ("Failed to fetch release version: " + e .getMessage ());
195+ }
192196
193- if (releaseVersion .contains ("prerelease" )) {
194- actualRelease = releaseVersion .replace ("prerelease" , "" );
195- args .add ("--release-status=Prerelease" );
196- } else {
197- actualRelease = releaseVersion ;
198- }
197+ if (releaseVersion != null && releaseVersion .contains ("prerelease" )) {
198+ actualRelease = releaseVersion .replace ("prerelease" , "" );
199+ args .add ("--release-status=Prerelease" );
200+ } else {
201+ actualRelease = releaseVersion ;
199202 }
200- args .add ("--release=" + actualRelease );
201- } catch (IOException e ) {
202- log .getLogger ().println ("Failed to fetch release version: " + e .getMessage ());
203203 }
204+ args .add ("--release=" + actualRelease );
204205 }
205206
206207 private void getFreshCopyOfExecutables (MatlabInstallable installable , FilePath expectedPath )
@@ -250,21 +251,26 @@ public Installable getInstallable (Node node) throws IOException, InterruptedExc
250251 // Gather properties for the node to install on
251252 String [] properties = node .getChannel ()
252253 .call (new GetSystemProperties ("os.name" , "os.arch" , "os.version" ));
253- return getInstallCandidate (properties [0 ]);
254+ return getInstallCandidate (properties [0 ], properties [ 1 ] );
254255 }
255256
256- public MatlabInstallable getInstallCandidate (String osName )
257+ public MatlabInstallable getInstallCandidate (String osName , String architecture )
257258 throws InstallationFailedException {
258- String platform = getPlatform (osName );
259+ String platform = getPlatform (osName , architecture );
259260 return new MatlabInstallable (platform );
260261 }
261262
262- public String getPlatform (String os ) throws InstallationFailedException {
263+ public String getPlatform (String os , String architecture ) throws InstallationFailedException {
263264 String value = os .toLowerCase (Locale .ENGLISH );
264265 if (value .contains ("linux" )) {
265266 return "glnxa64" ;
266267 } else if (value .contains ("os x" )) {
267- return "maci64" ;
268+ if (architecture .equalsIgnoreCase ("aarch64" ) || architecture .equalsIgnoreCase (
269+ "arm64" )) {
270+ return "maca64" ;
271+ } else {
272+ return "maci64" ;
273+ }
268274 } else if (value .contains ("windows" )) {
269275 return "win64" ;
270276 } else {
0 commit comments