Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- Remove handling of attributes with `bs.` prefix (`@bs.as` -> `@as` etc.). https://github.com/rescript-lang/rescript-compiler/pull/6643
- Remove obsolete `@bs.open` feature. https://github.com/rescript-lang/rescript-compiler/pull/6629
- Drop Node.js version <18 support, due to it reaching End-of-Life. https://github.com/rescript-lang/rescript-compiler/pull/6429
- Drop `bsconfig.json` support. https://github.com/rescript-lang/rescript-compiler/pull/6781

#### :bug: Bug Fix

Expand Down
7 changes: 0 additions & 7 deletions bsconfig.json

This file was deleted.

4 changes: 2 additions & 2 deletions jscomp/bsb/bsb_build_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ let extract_pinned_dependencies (map : Ext_json_types.t Map_string.t) : Set_stri

let rec walk_all_deps_aux (visited : string Hash_string.t) (paths : string list)
~(top : top) (dir : string) (queue : _ Queue.t) ~pinned_dependencies =
match Bsb_config_load.load_json ~per_proj_dir:dir ~warn_legacy_config:false with
| _, Obj { map; loc } ->
match Bsb_config_load.load_json ~per_proj_dir:dir with
| Obj { map; loc } ->
let cur_package_name =
match Map_string.find_opt map Bsb_build_schemas.name with
| Some (Str { str; loc }) ->
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_clean.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ let clean_bs_garbage proj_dir =
Bsb_log.warn "@{<warning>Failed@} to clean due to %s" (Printexc.to_string e)

