@@ -21,15 +21,16 @@ var runtime_dir = path.join(jscomp_dir, "runtime");
21
21
var others_dir = path . join ( jscomp_dir , "others" ) ;
22
22
23
23
var ocaml_dir = path . join ( lib_dir , "ocaml" ) ;
24
- var config = require ( "./config.js" ) ;
25
24
26
- var is_windows = config . is_windows ;
27
- var sys_extension = config . sys_extension ;
25
+ var supported_os = [ 'darwin' , 'freebsd' , 'linux' , 'win32' ]
26
+ if ( supported_os . indexOf ( process . platform ) < 0 ) {
27
+ throw new Error ( "Not supported platform" + process . platform )
28
+ }
29
+ var is_windows = process . platform === 'win32'
28
30
29
31
process . env . BS_RELEASE_BUILD = "true" ;
30
32
31
33
var ninja_bin_output = path . join ( root_dir , process . platform , "ninja.exe" ) ;
32
- var preBuiltCompilerArtifacts = [ "bsc" , "bsb" , "bsb_helper" , "bsppx" , "refmt" ] ;
33
34
34
35
/**
35
36
* Make sure `ninja_bin_output` exists
@@ -181,57 +182,6 @@ function install(stdlib) {
181
182
} ) ;
182
183
}
183
184
184
- /**
185
- *
186
- * @param {string } sys_extension
187
- *
188
- */
189
- function copyPrebuiltCompilersForUnix ( sys_extension ) {
190
- var output = `
191
- rule cp
192
- command = cp $in $out
193
- ` ;
194
- output += preBuiltCompilerArtifacts
195
- . map ( function ( x ) {
196
- return `build ${ x } .exe: cp ${ x } ${ sys_extension } ` ;
197
- } )
198
- . join ( "\n" ) ;
199
- output += "\n" ;
200
-
201
- var filePath = path . join ( lib_dir , "copy.ninja" ) ;
202
- fs . writeFileSync ( filePath , output , "ascii" ) ;
203
- cp . execFileSync ( ninja_bin_output , [ "-f" , "copy.ninja" ] , {
204
- cwd : lib_dir ,
205
- stdio : [ 0 , 1 , 2 ]
206
- } ) ;
207
- fs . unlinkSync ( filePath ) ;
208
- }
209
-
210
- /**
211
- *
212
- * @param {string } sys_extension
213
- *
214
- */
215
- function copyPrebuiltCompilersForWindows ( sys_extension ) {
216
- preBuiltCompilerArtifacts . forEach ( function ( x ) {
217
- fs . copyFileSync (
218
- path . join ( lib_dir , `${ x } ${ sys_extension } ` ) ,
219
- path . join ( lib_dir , `${ x } .exe` )
220
- ) ;
221
- } ) ;
222
- }
223
-
224
- function copyPrebuiltCompilers ( ) {
225
- switch ( sys_extension ) {
226
- case ".win32" :
227
- copyPrebuiltCompilersForWindows ( sys_extension ) ;
228
- break ;
229
-
230
- default :
231
- copyPrebuiltCompilersForUnix ( sys_extension ) ;
232
- break ;
233
- }
234
- }
235
185
236
186
/**
237
187
* @returns {string|undefined }
0 commit comments