@@ -201,39 +201,49 @@ function install(stdlib) {
201201 * @param {string } sys_extension
202202 *
203203 */
204- function createCopyNinja ( sys_extension ) {
205- var output = "" ;
206- switch ( sys_extension ) {
207- case ".win32" :
208- output += `
209- rule cp
210- command = cmd /q /c copy $in $out 1>nul
211- ` ;
212- break ;
213- default :
214- output += `
204+ function copyPrebuiltCompilersForUnix ( sys_extension ) {
205+ var output = `
215206rule cp
216207 command = cp $in $out
217208` ;
218- break ;
219- }
220- output += [ "bsc" , "bsb" , "bsb_helper" , "bsppx" , "refmt" ]
221- . map ( function ( x ) {
222- return `build ${ x } .exe: cp ${ x } ${ sys_extension } ` ;
223- } )
224- . join ( "\n" ) ;
225- output += "\n" ;
226- return output ;
209+ output += preBuiltCompilerArtifacts
210+ . map ( function ( x ) {
211+ return `build ${ x } .exe: cp ${ x } ${ sys_extension } ` ;
212+ } )
213+ . join ( "\n" ) ;
214+ output += "\n" ;
215+
216+ var filePath = path . join ( lib_dir , "copy.ninja" ) ;
217+ fs . writeFileSync ( filePath , output , "ascii" ) ;
218+ cp . execFileSync ( ninja_bin_output , [ "-f" , "copy.ninja" ] , {
219+ cwd : lib_dir ,
220+ stdio : [ 0 , 1 , 2 ]
221+ } ) ;
222+ fs . unlinkSync ( filePath ) ;
223+ }
224+
225+ /**
226+ *
227+ * @param {string } sys_extension
228+ *
229+ */
230+ function copyPrebuiltCompilersForWindows ( sys_extension ) {
231+ preBuiltCompilerArtifacts
232+ . forEach ( function ( x ) {
233+ fs . copyFileSync ( path . join ( lib_dir , `${ x } ${ sys_extension } ` ) , path . join ( ( lib_dir ) , `${ x } .exe` ) ) ;
234+ } ) ;
227235}
228236
229237function copyPrebuiltCompilers ( ) {
230- var filePath = path . join ( lib_dir , "copy.ninja" ) ;
231- fs . writeFileSync ( filePath , createCopyNinja ( sys_extension ) , "ascii" ) ;
232- cp . execFileSync ( ninja_bin_output , [ "-f" , "copy.ninja" ] , {
233- cwd : lib_dir ,
234- stdio : [ 0 , 1 , 2 ]
235- } ) ;
236- fs . unlinkSync ( filePath ) ;
238+ switch ( sys_extension ) {
239+ case ".win32" :
240+ copyPrebuiltCompilersForWindows ( sys_extension ) ;
241+ break ;
242+
243+ default :
244+ copyPrebuiltCompilersForUnix ( sys_extension ) ;
245+ break ;
246+ }
237247}
238248
239249/**
0 commit comments