let clean_bs_deps proj_dir =
let _, _, _, pinned_dependencies = Bsb_config_parse.deps_from_bsconfig () in
let _, _, _, pinned_dependencies = Bsb_config_parse.deps_from_config () in
let queue = Bsb_build_util.walk_all_deps proj_dir ~pinned_dependencies in
Queue.iter
(fun (pkg_cxt : Bsb_build_util.package_context) ->
Expand Down
25 changes: 3 additions & 22 deletions jscomp/bsb/bsb_config_load.ml
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
let ( // ) = Ext_path.combine

let load_json ~(per_proj_dir : string) ~(warn_legacy_config : bool)
: string * Ext_json_types.t =
let filename, abs, in_chan =
let filename = Literals.rescript_json in
let abs = (per_proj_dir // filename) in
match open_in abs
with
| in_chan -> (filename, abs, in_chan)
| exception e ->
let filename = Literals.bsconfig_json in
let abs = (per_proj_dir // filename) in
match open_in abs
with
| in_chan -> (filename, abs, in_chan)
| exception _ -> raise e (* forward error from rescript.json *)
in
if warn_legacy_config && filename = Literals.bsconfig_json then
print_endline "Warning: bsconfig.json is deprecated. Migrate it to rescript.json\n";
match Ext_json_parse.parse_json_from_chan abs in_chan
with
| v -> close_in in_chan ; (filename, v)
| exception e -> close_in in_chan ; raise e
let load_json ~(per_proj_dir : string)
: Ext_json_types.t =
Ext_json_parse.parse_json_from_file (per_proj_dir // Literals.rescript_json)
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_config_load.mli
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
val load_json :
per_proj_dir:string -> warn_legacy_config:bool -> string * Ext_json_types.t
per_proj_dir:string -> Ext_json_types.t
8 changes: 4 additions & 4 deletions jscomp/bsb/bsb_config_parse.ml
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ let interpret_json
Bsb_exception.invalid_spec ("no sources specified in " ^ filename))
| _ -> Bsb_exception.invalid_spec (filename ^ " expect a json object {}")

let deps_from_bsconfig () =
let deps_from_config () =
let cwd = Bsb_global_paths.cwd in
match Bsb_config_load.load_json ~per_proj_dir:cwd ~warn_legacy_config:false
match Bsb_config_load.load_json ~per_proj_dir:cwd
with
| _, Obj { map } ->
| Obj { map } ->
( Bsb_package_specs.from_map ~cwd map,
Bsb_jsx.from_map map,
extract_uncurried map,
Bsb_build_util.extract_pinned_dependencies map )
| _, _ -> assert false
| _ -> assert false
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_config_parse.mli
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)

val deps_from_bsconfig : unit -> Bsb_package_specs.t * Bsb_jsx.t * bool * Set_string.t
val deps_from_config : unit -> Bsb_package_specs.t * Bsb_jsx.t * bool * Set_string.t

val interpret_json :
filename:string ->
Expand Down
8 changes: 3 additions & 5 deletions jscomp/bsb/bsb_ninja_regen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ let ( // ) = Ext_path.combine
return None if we dont need regenerate
otherwise return Some info
*)
let regenerate_ninja ~(package_kind : Bsb_package_kind.t) ~forced ~per_proj_dir ~warn_legacy_config ~warn_as_error
let regenerate_ninja ~(package_kind : Bsb_package_kind.t) ~forced ~per_proj_dir ~warn_as_error
: Bsb_config_types.t option =
let lib_artifacts_dir = Bsb_config.lib_bs in
let lib_bs_dir = per_proj_dir // lib_artifacts_dir in
let output_deps = lib_bs_dir // bsdeps in
let check_result =
Bsb_ninja_check.check ~package_kind ~per_proj_dir ~forced ~file:output_deps
in
let config_filename, config_json =
Bsb_config_load.load_json ~per_proj_dir ~warn_legacy_config
in
let config_json = Bsb_config_load.load_json ~per_proj_dir in
match check_result with
| Good -> None (* Fast path, no need regenerate ninja *)
| Bsb_forced | Bsb_bsc_version_mismatch | Bsb_package_kind_inconsistent
Expand All @@ -56,7 +54,7 @@ let regenerate_ninja ~(package_kind : Bsb_package_kind.t) ~forced ~per_proj_dir

let config : Bsb_config_types.t =
Bsb_config_parse.interpret_json
~filename:config_filename ~json:config_json ~package_kind ~per_proj_dir
~filename:Literals.rescript_json ~json:config_json ~package_kind ~per_proj_dir
in

let warning = match config.warning with
Expand Down
1 change: 0 additions & 1 deletion jscomp/bsb/bsb_ninja_regen.mli
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ val regenerate_ninja :
package_kind:Bsb_package_kind.t ->
forced:bool ->
per_proj_dir:string ->
warn_legacy_config:bool ->
warn_as_error:string option ->
Bsb_config_types.t option
(** Regenerate ninja file by need based on [.bsdeps]
Expand Down
2 changes: 1 addition & 1 deletion jscomp/bsb/bsb_parse_sources.ml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ and walk_source_dir_map (cxt : walk_cxt) sub_dirs_field =
let clean_re_js root =
match
Ext_json_parse.parse_json_from_file
(Filename.concat root Literals.bsconfig_json)
(Filename.concat root Literals.rescript_json)
with
| Obj { map } ->
let ignored_dirs =
Expand Down
3 changes: 1 addition & 2 deletions jscomp/bsb/bsb_world.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let make_world_deps cwd (config : Bsb_config_types.t option)
we will read such json file to know which [package-specs]
it wants
*)
Bsb_config_parse.deps_from_bsconfig ()
Bsb_config_parse.deps_from_config ()
| Some config ->
(config.package_specs, config.jsx, config.uncurried, config.pinned_dependencies)
in
Expand Down Expand Up @@ -70,7 +70,6 @@ let make_world_deps cwd (config : Bsb_config_types.t option)
(if is_pinned then Pinned_dependency { package_specs; jsx; uncurried }
else Dependency { package_specs; jsx; uncurried })
~per_proj_dir:proj_dir ~forced:false
~warn_legacy_config:false
~warn_as_error:(if is_pinned then warn_as_error else None)
in
let command =
Expand Down
3 changes: 0 additions & 3 deletions jscomp/bsb_exe/rescript_main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ let build_subcommand ~start argv argv_len =
~package_kind:Toplevel
~per_proj_dir:Bsb_global_paths.cwd
~forced:!force_regenerate
~warn_legacy_config:true
~warn_as_error
in
if not !no_deps_mode then Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt ninja_args warn_as_error;
Expand Down Expand Up @@ -190,7 +189,6 @@ let info_subcommand ~start argv =
~package_kind:Toplevel
~per_proj_dir:Bsb_global_paths.cwd
~forced:true
~warn_legacy_config:true
~warn_as_error:None
with
| None -> assert false
Expand Down Expand Up @@ -221,7 +219,6 @@ let () =
~package_kind:Toplevel
~per_proj_dir:Bsb_global_paths.cwd
~forced:false
~warn_legacy_config:true
~warn_as_error:None
in
Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||] None;
Expand Down
8 changes: 0 additions & 8 deletions jscomp/build_tests/warn_legacy_config/bsconfig.json

This file was deleted.

10 changes: 0 additions & 10 deletions jscomp/build_tests/warn_legacy_config/input.js

This file was deleted.

1 change: 0 additions & 1 deletion jscomp/build_tests/warn_legacy_config/src/demo.res

This file was deleted.

2 changes: 1 addition & 1 deletion jscomp/ext/ext_path.ml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,6 @@ let rec find_root_filename ~cwd filenames =
find_root_filename ~cwd:cwd' filenames
else Ext_fmt.failwithf ~loc:__LOC__ "%s not found from %s" (List.hd filenames) cwd

let find_config_dir cwd = find_root_filename ~cwd [Literals.rescript_json; Literals.bsconfig_json]
let find_config_dir cwd = find_root_filename ~cwd [Literals.rescript_json]

let package_dir = lazy (find_config_dir (Lazy.force cwd))
2 changes: 0 additions & 2 deletions jscomp/ext/literals.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ let node_modules_length = String.length "node_modules"

let package_json = "package.json"

let bsconfig_json = "bsconfig.json"

let rescript_json = "rescript.json"

let build_ninja = "build.ninja"
Expand Down
2 changes: 1 addition & 1 deletion jscomp/ounit_tests/ounit_cmd_util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let (//) = Filename.concat

(** may nonterminate when [cwd] is '.' *)
let rec unsafe_root_dir_aux cwd =
if Sys.file_exists (cwd//Literals.bsconfig_json) then cwd
if Sys.file_exists (cwd // Literals.rescript_json) then cwd
else unsafe_root_dir_aux (Filename.dirname cwd)

let project_root = unsafe_root_dir_aux (Sys.getcwd ())
Expand Down
6 changes: 6 additions & 0 deletions rescript.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sources": {
"dir": "jscomp/test",
"dev": true
}
}