Skip to content

Commit bb8d729

Browse files
committed
better inferences when -o not passed
1 parent 224a31f commit bb8d729

File tree

4 files changed

+82
-78
lines changed

4 files changed

+82
-78
lines changed

jscomp/bsb/bsb_ninja_rule.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ let make_custom_rules
121121
~(digest : string)
122122
~(refmt : string option) (* set refmt path when needed *)
123123
~(package_specs: Bsb_package_specs.t)
124-
~namespace
124+
~(namespace : string option)
125125
~package_name
126126
~bsc
127127
~warnings
@@ -172,7 +172,7 @@ let make_custom_rules
172172
Ext_buffer.add_string buf package_name;
173173
Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
174174
end;
175-
Ext_buffer.add_string buf " -o $out $i";
175+
Ext_buffer.add_string buf " $i";
176176
begin match postbuild with
177177
| None -> ()
178178
| Some cmd ->

jscomp/main/js_main.ml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
(***********************************************************************)
1212

1313
let output_prefix name =
14-
let oname =
15-
match !Clflags.output_name with
16-
| None -> name
17-
| Some n -> (Clflags.output_name := None; n) in
18-
Filename.remove_extension oname
14+
match !Clflags.output_name with
15+
| None ->
16+
Ext_namespace_encode.make
17+
(Filename.remove_extension name)
18+
?ns:!Clflags.dont_record_crc_unit
19+
| Some oname ->
20+
Filename.remove_extension oname
1921

2022

2123
let process_interface_file ppf name =

lib/4.06.1/bsb.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12948,7 +12948,7 @@ let make_custom_rules
1294812948
~(digest : string)
1294912949
~(refmt : string option) (* set refmt path when needed *)
1295012950
~(package_specs: Bsb_package_specs.t)
12951-
~namespace
12951+
~(namespace : string option)
1295212952
~package_name
1295312953
~bsc
1295412954
~warnings
@@ -12999,7 +12999,7 @@ let make_custom_rules
1299912999
Ext_buffer.add_string buf package_name;
1300013000
Ext_buffer.add_string buf (Bsb_package_specs.package_flag_of_package_specs package_specs "$in_d")
1300113001
end;
13002-
Ext_buffer.add_string buf " -o $out $i";
13002+
Ext_buffer.add_string buf " $i";
1300313003
begin match postbuild with
1300413004
| None -> ()
1300513005
| Some cmd ->

lib/4.06.1/whole_compiler.ml

Lines changed: 71 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -366101,6 +366101,70 @@ let write_file f content =
366101366101
end
366102366102

