Skip to content

Commit e874082

Browse files
committed
indent
1 parent 84290b4 commit e874082

File tree

1 file changed

+65
-68
lines changed

1 file changed

+65
-68
lines changed

scripts/tasks.js

Lines changed: 65 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,80 @@
1-
21
//@ts-check
32

4-
process.env["BS_VSCODE"] = '1'
5-
6-
var fs = require('fs')
7-
var path = require('path')
8-
var cp = require('child_process')
9-
var sourceDirs =
10-
['ext',
11-
'common',
12-
'syntax',
13-
'depends',
14-
'core',
15-
'super_errors',
16-
'outcome_printer',
17-
'bsb',
18-
'main',
19-
'others',
20-
'stdlib-406',
21-
'runtime',
22-
'test',
23-
'ounit_tests',
24-
'bsb_helper'
25-
]
3+
process.env["BS_VSCODE"] = "1";
264

5+
var fs = require("fs");
6+
var path = require("path");
7+
var cp = require("child_process");
8+
var sourceDirs = [
9+
"ext",
10+
"common",
11+
"syntax",
12+
"depends",
13+
"core",
14+
"super_errors",
15+
"outcome_printer",
16+
"bsb",
17+
"main",
18+
"others",
19+
"stdlib-406",
20+
"runtime",
21+
"test",
22+
"ounit_tests",
23+
"bsb_helper"
24+
];
2725

28-
var buildAppending = false
29-
var isBuilding = false
30-
var ninjaFile = require('./ninja.js')
31-
var jscompDir = path.join('..','jscomp')
32-
function rebuild(){
33-
console.log(">>>> Start compiling")
34-
if(isBuilding){
35-
buildAppending = true
36-
} else {
37-
isBuilding = true
38-
var p = cp.spawn(ninjaFile.vendorNinjaPath, [], {stdio:['inherit','inherit','pipe']})
39-
p.on('exit',buildFinished)
40-
}
26+
var buildAppending = false;
27+
var isBuilding = false;
28+
var ninjaFile = require("./ninja.js");
29+
var jscompDir = path.join("..", "jscomp");
30+
function rebuild() {
31+
console.log(">>>> Start compiling");
32+
if (isBuilding) {
33+
buildAppending = true;
34+
} else {
35+
isBuilding = true;
36+
var p = cp.spawn(ninjaFile.vendorNinjaPath, [], {
37+
stdio: ["inherit", "inherit", "pipe"]
38+
});
39+
p.on("exit", buildFinished);
40+
}
4141
}
4242
/**
43-
*
43+
*
4444
* @param {number} code
4545
* @param {string} signal
4646
*/
47-
function buildFinished(code,signal){
48-
isBuilding = false
49-
if(buildAppending ) {
50-
buildAppending = false
51-
rebuild()
52-
} else{
53-
if(code !== 0){
54-
console.log(`File "BUILD", line 1, characters 1-1:`)
55-
console.log(`Error: Failed to build`)
56-
}
57-
console.log(">>>> Finish compiling")
58-
// TODO: check ninja exit error code
59-
if(code===0){
60-
// This is not always correct
61-
ninjaFile.updateDev()
62-
}
63-
47+
function buildFinished(code, signal) {
48+
isBuilding = false;
49+
if (buildAppending) {
50+
buildAppending = false;
51+
rebuild();
52+
} else {
53+
if (code !== 0) {
54+
console.log(`File "BUILD", line 1, characters 1-1:`);
55+
console.log(`Error: Failed to build`);
6456
}
65-
57+
console.log(">>>> Finish compiling");
58+
// TODO: check ninja exit error code
59+
if (code === 0) {
60+
// This is not always correct
61+
ninjaFile.updateDev();
62+
}
63+
}
6664
}
6765
/**
68-
*
69-
* @param {string} eventType
70-
* @param {string} filename
66+
*
67+
* @param {string} eventType
68+
* @param {string} filename
7169
*/
72-
function onSourceChange(eventType, filename){
73-
// console.log('event ', eventType,filename)
74-
if(filename.endsWith('.ml') || filename.endsWith('.mli')){
75-
rebuild()
76-
}
77-
70+
function onSourceChange(eventType, filename) {
71+
// console.log('event ', eventType,filename)
72+
if (filename.endsWith(".ml") || filename.endsWith(".mli")) {
73+
rebuild();
74+
}
7875
}
7976

80-
sourceDirs.forEach(x=>{
81-
fs.watch(path.join(jscompDir,x), 'utf8',onSourceChange)
82-
})
83-
rebuild()
77+
sourceDirs.forEach(x => {
78+
fs.watch(path.join(jscompDir, x), "utf8", onSourceChange);
79+
});
80+
rebuild();

0 commit comments

Comments
 (0)