Skip to content

Commit 58f2369

Browse files
authored
Merge pull request #2989 from BuckleScript/more_portable
portable surface syntax implementation
2 parents d3da704 + 75618ef commit 58f2369

File tree

10 files changed

+27
-19
lines changed

10 files changed

+27
-19
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
language: node_js
22

3-
git:
4-
submodules: false
5-
# subtree now
63

74
env:
85
- BS_TRAVIS_CI=1
96
node_js:
107
- 6
118

9+
# before_install: make -C jscomp force-snapshotml
10+
# https://docs.travis-ci.com/user/customizing-the-build/#the-build-lifecycle
1211
# script: npm run coveralls
1312
# if we turn on this script, we should make
1413
# sure `npm test` is executed

jscomp/common/js_config.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ let set_current_file f = current_file := f
7878
let get_current_file () = !current_file
7979
let get_module_name () =
8080
Filename.chop_extension
81-
(Filename.basename (String.uncapitalize !current_file))
81+
(Filename.basename (Ext_string.uncapitalize_ascii !current_file))
8282

8383
let iset_debug_file _ = ()
8484
let set_debug_file f = debug_file := f

jscomp/core/config_util.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
let find_in_path_uncap path name =
31-
let uname = String.uncapitalize name in
31+
let uname = Ext_string.uncapitalize_ascii name in
3232
let rec try_dir = function
3333
| [] -> None
3434
| dir::rem ->

