2
2
//@ts -check
3
3
var cp = require ( "child_process" ) ;
4
4
var path = require ( "path" ) ;
5
- var { sys_extension , is_windows } = require ( "./config.js" ) ;
5
+ var { is_windows } = require ( "./config.js" ) ;
6
6
7
7
var root = path . join ( __dirname , ".." ) ;
8
- var root_config = { cwd : root , stdio : [ 0 , 1 , 2 ] , encoding : ' utf8' } ;
8
+ var root_config = { cwd : root , stdio : [ 0 , 1 , 2 ] , encoding : " utf8" } ;
9
9
process . env . BS_RELEASE_BUILD = "true" ;
10
10
11
11
var ocamlVersion = require ( "./buildocaml.js" ) . getVersionPrefix ( ) ;
12
12
var fs = require ( "fs" ) ;
13
13
var hostPlatform = "darwin" ;
14
14
15
15
function rebuild ( ) {
16
- cp . execSync ( `node ${ path . join ( __dirname , "ninja.js" ) } clean` , {
17
- cwd : __dirname ,
18
- stdio : [ 0 , 1 , 2 ]
19
- } ) ;
20
- cp . execSync ( `node ${ path . join ( __dirname , "ninja.js" ) } config` , {
21
- cwd : __dirname ,
22
- stdio : [ 0 , 1 , 2 ]
23
- } ) ;
24
- cp . execSync ( `node ${ path . join ( __dirname , "ninja.js" ) } build` , {
16
+ cp . execSync ( `node ${ path . join ( __dirname , "ninja.js" ) } cleanbuild` , {
25
17
cwd : __dirname ,
26
18
stdio : [ 0 , 1 , 2 ]
27
19
} ) ;
@@ -36,22 +28,24 @@ function buildCompiler() {
36
28
ocamlopt : is_windows
37
29
? `ocamlopt.opt.exe`
38
30
: `../native/${ ocamlVersion } /bin/ocamlopt.opt` ,
39
- ext : sys_extension ,
40
31
INCL : ocamlVersion ,
41
32
isWin : is_windows
42
33
} ) ;
43
34
44
35
fs . writeFileSync ( path . join ( root , "lib" , prebuilt ) , content , "ascii" ) ;
45
- process . env . PATH =
46
- `${ path . join ( __dirname , '..' , 'vendor' , 'ninja' , 'snapshot' ) } ${ path . delimiter } ${ process . env . PATH } `
47
- let ninjaPath = `ninja${ sys_extension } `
36
+ process . env . PATH = `${ path . join ( __dirname , ".." , process . platform ) } ${
37
+ path . delimiter
38
+ } ${ process . env . PATH } `;
39
+ let ninjaPath = `ninja.exe` ;
48
40
cp . execSync (
49
- `${ ninjaPath } -C lib -f ${ prebuilt } -t clean && ${ ninjaPath } -v -C lib -f ${ prebuilt } ` ,
41
+ `${ ninjaPath } -C lib -f ${ prebuilt } -v - t clean && ${ ninjaPath } -v -C lib -f ${ prebuilt } ` ,
50
42
root_config
51
43
) ;
52
44
}
53
45
if ( ! is_windows ) {
54
- rebuild ( ) ;
46
+ if ( ! process . argv . includes ( "-noclean" ) ) {
47
+ rebuild ( ) ;
48
+ }
55
49
require ( "./ninja.js" ) . updateRelease ( ) ;
56
50
}
57
51
var os = require ( "os" ) ;
0 commit comments