Skip to content

Commit 573ca46

Browse files
authored
Merge pull request #1100 from bloomberg/fix_empty_file_error
introduce dev group which will not be built during make-world
2 parents 0ba36c8 + 0c703a9 commit 573ca46

File tree

4 files changed

+46
-40
lines changed

4 files changed

+46
-40
lines changed

bin/bsb

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,33 @@ var fs = require('fs')
66
var bsconfig = 'bsconfig.json'
77
var bsb_exe = __filename + ".exe"
88
var delegate_args = process.argv.slice(2)
9-
10-
if(fs.existsSync(bsconfig)){
11-
child_process.execFileSync(bsb_exe, delegate_args, {stdio:'inherit'})
9+
// function uncaughtHandler(err){
10+
// console.error('command failed')
11+
// }
12+
// process.on('uncaughtException',uncaughtHandler)
13+
if (fs.existsSync(bsconfig)) {
14+
try {
15+
child_process.execFileSync(bsb_exe, delegate_args, { stdio: 'inherit' })
16+
} catch (e) {
17+
console.error('Error happend when running command', bsb_exe, 'with args', delete_args)
18+
}
1219
} else {
1320
var path = require('path')
1421
var last_dir = process.cwd()
15-
var search_dir = last_dir
16-
do{
22+
var search_dir = last_dir
23+
do {
1724
last_dir = search_dir
18-
search_dir = path.dirname(last_dir)
19-
}while(!fs.existsSync(path.join(search_dir,bsconfig)) && (search_dir.length !== search_dir.length))
20-
if(search_dir.length === last_dir.length){
25+
search_dir = path.dirname(last_dir)
26+
} while (!fs.existsSync(path.join(search_dir, bsconfig)) && (search_dir.length !== last_dir.length))
27+
if (search_dir.length === last_dir.length) {
2128
console.error('bsconfig.json not found in current directory and its parent')
2229
process.exit(2)
23-
}else{
24-
child_process.execFileSync(bsb_exe, delegate_args, {stdio:'inherit', cwd: search_dir} )
25-
}
30+
} else {
31+
console.log("Root project : " , search_dir)
32+
try {
33+
child_process.execFileSync(bsb_exe, delegate_args, { stdio: 'inherit', cwd: search_dir })
34+
} catch (e) {
35+
console.error('Error happend when running command', bsb_exe, 'with args', delete_args)
36+
}
37+
}
2638
}

docs/Manual.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5102,4 +5102,4 @@ <h3 id="_1_0"><a class="anchor" href="#_1_0"></a>1.0</h3>
51025102
</div>
51035103
</div>
51045104
</body>
5105-
</html>
5105+
</html>

jscomp/bin/bsb_helper.ml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,15 +2356,12 @@ let handle_bin_depfile oprefix (fn : string) index : unit =
23562356
v
23572357
end
23582358
) ([],String.length dependent_file) set in
2359-
2359+
(* https://github.com/ninja-build/ninja/issues/1229 *)
23602360
let output = input_file ^ Literals.suffix_mlastd in
2361-
if files = [] then
2362-
close_out (open_out_bin output)
2363-
else
2364-
let deps = Ext_string.unsafe_concat_with_length len
2365-
space
2366-
(dependent_file :: files) in
2367-
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
2361+
let deps = Ext_string.unsafe_concat_with_length len
2362+
space
2363+
(dependent_file :: files) in
2364+
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
23682365

23692366
| None ->
23702367
begin match Ext_string.ends_with_then_chop fn Literals.suffix_mliast with
@@ -2395,12 +2392,12 @@ let handle_bin_depfile oprefix (fn : string) index : unit =
23952392

23962393
) ([], String.length dependent_file) set in
23972394
let output = input_file ^ Literals.suffix_mliastd in
2398-
if files = [] then close_out (open_out_bin output)
2399-
else
2400-
let deps = Ext_string.unsafe_concat_with_length len
2401-
space
2402-
(dependent_file :: files) in
2403-
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
2395+
(* https://github.com/ninja-build/ninja/issues/1229 *)
2396+
let deps =
2397+
Ext_string.unsafe_concat_with_length len
2398+
space
2399+
(dependent_file :: files) in
2400+
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
24042401
| None ->
24052402
raise (Arg.Bad ("don't know what to do with " ^ fn))
24062403
end

jscomp/depends/depends_post_process.ml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,12 @@ let handle_bin_depfile oprefix (fn : string) index : unit =
8787
v
8888
end
8989
) ([],String.length dependent_file) set in
90-
90+
(* https://github.com/ninja-build/ninja/issues/1229 *)
9191
let output = input_file ^ Literals.suffix_mlastd in
92-
if files = [] then
93-
close_out (open_out_bin output)
94-
else
95-
let deps = Ext_string.unsafe_concat_with_length len
96-
space
97-
(dependent_file :: files) in
98-
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
92+
let deps = Ext_string.unsafe_concat_with_length len
93+
space
94+
(dependent_file :: files) in
95+
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
9996

10097
| None ->
10198
begin match Ext_string.ends_with_then_chop fn Literals.suffix_mliast with
@@ -126,12 +123,12 @@ let handle_bin_depfile oprefix (fn : string) index : unit =
126123

127124
) ([], String.length dependent_file) set in
128125
let output = input_file ^ Literals.suffix_mliastd in
129-
if files = [] then close_out (open_out_bin output)
130-
else
131-
let deps = Ext_string.unsafe_concat_with_length len
132-
space
133-
(dependent_file :: files) in
134-
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
126+
(* https://github.com/ninja-build/ninja/issues/1229 *)
127+
let deps =
128+
Ext_string.unsafe_concat_with_length len
129+
space
130+
(dependent_file :: files) in
131+
Ext_pervasives.with_file_as_chan output (fun v -> output_string v deps)
135132
| None ->
136133
raise (Arg.Bad ("don't know what to do with " ^ fn))
137134
end

0 commit comments

Comments
 (0)