Skip to content

Commit d4e9ca1

Browse files
committed
Make build -with-deps a default behaviour
1 parent 6e2bf19 commit d4e9ca1

File tree

2 files changed

+9
-37
lines changed

2 files changed

+9
-37
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
- Conditionally print error message about record with missing label potentially being a component. https://github.com/rescript-lang/rescript-compiler/pull/6337
2525
- Put definition in the bottom and the actual error at the top when reporting errors for supplying fields etc with the wrong name. https://github.com/rescript-lang/rescript-compiler/pull/6336
2626
- Fix left over places where polyvariant tag names were printed in OCaml syntax instead of ReScript. https://github.com/rescript-lang/rescript-compiler/pull/6348
27+
- `rescript build` will always build its dependency by default. The argument `-with-deps` is not needed anymore. https://github.com/rescript-lang/rescript-compiler/pull/6350
2728

2829
# 11.0.0-beta.4
2930

jscomp/bsb_exe/rescript_main.ml

+8-37
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ let separator = "--"
2828

2929
let watch_mode = ref false
3030

31-
let make_world = ref false
32-
3331
let do_install = ref false
3432

3533
let force_regenerate = ref false
@@ -109,24 +107,6 @@ let install_target () =
109107
let eid = Bsb_unix.run_command_execv install_command in
110108
if eid <> 0 then Bsb_unix.command_fatal_error install_command eid
111109

112-
(** check if every dependency installation dierctory is there
113-
This is in hot path, so we want it to be fast.
114-
The heuristics is that if the installation directory is not there,
115-
we definitely need build the world.
116-
If it is there, we do not check if it is up-to-date, since that's
117-
going be slow, user can use `-with-deps` to enforce such check
118-
*)
119-
let check_deps_installation_directory (config_opt : Bsb_config_types.t option) :
120-
bool =
121-
match config_opt with
122-
| Some { bs_dependencies; bs_dev_dependencies } ->
123-
not
124-
(Ext_list.for_all bs_dependencies (fun x ->
125-
Ext_sys.is_directory_no_exn x.package_install_path)
126-
&& Ext_list.for_all bs_dev_dependencies (fun x ->
127-
Ext_sys.is_directory_no_exn x.package_install_path))
128-
| None -> false
129-
130110
let build_subcommand ~start argv argv_len =
131111
let i = Ext_array.rfind_with_index argv Ext_string.equal separator in
132112

@@ -135,10 +115,10 @@ let build_subcommand ~start argv argv_len =
135115
~argv
136116
[|
137117
("-w", unit_set_spec watch_mode, "Watch mode");
138-
("-with-deps", unit_set_spec make_world, "Build dependencies explicitly");
118+
("-with-deps", unit_set_spec (ref true), "*deprecated* Build dependencies explicitly");
139119
( "-install",
140120
unit_set_spec do_install,
141-
"*internal* Install public interface files for dependencies " );
121+
"*internal* Install public interface files for dependencies" );
142122
(* This should be put in a subcommand
143123
previously it works with the implication `bsb && bsb -install`
144124
*)
@@ -162,15 +142,8 @@ let build_subcommand ~start argv argv_len =
162142
| _ ->
163143
let config_opt =
164144
Bsb_ninja_regen.regenerate_ninja ~package_kind:Toplevel
165-
~per_proj_dir:Bsb_global_paths.cwd ~forced:!force_regenerate
166-
in
167-
let implict_build = check_deps_installation_directory config_opt in
168-
(match (!make_world, implict_build) with
169-
| true, _ ->
170-
Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt ninja_args
171-
| false, true ->
172-
Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||]
173-
| false, false -> ());
145+
~per_proj_dir:Bsb_global_paths.cwd ~forced:!force_regenerate in
146+
Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt ninja_args;
174147
if !do_install then install_target ();
175148
if !watch_mode then exit 0 (* let the watcher do the build*)
176149
else ninja_command_exit ninja_args
@@ -179,8 +152,8 @@ let clean_subcommand ~start argv =
179152
Bsb_arg.parse_exn ~usage:clean_usage ~start ~argv
180153
[|
181154
( "-with-deps",
182-
unit_set_spec make_world,
183-
"*internal* Clean dependencies too" );
155+
unit_set_spec (ref true),
156+
"*deprecated* Clean dependencies too" );
184157
("-verbose", call_spec Bsb_log.verbose, "Set the output to be verbose");
185158
|]
186159
failed_annon;
@@ -226,10 +199,8 @@ let () =
226199
(* specialize this path which is used in watcher *)
227200
let config_opt =
228201
Bsb_ninja_regen.regenerate_ninja ~package_kind:Toplevel ~forced:false
229-
~per_proj_dir:Bsb_global_paths.cwd
230-
in
231-
if !make_world || check_deps_installation_directory config_opt then
232-
Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||];
202+
~per_proj_dir:Bsb_global_paths.cwd in
203+
Bsb_world.make_world_deps Bsb_global_paths.cwd config_opt [||];
233204
ninja_command_exit [||])
234205
else
235206
match argv.(1) with

0 commit comments

Comments
 (0)