forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate.js
41 lines (37 loc) · 868 Bytes
/
validate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//@ts-check
var path = require("path");
var root_dir = path.join(__dirname, "..");
var lib_dir = path.join(root_dir, "lib");
var myVersion = "4.06.1";
var cp = require("child_process");
var ocamlopt = path.join(
__dirname,
"..",
"native",
myVersion,
"bin",
"ocamlopt.opt"
);
var ready = false;
cp.exec(
`git clean -dfx jscomp/runtime/*.cm* jscomp/stdlib-406/*.cm* jscomp/others/*.cm* `,
{ cwd: root_dir },
() => {
console.log(`clean up ready`);
ready = true;
}
);
cp.execSync(
`${ocamlopt} -linscan -I 4.06.1 -g -w -a ../jscomp/stubs/ext_basic_hash_stubs.c 4.06.1/whole_compiler.mli 4.06.1/whole_compiler.ml -o ../darwin/bsc `,
{ cwd: lib_dir, stdio: [0, 1, 2] }
);
function build() {
if (ready) {
cp.fork(path.join(__dirname, "ninja.js"), ["build"]);
} else {
setImmediate(() => {
build();
});
}
}
build();