77 */
88
99import java .io .IOException ;
10-
1110import java .io .InputStream ;
1211import java .net .URL ;
13-
1412import org .apache .commons .lang .RandomStringUtils ;
1513import hudson .EnvVars ;
1614import hudson .FilePath ;
@@ -70,8 +68,6 @@ default void copyFileInWorkspace(String sourceFile, String targetFile, FilePath
7068 targetFilePath .copyFrom (in );
7169 // set executable permission
7270 targetFilePath .chmod (0755 );
73-
74-
7571 }
7672
7773 default FilePath getFilePathForUniqueFolder (Launcher launcher , String uniqueName ,
@@ -90,40 +86,29 @@ default String getUniqueNameForRunnerFile() {
9086
9187 // This method prepares the temp folder by coping all helper files in it.
9288 default void prepareTmpFldr (FilePath tmpFldr , String runnerScript ) throws IOException , InterruptedException {
93-
94- // copy genscript package
89+ // copy genscript package
9590 copyFileInWorkspace (MatlabBuilderConstants .MATLAB_SCRIPT_GENERATOR ,
9691 MatlabBuilderConstants .MATLAB_SCRIPT_GENERATOR , tmpFldr );
97- FilePath zipFileLocation =
92+ FilePath zipFileLocation =
9893 new FilePath (tmpFldr , MatlabBuilderConstants .MATLAB_SCRIPT_GENERATOR );
99-
100-
101- runnerScript =getZipScript (runnerScript , zipFileLocation .getRemote ());
94+ runnerScript =replaceZipPlaceholder (runnerScript , zipFileLocation .getRemote ());
10295
10396 // Write MATLAB scratch file in temp folder.
10497 FilePath scriptFile =
10598 new FilePath (tmpFldr , getValidMatlabFileName (tmpFldr .getBaseName ()) + ".m" );
10699 scriptFile .write (runnerScript , "UTF-8" );
107-
108-
109-
110100 }
111101
112- default String getZipScript (String script , String url ) {
102+ default String replaceZipPlaceholder (String script , String url ) {
113103 script = script .replace ("${ZIP_FILE}" , url );
114104 return script ;
115105 }
116-
117-
118-
106+
119107 default String getRunnerScript (String script , String params , String uniqueTmpFldrName ) {
120108 script = script .replace ("${PARAMS}" , params );
121- // script = script.replaceAll("\\$\\{TMPDIR\\}", uniqueTmpFldrName);
122109 return script ;
123110 }
124-
125-
126-
111+
127112 default String getValidMatlabFileName (String actualName ) {
128113 return MatlabBuilderConstants .MATLAB_TEST_RUNNER_FILE_PREFIX
129114 + actualName .replaceAll ("-" , "_" );
0 commit comments