jscomp/core/js_cmj_load.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let find_cmj file : string * Js_cmj_format.t =
3535
(* ONLY read the stored cmj data in browser environment *)
3636
#if BS_COMPILER_IN_BROWSER then
3737
"BROWSER", (
38-
let target = String.uncapitalize (Filename.basename file) in
38+
let target = Ext_string.uncapitalize_ascii (Filename.basename file) in
3939
match String_map.find_exn target !Js_cmj_datasets.data_sets with
4040
| v
4141
->

jscomp/core/js_name_of_module_id.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let string_of_module_id_in_browser (x : Lam_module_ident.t) =
2929
match x.kind with
3030
| External name -> name
3131
| Runtime | Ml ->
32-
"./stdlib/" ^ String.uncapitalize x.id.name ^ ".js"
32+
"./stdlib/" ^ Ext_string.uncapitalize_ascii x.id.name ^ ".js"
3333
let string_of_module_id
3434
~output_dir:(_:string)
3535
(_module_system : Js_packages_info.module_system)

jscomp/syntax/ast_derive_projector.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let init () =
4141
( {pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
4242
Parsetree.constructor_declaration)
4343
-> (* TODO: add type annotations *)
44-
let little_con_name = String.uncapitalize con_name in
44+
let little_con_name = Ext_string.uncapitalize_ascii con_name in
4545
let arity = List.length pcd_args in
4646
Ast_comb.single_non_rec_value {loc ; txt = little_con_name}
4747
(
@@ -106,7 +106,7 @@ let init () =
106106
(fun ({pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
107107
Parsetree.constructor_declaration)
108108
->
109-
Ast_comb.single_non_rec_val {loc ; txt = (String.uncapitalize con_name)}
109+
Ast_comb.single_non_rec_val {loc ; txt = (Ext_string.uncapitalize_ascii con_name)}
110110
(Ext_list.fold_right
111111
(fun x acc -> Typ.arrow "" x acc)
112112
pcd_args

lib/bsdep.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27250,7 +27250,7 @@ let set_current_file f = current_file := f
2725027250
let get_current_file () = !current_file
2725127251
let get_module_name () =
2725227252
Filename.chop_extension
27253-
(Filename.basename (String.uncapitalize !current_file))
27253+
(Filename.basename (Ext_string.uncapitalize_ascii !current_file))
2725427254

2725527255
let iset_debug_file _ = ()
2725627256
let set_debug_file f = debug_file := f
@@ -35857,7 +35857,7 @@ let init () =
3585735857
( {pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
3585835858
Parsetree.constructor_declaration)
3585935859
-> (* TODO: add type annotations *)
35860-
let little_con_name = String.uncapitalize con_name in
35860+
let little_con_name = Ext_string.uncapitalize_ascii con_name in
3586135861
let arity = List.length pcd_args in
3586235862
Ast_comb.single_non_rec_value {loc ; txt = little_con_name}
3586335863
(
@@ -35922,7 +35922,7 @@ let init () =
3592235922
(fun ({pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
3592335923
Parsetree.constructor_declaration)
3592435924
->
35925-
Ast_comb.single_non_rec_val {loc ; txt = (String.uncapitalize con_name)}
35925+
Ast_comb.single_non_rec_val {loc ; txt = (Ext_string.uncapitalize_ascii con_name)}
3592635926
(Ext_list.fold_right
3592735927
(fun x acc -> Typ.arrow "" x acc)
3592835928
pcd_args

lib/bsppx.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9192,7 +9192,7 @@ let set_current_file f = current_file := f
91929192
let get_current_file () = !current_file
91939193
let get_module_name () =
91949194
Filename.chop_extension
9195-
(Filename.basename (String.uncapitalize !current_file))
9195+
(Filename.basename (Ext_string.uncapitalize_ascii !current_file))
91969196

91979197
let iset_debug_file _ = ()
91989198
let set_debug_file f = debug_file := f
@@ -17862,7 +17862,7 @@ let init () =
1786217862
( {pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
1786317863
Parsetree.constructor_declaration)
1786417864
-> (* TODO: add type annotations *)
17865-
let little_con_name = String.uncapitalize con_name in
17865+
let little_con_name = Ext_string.uncapitalize_ascii con_name in
1786617866
let arity = List.length pcd_args in
1786717867
Ast_comb.single_non_rec_value {loc ; txt = little_con_name}
1786817868
(
@@ -17927,7 +17927,7 @@ let init () =
1792717927
(fun ({pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
1792817928
Parsetree.constructor_declaration)
1792917929
->
17930-
Ast_comb.single_non_rec_val {loc ; txt = (String.uncapitalize con_name)}
17930+
Ast_comb.single_non_rec_val {loc ; txt = (Ext_string.uncapitalize_ascii con_name)}
1793117931
(Ext_list.fold_right
1793217932
(fun x acc -> Typ.arrow "" x acc)
1793317933
pcd_args

lib/whole_compiler.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23079,7 +23079,7 @@ let set_current_file f = current_file := f
2307923079
let get_current_file () = !current_file
2308023080
let get_module_name () =
2308123081
Filename.chop_extension
23082-
(Filename.basename (String.uncapitalize !current_file))
23082+
(Filename.basename (Ext_string.uncapitalize_ascii !current_file))
2308323083

2308423084
let iset_debug_file _ = ()
2308523085
let set_debug_file f = debug_file := f
@@ -59978,7 +59978,7 @@ end = struct
5997859978

5997959979

5998059980
let find_in_path_uncap path name =
59981-
let uname = String.uncapitalize name in
59981+
let uname = Ext_string.uncapitalize_ascii name in
5998259982
let rec try_dir = function
5998359983
| [] -> None
5998459984
| dir::rem ->
@@ -111306,7 +111306,7 @@ let init () =
111306111306
( {pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
111307111307
Parsetree.constructor_declaration)
111308111308
-> (* TODO: add type annotations *)
111309-
let little_con_name = String.uncapitalize con_name in
111309+
let little_con_name = Ext_string.uncapitalize_ascii con_name in
111310111310
let arity = List.length pcd_args in
111311111311
Ast_comb.single_non_rec_value {loc ; txt = little_con_name}
111312111312
(
@@ -111371,7 +111371,7 @@ let init () =
111371111371
(fun ({pcd_name = {loc ; txt = con_name} ; pcd_args ; pcd_loc }:
111372111372
Parsetree.constructor_declaration)
111373111373
->
111374-
Ast_comb.single_non_rec_val {loc ; txt = (String.uncapitalize con_name)}
111374+
Ast_comb.single_non_rec_val {loc ; txt = (Ext_string.uncapitalize_ascii con_name)}
111375111375
(Ext_list.fold_right
111376111376
(fun x acc -> Typ.arrow "" x acc)
111377111377
pcd_args

scripts/install.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,18 @@ function non_windows_npm_release() {
151151
return true // already built before
152152
}
153153
if (checkPrebuilt()) {
154+
// release mode, already has bsc.exe
154155
child_process.execSync(make + " libs && " + make + " install", root_dir_config)
155156
} else {
156157
tryToProvideOCamlCompiler()
158+
if(process.env.BS_TRAVIS_CI === "1"){
159+
console.log('Enforcing snapshot in CI mode')
160+
if(fs.existsSync(path.join(root_dir,'jscomp','Makefile'))){
161+
child_process.execSync("make -C jscomp force-snapshotml", root_dir_config)
162+
} else {
163+
console.log("jscomp/Makefile is missing")
164+
}
165+
}
157166
child_process.execSync(make + " world && " + make + " install", root_dir_config)
158167
}
159168
}

0 commit comments

Comments
 (0)