366103366103
end
366104+
module Ext_namespace_encode : sig
366105+
#1 "ext_namespace_encode.mli"
366106+
(* Copyright (C) 2020- Authors of BuckleScript
366107+
*
366108+
* This program is free software: you can redistribute it and/or modify
366109+
* it under the terms of the GNU Lesser General Public License as published by
366110+
* the Free Software Foundation, either version 3 of the License, or
366111+
* (at your option) any later version.
366112+
*
366113+
* In addition to the permissions granted to you by the LGPL, you may combine
366114+
* or link a "work that uses the Library" with a publicly distributed version
366115+
* of this file to produce a combined library or application, then distribute
366116+
* that combined work under the terms of your choosing, with no requirement
366117+
* to comply with the obligations normally placed on you by section 4 of the
366118+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
366119+
* should you choose to use a later version).
366120+
*
366121+
* This program is distributed in the hope that it will be useful,
366122+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
366123+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366124+
* GNU Lesser General Public License for more details.
366125+
*
366126+
* You should have received a copy of the GNU Lesser General Public License
366127+
* along with this program; if not, write to the Free Software
366128+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
366129+
366130+
(** [make ~ns:"Ns" "a" ]
366131+
A typical example would return "a-Ns"
366132+
Note the namespace comes from the output of [namespace_of_package_name]
366133+
*)
366134+
val make :
366135+
?ns:string -> string -> string
366136+
366137+
end = struct
366138+
#1 "ext_namespace_encode.ml"
366139+
(* Copyright (C) 2020- Authors of BuckleScript
366140+
*
366141+
* This program is free software: you can redistribute it and/or modify
366142+
* it under the terms of the GNU Lesser General Public License as published by
366143+
* the Free Software Foundation, either version 3 of the License, or
366144+
* (at your option) any later version.
366145+
*
366146+
* In addition to the permissions granted to you by the LGPL, you may combine
366147+
* or link a "work that uses the Library" with a publicly distributed version
366148+
* of this file to produce a combined library or application, then distribute
366149+
* that combined work under the terms of your choosing, with no requirement
366150+
* to comply with the obligations normally placed on you by section 4 of the
366151+
* LGPL version 3 (or the corresponding section of a later version of the LGPL
366152+
* should you choose to use a later version).
366153+
*
366154+
* This program is distributed in the hope that it will be useful,
366155+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
366156+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366157+
* GNU Lesser General Public License for more details.
366158+
*
366159+
* You should have received a copy of the GNU Lesser General Public License
366160+
* along with this program; if not, write to the Free Software
366161+
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
366162+
366163+
let make ?ns cunit =
366164+
match ns with
366165+
| None -> cunit
366166+
| Some ns -> cunit ^ Literals.ns_sep ^ ns
366167+
end
366104366168
module Depend : sig
366105366169
#1 "depend.mli"
366106366170
(**************************************************************************)
@@ -367330,70 +367394,6 @@ end = struct
367330367394

367331367395
let hex_length = 32
367332367396
end
367333-
module Ext_namespace_encode : sig
367334-
#1 "ext_namespace_encode.mli"
367335-
(* Copyright (C) 2020- Authors of BuckleScript
367336-
*
367337-
* This program is free software: you can redistribute it and/or modify
367338-
* it under the terms of the GNU Lesser General Public License as published by
367339-
* the Free Software Foundation, either version 3 of the License, or
367340-
* (at your option) any later version.
367341-
*
367342-
* In addition to the permissions granted to you by the LGPL, you may combine
367343-
* or link a "work that uses the Library" with a publicly distributed version
367344-
* of this file to produce a combined library or application, then distribute
367345-
* that combined work under the terms of your choosing, with no requirement
367346-
* to comply with the obligations normally placed on you by section 4 of the
367347-
* LGPL version 3 (or the corresponding section of a later version of the LGPL
367348-
* should you choose to use a later version).
367349-
*
367350-
* This program is distributed in the hope that it will be useful,
367351-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
367352-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
367353-
* GNU Lesser General Public License for more details.
367354-
*
367355-
* You should have received a copy of the GNU Lesser General Public License
367356-
* along with this program; if not, write to the Free Software
367357-
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
367358-
367359-
(** [make ~ns:"Ns" "a" ]
367360-
A typical example would return "a-Ns"
367361-
Note the namespace comes from the output of [namespace_of_package_name]
367362-
*)
367363-
val make :
367364-
?ns:string -> string -> string
367365-
367366-
end = struct
367367-
#1 "ext_namespace_encode.ml"
367368-
(* Copyright (C) 2020- Authors of BuckleScript
367369-
*
367370-
* This program is free software: you can redistribute it and/or modify
367371-
* it under the terms of the GNU Lesser General Public License as published by
367372-
* the Free Software Foundation, either version 3 of the License, or
367373-
* (at your option) any later version.
367374-
*
367375-
* In addition to the permissions granted to you by the LGPL, you may combine
367376-
* or link a "work that uses the Library" with a publicly distributed version
367377-
* of this file to produce a combined library or application, then distribute
367378-
* that combined work under the terms of your choosing, with no requirement
367379-
* to comply with the obligations normally placed on you by section 4 of the
367380-
* LGPL version 3 (or the corresponding section of a later version of the LGPL
367381-
* should you choose to use a later version).
367382-
*
367383-
* This program is distributed in the hope that it will be useful,
367384-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
367385-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
367386-
* GNU Lesser General Public License for more details.
367387-
*
367388-
* You should have received a copy of the GNU Lesser General Public License
367389-
* along with this program; if not, write to the Free Software
367390-
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
367391-
367392-
let make ?ns cunit =
367393-
match ns with
367394-
| None -> cunit
367395-
| Some ns -> cunit ^ Literals.ns_sep ^ ns
367396-
end
367397367397
module Ext_modulename : sig
367398367398
#1 "ext_modulename.mli"
367399367399
(* Copyright (C) 2017 Authors of BuckleScript
@@ -436137,11 +436137,13 @@ end = struct
436137436137
(***********************************************************************)
436138436138

436139436139
let output_prefix name =
436140-
let oname =
436141-
match !Clflags.output_name with
436142-
| None -> name
436143-
| Some n -> (Clflags.output_name := None; n) in
436144-
Filename.remove_extension oname
436140+
match !Clflags.output_name with
436141+
| None ->
436142+
Ext_namespace_encode.make
436143+
(Filename.remove_extension name)
436144+
?ns:!Clflags.dont_record_crc_unit
436145+
| Some oname ->
436146+
Filename.remove_extension oname
436145436147

436146436148

436147436149
let process_interface_file ppf name =

0 commit comments

Comments
 (0)