11package com .mathworks .ci ;
22
33/**
4- * Copyright 2020 The MathWorks, Inc.
4+ * Copyright 2020-2024 The MathWorks, Inc.
55 *
66 * Describable class for adding MATLAB installations in Jenkins Global Tool configuration.
7- *
87 */
98
109import edu .umd .cs .findbugs .annotations .SuppressFBWarnings ;
3635import org .kohsuke .stapler .DataBoundConstructor ;
3736import org .kohsuke .stapler .StaplerRequest ;
3837
39- public class MatlabInstallation extends ToolInstallation implements EnvironmentSpecific <MatlabInstallation >, NodeSpecific <MatlabInstallation > {
38+ public class MatlabInstallation extends ToolInstallation
39+ implements EnvironmentSpecific <MatlabInstallation >, NodeSpecific <MatlabInstallation > {
4040 private static final long serialVersionUID = 1L ;
4141
4242 @ DataBoundConstructor
@@ -45,14 +45,15 @@ public MatlabInstallation(String name, @CheckForNull String home, List<? extends
4545 }
4646
4747 /*
48- * Constructor for Custom object
49- * */
48+ * Constructor for Custom object
49+ */
5050
51- public MatlabInstallation (String name ){
51+ public MatlabInstallation (String name ) {
5252 super (name , null , null );
5353 }
5454
55- @ Override public MatlabInstallation forEnvironment (EnvVars envVars ) {
55+ @ Override
56+ public MatlabInstallation forEnvironment (EnvVars envVars ) {
5657 return new MatlabInstallation (getName (), envVars .expand (getHome ()), getProperties ().toList ());
5758 }
5859
@@ -61,26 +62,25 @@ public MatlabInstallation forNode(@Nonnull Node node, TaskListener log) throws I
6162 return new MatlabInstallation (getName (), translateFor (node , log ), getProperties ().toList ());
6263 }
6364
64- @ SuppressFBWarnings (value = {"NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" },
65- justification =
66- "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: Its false positive scenario for sport bug which is fixed in later versions "
67- + "https://github.com/spotbugs/spotbugs/issues/1843" )
65+ @ SuppressFBWarnings (value = {
66+ "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE" }, justification = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE: Its false positive scenario for sport bug which is fixed in later versions "
67+ + "https://github.com/spotbugs/spotbugs/issues/1843" )
6868 @ Override
6969 public void buildEnvVars (EnvVars env ) {
7070 String pathToExecutable = getHome () + "/bin" ;
7171 env .put ("PATH+matlabroot" , pathToExecutable );
7272 Jenkins jenkinsInstance = Jenkins .getInstanceOrNull ();
73- if (jenkinsInstance != null ){
74- if (jenkinsInstance .getChannel () != null ){
75- FilePath batchExecutablePath = new FilePath (jenkinsInstance .getChannel (), getHome ());
76- if ( batchExecutablePath .getParent () != null ) {
77- env .put ("PATH+matlab_batch" , batchExecutablePath .getParent ().getRemote ());
73+ if (jenkinsInstance != null ) {
74+ if (jenkinsInstance .getChannel () != null ) {
75+ FilePath batchExecutablePath = new FilePath (jenkinsInstance .getChannel (), getHome ());
76+ if ( batchExecutablePath .getParent () != null ) {
77+ env .put ("PATH+matlab_batch" , batchExecutablePath .getParent ().getRemote ());
7878 }
7979 }
8080 }
8181 }
8282
83- public static MatlabInstallation [] getAll () {
83+ public static MatlabInstallation [] getAll () {
8484 return Jenkins .get ().getDescriptorByType (DescriptorImpl .class ).getInstallations ();
8585 }
8686
@@ -97,7 +97,8 @@ public static MatlabInstallation getInstallation(String name) {
9797 return null ;
9898 }
9999
100- @ Extension @ Symbol ("matlab" )
100+ @ Extension
101+ @ Symbol ("matlab" )
101102 public static class DescriptorImpl extends ToolDescriptor <MatlabInstallation > {
102103 @ CopyOnWrite
103104 private volatile MatlabInstallation [] installations = new MatlabInstallation [0 ];
0 commit comments